From 957093e8c56d6a5cc1e7fa22f50132b8e4d1bb07 Mon Sep 17 00:00:00 2001 From: spider Date: Mon, 22 Jun 1998 21:19:46 +0000 Subject: [PATCH] Normandy Merge .... git-svn-id: svn://10.0.0.236/trunk@4231 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/build/mac/BuildList.pm | 37 +- mozilla/build/mac/BuildMozilla.pl | 7 +- mozilla/build/mac/BuildMozillaDebug.pl | 7 +- mozilla/build/mac/MacExportListPublic | 45 +- mozilla/cmd/winfe/abmldlg.cpp | 1287 +++- mozilla/cmd/winfe/abmldlg.h | 183 +- mozilla/cmd/winfe/addrdlg.cpp | 2700 ++++++++- mozilla/cmd/winfe/addrdlg.h | 508 ++ mozilla/cmd/winfe/addrfrm.cpp | 4209 +++++++++++++- mozilla/cmd/winfe/addrfrm.h | 604 +- mozilla/cmd/winfe/animecho.cpp | 20 + mozilla/cmd/winfe/animecho.h | 20 + mozilla/cmd/winfe/apiaddr.h | 74 + mozilla/cmd/winfe/apichrom.h | 4 +- mozilla/cmd/winfe/askmedlg.cpp | 41 +- mozilla/cmd/winfe/compbar.cpp | 248 +- mozilla/cmd/winfe/compbar.h | 19 +- mozilla/cmd/winfe/compfe.cpp | 3 + mozilla/cmd/winfe/compfile.cpp | 57 +- mozilla/cmd/winfe/compfrm.cpp | 172 +- mozilla/cmd/winfe/compfrm.h | 10 +- mozilla/cmd/winfe/cxabstra.cpp | 16 +- mozilla/cmd/winfe/cxsave.cpp | 210 +- mozilla/cmd/winfe/cxsave.h | 7 + mozilla/cmd/winfe/cxwin.cpp | 7 +- mozilla/cmd/winfe/display.cpp | 22 + mozilla/cmd/winfe/edhdrdlg.cpp | 16 +- mozilla/cmd/winfe/edhdrdlg.h | 2 + mozilla/cmd/winfe/editor.rc | 2 + mozilla/cmd/winfe/edtclass.cpp | 1 + mozilla/cmd/winfe/fegrid.cpp | 5 +- mozilla/cmd/winfe/fegui.cpp | 13 +- mozilla/cmd/winfe/femess.cpp | 5 +- mozilla/cmd/winfe/feorphan.cpp | 4 +- mozilla/cmd/winfe/filter.cpp | 965 ++- mozilla/cmd/winfe/filter.h | 69 +- mozilla/cmd/winfe/fldrfrm.cpp | 138 +- mozilla/cmd/winfe/fldrfrm.h | 2 - mozilla/cmd/winfe/genchrom.cpp | 16 +- mozilla/cmd/winfe/genchrom.h | 4 +- mozilla/cmd/winfe/genfram2.cpp | 160 +- mozilla/cmd/winfe/genframe.cpp | 129 +- mozilla/cmd/winfe/genframe.h | 17 +- mozilla/cmd/winfe/hiddenfr.cpp | 9 +- mozilla/cmd/winfe/intlwin.cpp | 14 +- mozilla/cmd/winfe/ipframe.cpp | 4 - mozilla/cmd/winfe/logindg.cpp | 103 +- mozilla/cmd/winfe/mailfrm.cpp | 692 ++- mozilla/cmd/winfe/mailfrm.h | 48 + mozilla/cmd/winfe/mailfrm2.cpp | 160 + mozilla/cmd/winfe/mailmisc.cpp | 248 +- mozilla/cmd/winfe/mailmisc.h | 61 +- mozilla/cmd/winfe/mailpriv.cpp | 464 +- mozilla/cmd/winfe/mailpriv.h | 77 +- mozilla/cmd/winfe/mainfrm.cpp | 3 + mozilla/cmd/winfe/makefile.win | 2 +- mozilla/cmd/winfe/mapi/maindll.cpp | 81 + mozilla/cmd/winfe/mapi/mapi32.cpp | 2368 ++++++++ mozilla/cmd/winfe/mapi/mapi32.def | 15 + mozilla/cmd/winfe/mapi/mapi32.mak | 413 ++ mozilla/cmd/winfe/mapi/mapi32.rc | 173 + mozilla/cmd/winfe/mapi/mapiipc.cpp | 230 + mozilla/cmd/winfe/mapi/mapiipc.h | 44 + mozilla/cmd/winfe/mapi/mapimem.cpp | 344 ++ mozilla/cmd/winfe/mapi/mapimem.h | 57 + mozilla/cmd/winfe/mapi/mapiutl.cpp | 985 ++++ mozilla/cmd/winfe/mapi/mapiutl.h | 67 + mozilla/cmd/winfe/mapi/port.h | 284 + mozilla/cmd/winfe/mapi/resource.h | 36 + mozilla/cmd/winfe/mapi/smem.cpp | 153 + mozilla/cmd/winfe/mapi/trace.cpp | 56 + mozilla/cmd/winfe/mapi/trace.h | 63 + mozilla/cmd/winfe/mapi/xpapi.cpp | 331 ++ mozilla/cmd/winfe/mapi/xpapi.h | 120 + mozilla/cmd/winfe/mapihook.cpp | 53 +- mozilla/cmd/winfe/mapimail.cpp | 265 +- mozilla/cmd/winfe/mapitest/main.cpp | 220 + mozilla/cmd/winfe/mapitest/mapimail.cpp | 753 +++ mozilla/cmd/winfe/mapitest/mapiproc.cpp | 814 +++ mozilla/cmd/winfe/mapitest/mtest32.mak | 286 + mozilla/cmd/winfe/mapitest/mtest32.rc | 261 + mozilla/cmd/winfe/mapitest/nscicon.ico | Bin 0 -> 1718 bytes mozilla/cmd/winfe/mapitest/port.h | 284 + mozilla/cmd/winfe/mapitest/readmail.cpp | 118 + mozilla/cmd/winfe/mapitest/resource.h | 104 + mozilla/cmd/winfe/mkfiles32/mozilla.mak | 607 +- mozilla/cmd/winfe/mnprefs.cpp | 375 +- mozilla/cmd/winfe/mnprefs.h | 9 +- mozilla/cmd/winfe/mnrccln.cpp | 71 +- mozilla/cmd/winfe/mnrccln.h | 6 +- mozilla/cmd/winfe/mnrcdll/makefile.win | 20 + mozilla/cmd/winfe/mnrcdll/public/makefile.win | 25 + mozilla/cmd/winfe/mnrcdll/public/mndlgs.h | 30 + mozilla/cmd/winfe/mnrcdll/src/StdAfx.cpp | 23 + mozilla/cmd/winfe/mnrcdll/src/StdAfx.h | 28 + mozilla/cmd/winfe/mnrcdll/src/makefile.win | 46 + mozilla/cmd/winfe/mnrcdll/src/mnrc16.def | 25 + mozilla/cmd/winfe/mnrcdll/src/mnrc32.def | 22 + mozilla/cmd/winfe/mnrcdll/src/mnrcdll.cpp | 55 + mozilla/cmd/winfe/mnrcdll/src/mnrcdll.h | 30 + mozilla/cmd/winfe/mnrcdll/src/mnrcdll.rc | 590 ++ mozilla/cmd/winfe/mnrcdll/src/res/mnrcdll.rc2 | 30 + mozilla/cmd/winfe/mnrcdll/src/resource.h | 531 ++ mozilla/cmd/winfe/mnwizard.cpp | 165 +- mozilla/cmd/winfe/mozilla.cpp | 221 +- mozilla/cmd/winfe/mozilla.h | 38 +- mozilla/cmd/winfe/mozilla.rc | 832 +-- mozilla/cmd/winfe/msgfrm.cpp | 34 +- mozilla/cmd/winfe/msgtmpl.cpp | 4 - mozilla/cmd/winfe/msgview.cpp | 88 +- mozilla/cmd/winfe/msgview.h | 3 + mozilla/cmd/winfe/nabapi/maindll.cpp | 81 + mozilla/cmd/winfe/nabapi/nabapi.cpp | 1907 ++++++ mozilla/cmd/winfe/nabapi/nabapi32.def | 17 + mozilla/cmd/winfe/nabapi/nabapi32.mak | 485 ++ mozilla/cmd/winfe/nabapi/nabapi32.rc | 162 + mozilla/cmd/winfe/nabapi/nabipc.cpp | 230 + mozilla/cmd/winfe/nabapi/nabipc.h | 44 + mozilla/cmd/winfe/nabapi/nabmem.cpp | 69 + mozilla/cmd/winfe/nabapi/nabmem.h | 32 + mozilla/cmd/winfe/nabapi/nabutl.cpp | 412 ++ mozilla/cmd/winfe/nabapi/nabutl.h | 64 + mozilla/cmd/winfe/nabapi/port.h | 284 + mozilla/cmd/winfe/nabapi/resource.h | 35 + mozilla/cmd/winfe/nabapi/trace.cpp | 49 + mozilla/cmd/winfe/nabapi/trace.h | 62 + mozilla/cmd/winfe/nabapi/xpapi.cpp | 329 ++ mozilla/cmd/winfe/nabapi/xpapi.h | 102 + mozilla/cmd/winfe/nabtest/ldifdiag.cpp | 180 + mozilla/cmd/winfe/nabtest/main.cpp | 218 + mozilla/cmd/winfe/nabtest/nabproc.cpp | 1075 ++++ mozilla/cmd/winfe/nabtest/nabtst32.mak | 284 + mozilla/cmd/winfe/nabtest/nabtst32.rc | 232 + mozilla/cmd/winfe/nabtest/nscicon.ico | Bin 0 -> 1718 bytes mozilla/cmd/winfe/nabtest/port.h | 284 + mozilla/cmd/winfe/nabtest/resource.h | 107 + mozilla/cmd/winfe/namcomp.cpp | 752 ++- mozilla/cmd/winfe/namcomp.h | 70 +- mozilla/cmd/winfe/netsvw.h | 3 +- mozilla/cmd/winfe/nsadrlst.cpp | 1737 +++++- mozilla/cmd/winfe/nsadrlst.h | 280 +- mozilla/cmd/winfe/nsadrnam.cpp | 233 +- mozilla/cmd/winfe/nsadrnam.h | 12 +- mozilla/cmd/winfe/nsadrtyp.cpp | 19 +- mozilla/cmd/winfe/nsapp.cpp | 253 +- mozilla/cmd/winfe/nscpmapi.h | 11 +- mozilla/cmd/winfe/outliner.cpp | 40 +- mozilla/cmd/winfe/outliner.h | 20 +- mozilla/cmd/winfe/popup.cpp | 8 +- mozilla/cmd/winfe/prefinfo.cpp | 23 + mozilla/cmd/winfe/prefs.cpp | 370 +- .../cmd/winfe/prefs/brpref/src/advpages.cpp | 2 +- .../cmd/winfe/prefs/brpref/src/brpages.cpp | 148 + mozilla/cmd/winfe/prefs/brpref/src/brpref.rc | 102 +- mozilla/cmd/winfe/prefs/brpref/src/resource.h | 1 + mozilla/cmd/winfe/prefs/makefile.win | 7 +- mozilla/cmd/winfe/prefs/mnpref/makefile.win | 21 + .../winfe/prefs/mnpref/public/makefile.win | 22 + .../cmd/winfe/prefs/mnpref/public/mninterf.h | 124 + .../cmd/winfe/prefs/mnpref/public/mnprefid.h | 61 + .../cmd/winfe/prefs/mnpref/src/makefile.win | 70 + .../cmd/winfe/prefs/mnpref/src/mnpages.cpp | 1985 +++++++ mozilla/cmd/winfe/prefs/mnpref/src/mnpref.cpp | 509 ++ mozilla/cmd/winfe/prefs/mnpref/src/mnpref.h | 35 + mozilla/cmd/winfe/prefs/mnpref/src/mnpref.rc | 609 ++ .../cmd/winfe/prefs/mnpref/src/mnpref16.def | 29 + .../cmd/winfe/prefs/mnpref/src/mnpref32.def | 24 + .../cmd/winfe/prefs/mnpref/src/offpages.cpp | 254 + mozilla/cmd/winfe/prefs/mnpref/src/pages.cpp | 82 + mozilla/cmd/winfe/prefs/mnpref/src/pages.h | 391 ++ mozilla/cmd/winfe/prefs/mnpref/src/pch.h | 37 + mozilla/cmd/winfe/prefs/mnpref/src/resource.h | 258 + mozilla/cmd/winfe/res/editor.rc2 | 34 +- mozilla/cmd/winfe/res/mozilla.rc2 | 553 +- mozilla/cmd/winfe/resource.h | 136 +- mozilla/cmd/winfe/setupwiz.cpp | 36 +- mozilla/cmd/winfe/srchdlg.cpp | 915 +-- mozilla/cmd/winfe/srchdlg.h | 189 +- mozilla/cmd/winfe/srchfrm.cpp | 478 +- mozilla/cmd/winfe/srchfrm.h | 29 +- mozilla/cmd/winfe/srchobj.cpp | 41 +- mozilla/cmd/winfe/srchobj.h | 1 + mozilla/cmd/winfe/statbar.cpp | 201 +- mozilla/cmd/winfe/statbar.h | 25 +- mozilla/cmd/winfe/subnews.cpp | 226 +- mozilla/cmd/winfe/subnews.h | 38 +- mozilla/cmd/winfe/thrdfrm.cpp | 677 ++- mozilla/cmd/winfe/thrdfrm.h | 40 +- mozilla/cmd/winfe/tlbutton.h | 4 +- mozilla/cmd/winfe/toolbar.cpp | 4 +- mozilla/cmd/winfe/wfemsg.h | 45 +- mozilla/cmd/winfe/winli.cpp | 447 +- mozilla/cmd/winfe/winli.h | 43 +- mozilla/cmd/winfe/woohoo.cpp | 49 +- mozilla/cmd/xfe/Makefile | 69 +- mozilla/cmd/xfe/addrbk.c | 39 +- mozilla/cmd/xfe/addrbk.h | 58 +- mozilla/cmd/xfe/colors.c | 13 +- mozilla/cmd/xfe/commands.c | 140 + mozilla/cmd/xfe/dialogs.c | 73 +- mozilla/cmd/xfe/editor.c | 2 + mozilla/cmd/xfe/felocale.h | 7 + mozilla/cmd/xfe/forms.c | 12 +- mozilla/cmd/xfe/icons.c | 96 +- mozilla/cmd/xfe/lay.c | 8 + mozilla/cmd/xfe/make-resources | 11 + mozilla/cmd/xfe/mozilla.c | 117 +- mozilla/cmd/xfe/prefdialogs.c | 9 +- mozilla/cmd/xfe/prefs.c | 67 +- mozilla/cmd/xfe/prefs.h | 11 +- mozilla/cmd/xfe/resources | 498 +- mozilla/cmd/xfe/src/AB2PaneView.cpp | 38 +- mozilla/cmd/xfe/src/ABAddrSearchView.cpp | 420 +- mozilla/cmd/xfe/src/ABAddrSearchView.h | 33 +- mozilla/cmd/xfe/src/ABAddresseeView.h | 3 +- mozilla/cmd/xfe/src/ABAddressingDlg.cpp | 60 +- mozilla/cmd/xfe/src/ABAddressingDlg.h | 21 +- mozilla/cmd/xfe/src/ABDirGenTabView.cpp | 83 +- mozilla/cmd/xfe/src/ABDirGenTabView.h | 4 + mozilla/cmd/xfe/src/ABDirListView.cpp | 82 +- mozilla/cmd/xfe/src/ABDirListView.h | 11 +- mozilla/cmd/xfe/src/ABListSearchView.cpp | 927 ++- mozilla/cmd/xfe/src/ABListSearchView.h | 62 +- mozilla/cmd/xfe/src/ABMListDlg.cpp | 134 +- mozilla/cmd/xfe/src/ABMListDlg.h | 6 +- mozilla/cmd/xfe/src/ABMListView.cpp | 541 +- mozilla/cmd/xfe/src/ABMListView.h | 72 +- mozilla/cmd/xfe/src/ABNameCTalkTab.cpp | 4 + mozilla/cmd/xfe/src/ABNameConTab.cpp | 4 + mozilla/cmd/xfe/src/ABNameFolderDlg.cpp | 40 +- mozilla/cmd/xfe/src/ABNameGenTab.cpp | 82 +- mozilla/cmd/xfe/src/ABNameGenTab.h | 7 + mozilla/cmd/xfe/src/ABNameSecuTab.cpp | 63 +- mozilla/cmd/xfe/src/ABSearchDlg.h | 4 +- mozilla/cmd/xfe/src/ABSearchView.cpp | 13 +- mozilla/cmd/xfe/src/ABSearchView.h | 2 +- mozilla/cmd/xfe/src/AddrBookFrame.cpp | 165 +- mozilla/cmd/xfe/src/AddrBookFrame.h | 5 +- mozilla/cmd/xfe/src/AddrBookView.cpp | 358 +- mozilla/cmd/xfe/src/AddrBookView.h | 40 +- mozilla/cmd/xfe/src/AddressFolderView.cpp | 126 +- mozilla/cmd/xfe/src/AddressFolderView.h | 10 +- mozilla/cmd/xfe/src/AddressOutliner.cpp | 235 +- mozilla/cmd/xfe/src/AddressOutliner.h | 35 + mozilla/cmd/xfe/src/BookmarkView.cpp | 2 +- mozilla/cmd/xfe/src/BookmarkView.h | 2 +- mozilla/cmd/xfe/src/BrowserDrop.h | 2 +- mozilla/cmd/xfe/src/BrowserFrame.cpp | 19 +- mozilla/cmd/xfe/src/Button.h | 2 +- mozilla/cmd/xfe/src/Command.cpp | 1 + mozilla/cmd/xfe/src/Component.cpp | 40 + mozilla/cmd/xfe/src/Component.h | 22 +- mozilla/cmd/xfe/src/ComposeAddressView.cpp | 4 +- .../cmd/xfe/src/ComposeAttachFolderView.cpp | 2 +- mozilla/cmd/xfe/src/ComposeAttachFolderView.h | 6 +- mozilla/cmd/xfe/src/ComposeFrame.cpp | 143 +- mozilla/cmd/xfe/src/ComposeFrame.h | 5 +- mozilla/cmd/xfe/src/ComposeView.cpp | 45 +- mozilla/cmd/xfe/src/ComposeView.h | 3 +- mozilla/cmd/xfe/src/Dashboard.cpp | 314 +- mozilla/cmd/xfe/src/Dashboard.h | 6 + mozilla/cmd/xfe/src/DesktopTypes.h | 4 +- mozilla/cmd/xfe/src/Dialog.cpp | 16 + mozilla/cmd/xfe/src/DownloadFrame.cpp | 26 +- mozilla/cmd/xfe/src/DownloadFrame.h | 2 +- mozilla/cmd/xfe/src/DragDrop.cpp | 4 +- mozilla/cmd/xfe/src/DragDrop.h | 8 +- mozilla/cmd/xfe/src/EditorDrop.h | 2 +- mozilla/cmd/xfe/src/EditorFrame.cpp | 4 +- mozilla/cmd/xfe/src/EditorToolbar.h | 4 +- mozilla/cmd/xfe/src/EditorView.cpp | 27 +- mozilla/cmd/xfe/src/EditorView.h | 2 +- mozilla/cmd/xfe/src/FolderDropdown.cpp | 39 +- mozilla/cmd/xfe/src/FolderDropdown.h | 5 +- mozilla/cmd/xfe/src/FolderFrame.cpp | 14 +- mozilla/cmd/xfe/src/FolderView.cpp | 214 +- mozilla/cmd/xfe/src/Frame.cpp | 90 +- mozilla/cmd/xfe/src/Frame.h | 8 +- mozilla/cmd/xfe/src/HTMLDrag.h | 2 +- mozilla/cmd/xfe/src/HTMLView.cpp | 18 +- mozilla/cmd/xfe/src/IconGroup.cpp | 4 +- mozilla/cmd/xfe/src/IconGroup.h | 15 +- mozilla/cmd/xfe/src/Logo.cpp | 26 +- mozilla/cmd/xfe/src/Logo.h | 1 + mozilla/cmd/xfe/src/MNBanner.cpp | 8 + mozilla/cmd/xfe/src/MNBanner.h | 2 + mozilla/cmd/xfe/src/MNListView.cpp | 21 +- mozilla/cmd/xfe/src/MNListView.h | 9 + mozilla/cmd/xfe/src/MNView.cpp | 78 +- mozilla/cmd/xfe/src/MNView.h | 4 + mozilla/cmd/xfe/src/MailDownloadFrame.cpp | 22 +- mozilla/cmd/xfe/src/MailDownloadFrame.h | 2 +- mozilla/cmd/xfe/src/MailFilterDlg.cpp | 16 +- mozilla/cmd/xfe/src/MailFilterDlg.h | 10 +- mozilla/cmd/xfe/src/MailFilterRulesView.cpp | 30 +- mozilla/cmd/xfe/src/MailFilterView.cpp | 171 +- mozilla/cmd/xfe/src/MailFilterView.h | 10 +- mozilla/cmd/xfe/src/MailFolderPropDialog.cpp | 233 +- mozilla/cmd/xfe/src/MailFolderPropDialog.h | 20 + mozilla/cmd/xfe/src/Makefile | 44 +- mozilla/cmd/xfe/src/MozillaApp.cpp | 15 +- mozilla/cmd/xfe/src/MsgFrame.cpp | 63 +- mozilla/cmd/xfe/src/MsgFrame.h | 3 +- mozilla/cmd/xfe/src/MsgView.cpp | 90 +- mozilla/cmd/xfe/src/NewsServerPropDialog.cpp | 51 +- mozilla/cmd/xfe/src/NotificationCenter.h | 2 +- mozilla/cmd/xfe/src/OptionFolderView.cpp | 87 +- mozilla/cmd/xfe/src/OptionFolderView.h | 4 +- mozilla/cmd/xfe/src/Outliner.cpp | 31 + mozilla/cmd/xfe/src/Outliner.h | 2 + mozilla/cmd/xfe/src/PrefsData.h | 84 +- mozilla/cmd/xfe/src/PrefsDialog.cpp | 292 +- mozilla/cmd/xfe/src/PrefsDialog.h | 247 +- mozilla/cmd/xfe/src/PrefsDialogAppl.h | 3 + mozilla/cmd/xfe/src/PrefsDialogGeneral.cpp | 50 + mozilla/cmd/xfe/src/PrefsDialogMailnews.cpp | 5157 +++++++---------- mozilla/cmd/xfe/src/PropertySheetView.cpp | 4 +- mozilla/cmd/xfe/src/PropertySheetView.h | 2 +- mozilla/cmd/xfe/src/PropertyTabView.cpp | 29 + mozilla/cmd/xfe/src/PropertyTabView.h | 3 + mozilla/cmd/xfe/src/SubAllView.cpp | 337 +- mozilla/cmd/xfe/src/SubAllView.h | 16 +- mozilla/cmd/xfe/src/SubSearchView.cpp | 231 +- mozilla/cmd/xfe/src/SubSearchView.h | 6 +- mozilla/cmd/xfe/src/SubTabView.cpp | 34 +- mozilla/cmd/xfe/src/SubscribeDialog.cpp | 119 +- mozilla/cmd/xfe/src/SubscribeDialog.h | 30 +- mozilla/cmd/xfe/src/SubscribeView.cpp | 88 +- mozilla/cmd/xfe/src/SubscribeView.h | 19 +- mozilla/cmd/xfe/src/TaskBarDrop.h | 2 +- mozilla/cmd/xfe/src/ThreadFrame.cpp | 240 +- mozilla/cmd/xfe/src/ThreadFrame.h | 10 +- mozilla/cmd/xfe/src/ThreadView.cpp | 413 +- mozilla/cmd/xfe/src/ThreadView.h | 11 +- mozilla/cmd/xfe/src/ThreePaneView.cpp | 80 +- mozilla/cmd/xfe/src/Toolbar.cpp | 12 +- mozilla/cmd/xfe/src/ToolbarDrop.h | 6 +- mozilla/cmd/xfe/src/View.cpp | 22 + mozilla/cmd/xfe/src/View.h | 7 + mozilla/cmd/xfe/src/ViewDialog.cpp | 5 +- mozilla/cmd/xfe/src/ViewDialog.h | 2 - mozilla/cmd/xfe/src/ViewGlue.cpp | 29 + mozilla/cmd/xfe/src/ViewGlue.h | 5 + mozilla/cmd/xfe/src/context_funcs.cpp | 358 +- mozilla/cmd/xfe/src/pref.cpp | 7 +- mozilla/cmd/xfe/src/xfe2_extern.h | 7 +- mozilla/cmd/xfe/src/xfe_commands | 13 + mozilla/cmd/xfe/xfe.c | 67 +- mozilla/cmd/xfe/xfe.h | 22 +- mozilla/cmd/xfe/xfe_err.h | 38 + mozilla/config/IRIX.mk | 2 +- mozilla/config/config.mk | 18 + mozilla/config/liteness.mak | 32 +- mozilla/dbm/macbuild/DBM.Prefix | 4 + mozilla/include/MANIFEST | 1 + mozilla/include/abcom.h | 465 +- mozilla/include/abdefn.h | 2 + mozilla/include/allxpstr.h | 2555 ++++---- mozilla/include/allxpstr.rc | 2555 ++++---- 359 files changed, 53994 insertions(+), 13241 deletions(-) create mode 100644 mozilla/cmd/winfe/mapi/maindll.cpp create mode 100644 mozilla/cmd/winfe/mapi/mapi32.cpp create mode 100644 mozilla/cmd/winfe/mapi/mapi32.def create mode 100644 mozilla/cmd/winfe/mapi/mapi32.mak create mode 100644 mozilla/cmd/winfe/mapi/mapi32.rc create mode 100644 mozilla/cmd/winfe/mapi/mapiipc.cpp create mode 100644 mozilla/cmd/winfe/mapi/mapiipc.h create mode 100644 mozilla/cmd/winfe/mapi/mapimem.cpp create mode 100644 mozilla/cmd/winfe/mapi/mapimem.h create mode 100644 mozilla/cmd/winfe/mapi/mapiutl.cpp create mode 100644 mozilla/cmd/winfe/mapi/mapiutl.h create mode 100644 mozilla/cmd/winfe/mapi/port.h create mode 100644 mozilla/cmd/winfe/mapi/resource.h create mode 100644 mozilla/cmd/winfe/mapi/smem.cpp create mode 100644 mozilla/cmd/winfe/mapi/trace.cpp create mode 100644 mozilla/cmd/winfe/mapi/trace.h create mode 100644 mozilla/cmd/winfe/mapi/xpapi.cpp create mode 100644 mozilla/cmd/winfe/mapi/xpapi.h create mode 100644 mozilla/cmd/winfe/mapitest/main.cpp create mode 100644 mozilla/cmd/winfe/mapitest/mapimail.cpp create mode 100644 mozilla/cmd/winfe/mapitest/mapiproc.cpp create mode 100644 mozilla/cmd/winfe/mapitest/mtest32.mak create mode 100644 mozilla/cmd/winfe/mapitest/mtest32.rc create mode 100644 mozilla/cmd/winfe/mapitest/nscicon.ico create mode 100644 mozilla/cmd/winfe/mapitest/port.h create mode 100644 mozilla/cmd/winfe/mapitest/readmail.cpp create mode 100644 mozilla/cmd/winfe/mapitest/resource.h create mode 100644 mozilla/cmd/winfe/mnrcdll/makefile.win create mode 100644 mozilla/cmd/winfe/mnrcdll/public/makefile.win create mode 100644 mozilla/cmd/winfe/mnrcdll/public/mndlgs.h create mode 100644 mozilla/cmd/winfe/mnrcdll/src/StdAfx.cpp create mode 100644 mozilla/cmd/winfe/mnrcdll/src/StdAfx.h create mode 100644 mozilla/cmd/winfe/mnrcdll/src/makefile.win create mode 100644 mozilla/cmd/winfe/mnrcdll/src/mnrc16.def create mode 100644 mozilla/cmd/winfe/mnrcdll/src/mnrc32.def create mode 100644 mozilla/cmd/winfe/mnrcdll/src/mnrcdll.cpp create mode 100644 mozilla/cmd/winfe/mnrcdll/src/mnrcdll.h create mode 100644 mozilla/cmd/winfe/mnrcdll/src/mnrcdll.rc create mode 100644 mozilla/cmd/winfe/mnrcdll/src/res/mnrcdll.rc2 create mode 100644 mozilla/cmd/winfe/mnrcdll/src/resource.h create mode 100644 mozilla/cmd/winfe/nabapi/maindll.cpp create mode 100644 mozilla/cmd/winfe/nabapi/nabapi.cpp create mode 100644 mozilla/cmd/winfe/nabapi/nabapi32.def create mode 100644 mozilla/cmd/winfe/nabapi/nabapi32.mak create mode 100644 mozilla/cmd/winfe/nabapi/nabapi32.rc create mode 100644 mozilla/cmd/winfe/nabapi/nabipc.cpp create mode 100644 mozilla/cmd/winfe/nabapi/nabipc.h create mode 100644 mozilla/cmd/winfe/nabapi/nabmem.cpp create mode 100644 mozilla/cmd/winfe/nabapi/nabmem.h create mode 100644 mozilla/cmd/winfe/nabapi/nabutl.cpp create mode 100644 mozilla/cmd/winfe/nabapi/nabutl.h create mode 100644 mozilla/cmd/winfe/nabapi/port.h create mode 100644 mozilla/cmd/winfe/nabapi/resource.h create mode 100644 mozilla/cmd/winfe/nabapi/trace.cpp create mode 100644 mozilla/cmd/winfe/nabapi/trace.h create mode 100644 mozilla/cmd/winfe/nabapi/xpapi.cpp create mode 100644 mozilla/cmd/winfe/nabapi/xpapi.h create mode 100644 mozilla/cmd/winfe/nabtest/ldifdiag.cpp create mode 100644 mozilla/cmd/winfe/nabtest/main.cpp create mode 100644 mozilla/cmd/winfe/nabtest/nabproc.cpp create mode 100644 mozilla/cmd/winfe/nabtest/nabtst32.mak create mode 100644 mozilla/cmd/winfe/nabtest/nabtst32.rc create mode 100644 mozilla/cmd/winfe/nabtest/nscicon.ico create mode 100644 mozilla/cmd/winfe/nabtest/port.h create mode 100644 mozilla/cmd/winfe/nabtest/resource.h create mode 100644 mozilla/cmd/winfe/prefs/mnpref/makefile.win create mode 100644 mozilla/cmd/winfe/prefs/mnpref/public/makefile.win create mode 100644 mozilla/cmd/winfe/prefs/mnpref/public/mninterf.h create mode 100644 mozilla/cmd/winfe/prefs/mnpref/public/mnprefid.h create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/makefile.win create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/mnpages.cpp create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/mnpref.cpp create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/mnpref.h create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/mnpref.rc create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/mnpref16.def create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/mnpref32.def create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/offpages.cpp create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/pages.cpp create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/pages.h create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/pch.h create mode 100644 mozilla/cmd/winfe/prefs/mnpref/src/resource.h diff --git a/mozilla/build/mac/BuildList.pm b/mozilla/build/mac/BuildList.pm index 5afde743cf8..14b65c5f764 100644 --- a/mozilla/build/mac/BuildList.pm +++ b/mozilla/build/mac/BuildList.pm @@ -121,21 +121,34 @@ sub BuildMozilla() BuildProject(":mozilla:build:mac:CustomLib:CustomLib.mcp", "CustomStaticLib$D.o"); - if ( $main::MOZ_LITE == 0 ) + if ( $main::MOZ_MEDIUM == 1 || $main::MOZ_DARK == 1 ) + { + BuildProject(":mozilla:cmd:macfe:Composer:build:Composer.mcp", "Composer$D.o"); + + if ( $main::MOZ_DARK == 1 ) { - BuildProject(":mozilla:cmd:macfe:Composer:build:Composer.mcp", "Composer$D.o"); - - # Build the appropriate resources target - BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Moz_Resources"); + BuildProject(":mozilla:lib:libmsg:macbuild:MsgLib.mcp", "MsgLib$D.o"); + BuildProject(":mozilla:cmd:macfe:MailNews:build:MailNews.mcp", "MailNews$D.o"); + BuildProject(":mozilla:directory:c-sdk:ldap:libraries:macintosh:LDAPClient.mcp","LDAPClient$D.o"); } + else + { + BuildProject(":mozilla:cmd:macfe:projects:dummies:MakeDummies.mcp", "MsgLib$D.o"); + BuildProject(":mozilla:cmd:macfe:projects:dummies:MakeDummies.mcp", "MailNews$D.o"); + BuildProject(":mozilla:cmd:macfe:projects:dummies:MakeDummies.mcp", "LDAPClient$D.o"); + } + + # Build the appropriate resources target + BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Moz_Resources"); + } else - { - # Build a project with dummy targets to make stub libraries - BuildProject("cmd:macfe:projects:dummies:MakeDummies.mcp", "Composer$D.o"); - - # Build the appropriate resources target - BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Nav_Resources"); - } + { + # Build a project with dummy targets to make stub libraries + BuildProject("cmd:macfe:projects:dummies:MakeDummies.mcp", "Composer$D.o"); + + # Build the appropriate resources target + BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Nav_Resources"); + } BuildProject(":mozilla:cmd:macfe:projects:client:Client.mcp", "Client$D"); } diff --git a/mozilla/build/mac/BuildMozilla.pl b/mozilla/build/mac/BuildMozilla.pl index 9dc8735ef3b..27c4e3cf4af 100644 --- a/mozilla/build/mac/BuildMozilla.pl +++ b/mozilla/build/mac/BuildMozilla.pl @@ -21,7 +21,12 @@ use BuildList; $DEBUG = 0; -$MOZ_LITE = 0; # build moz medium. This will come from a config file at some stage. + + # One of them should be 1. This will come from a config file at some stage. + # In the meanwhile, it should match mozilla/config/mac/MacConfig.h +$MOZ_LITE = 0; +$MOZ_MEDIUM = 1; +$MOZ_DARK = 0; Moz::OpenErrorLog(":::Mozilla.BuildLog"); Moz::StopForErrors(); diff --git a/mozilla/build/mac/BuildMozillaDebug.pl b/mozilla/build/mac/BuildMozillaDebug.pl index 3a3134e7827..03b3a300c0c 100644 --- a/mozilla/build/mac/BuildMozillaDebug.pl +++ b/mozilla/build/mac/BuildMozillaDebug.pl @@ -21,7 +21,12 @@ use BuildList; $DEBUG = 1; -$MOZ_LITE = 0; # build moz medium. This will come from a config file at some stage. + + # One of them should be 1. This will come from a config file at some stage. + # In the meanwhile, it should match mozilla/config/mac/MacConfig.h +$MOZ_LITE = 0; +$MOZ_MEDIUM = 1; +$MOZ_DARK = 0; Moz::OpenErrorLog(":::Mozilla.BuildLog"); Moz::StopForErrors(); diff --git a/mozilla/build/mac/MacExportListPublic b/mozilla/build/mac/MacExportListPublic index b56b894d8cf..efd9f612413 100644 --- a/mozilla/build/mac/MacExportListPublic +++ b/mozilla/build/mac/MacExportListPublic @@ -23,6 +23,9 @@ # PUBLIC TREE ################### +# LDAP +mozilla:directory:c-sdk:ldap:include:MANIFEST :ldap + #INCLUDE mozilla:config:mac:export.mac :config mozilla:include:export.mac :include @@ -87,25 +90,29 @@ mozilla:modules:libfont:src:export.mac :libfont mozilla:modules:schedulr:public:export.mac :schedulr #NETWORK -mozilla:network:cache:export.mac :network -mozilla:network:client:export.mac :network -mozilla:network:cnvts:export.mac :network -mozilla:network:cstream:export.mac :network -mozilla:network:main:export.mac :network -mozilla:network:protocol:about:export.mac :network -mozilla:network:protocol:certld:export.mac :network -mozilla:network:protocol:dataurl:export.mac :network -mozilla:network:protocol:file:export.mac :network -mozilla:network:protocol:ftp:export.mac :network -mozilla:network:protocol:gopher:export.mac :network -mozilla:network:protocol:http:export.mac :network -mozilla:network:protocol:js:export.mac :network -mozilla:network:protocol:mailbox:export.mac :network -mozilla:network:protocol:marimba:export.mac :network -mozilla:network:protocol:nntp:export.mac :network -mozilla:network:protocol:pop3:export.mac :network -mozilla:network:protocol:remote:export.mac :network -mozilla:network:protocol:smtp:export.mac :network +#This stuff is all in libnet on the branch. +#mozilla:network:cache:export.mac :network +#mozilla:network:client:export.mac :network +#mozilla:network:cnvts:export.mac :network +#mozilla:network:cstream:export.mac :network +#mozilla:network:main:export.mac :network +#ozilla:network:protocol:about:export.mac :network +#mozilla:network:protocol:certld:export.mac :network +#mozilla:network:protocol:dataurl:export.mac :network +#mozilla:network:protocol:file:export.mac :network +#mozilla:network:protocol:ftp:export.mac :network +#mozilla:network:protocol:gopher:export.mac :network +#mozilla:network:protocol:http:export.mac :network +#mozilla:network:protocol:js:export.mac :network +#mozilla:network:protocol:mailbox:export.mac :network +#mozilla:network:protocol:marimba:export.mac :network +#mozilla:network:protocol:nntp:export.mac :network +#mozilla:network:protocol:pop3:export.mac :network +#mozilla:network:protocol:remote:export.mac :network +#mozilla:network:protocol:smtp:export.mac :network + +#NORMANDY_BRANCH only +mozilla:lib:libnet:export.mac :libnet #HTML_DIALOGS mozilla:lib:htmldlgs:export.mac :htmldlgs diff --git a/mozilla/cmd/winfe/abmldlg.cpp b/mozilla/cmd/winfe/abmldlg.cpp index e4d811d1fd4..e15023f2e67 100755 --- a/mozilla/cmd/winfe/abmldlg.cpp +++ b/mozilla/cmd/winfe/abmldlg.cpp @@ -19,12 +19,15 @@ // #include "stdafx.h" +#include "abmldlg.h" + +#ifdef MOZ_NEWADDR + #include "addrfrm.h" #include "template.h" #include "wfemsg.h" #include "msg_srch.h" #include "dirprefs.h" -#include "abmldlg.h" #include "compfrm.h" #include "apiaddr.h" #include "nethelp.h" // help @@ -42,6 +45,1228 @@ extern int MK_ADDR_ADD_PERSON_TO_ABOOK; extern int MK_UNABLE_TO_OPEN_ADDR_FILE; }; +#define NUM_MAILING_LIST_ATTRIBUTES 3 +#define NUM_MAILING_LIST_ENTRY_ATTRIBUTES 2 + + + +///////////////////////////////////////////////////////////////////////////// +// CAddrDialogEntryList + +class CABMLDialogEntryList: public IMsgList { + + CABMLDialog *m_pABMLDialog; + unsigned long m_ulRefCount; + +public: +// IUnknown Interface + STDMETHODIMP QueryInterface(REFIID,LPVOID *); + STDMETHODIMP_(ULONG) AddRef(void); + STDMETHODIMP_(ULONG) Release(void); + +// IMsgList Interface + virtual void ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void GetSelection( MSG_Pane* pane, MSG_ViewIndex **indices, int *count, + int *focus); + virtual void SelectItem( MSG_Pane* pane, int item ); + + virtual void CopyMessagesInto( MSG_Pane *pane, MSG_ViewIndex *indices, int count, + MSG_FolderInfo *folderInfo) {} + virtual void MoveMessagesInto( MSG_Pane *pane, MSG_ViewIndex *indices, int count, + MSG_FolderInfo *folderInfo) {} + + CABMLDialogEntryList( CABMLDialog *pAddrDialog ) { + m_ulRefCount = 0; + m_pABMLDialog = pAddrDialog; + } +}; + + +STDMETHODIMP CABMLDialogEntryList::QueryInterface(REFIID refiid, LPVOID * ppv) +{ + *ppv = NULL; + if (IsEqualIID(refiid,IID_IUnknown)) + *ppv = (LPUNKNOWN) this; + else if (IsEqualIID(refiid,IID_IMsgList)) + *ppv = (LPMSGLIST) this; + + if (*ppv != NULL) { + AddRef(); + return NOERROR; + } + + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP_(ULONG) CABMLDialogEntryList::AddRef(void) +{ + return ++m_ulRefCount; +} + +STDMETHODIMP_(ULONG) CABMLDialogEntryList::Release(void) +{ + ULONG ulRef; + ulRef = --m_ulRefCount; + if (m_ulRefCount == 0) + delete this; + return ulRef; +} + +void CABMLDialogEntryList::ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if (m_pABMLDialog) { + m_pABMLDialog->ListChangeStarting( pane, asynchronous, + notify, where, num ); + } +} + +void CABMLDialogEntryList::ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if (m_pABMLDialog) { + m_pABMLDialog->ListChangeFinished( pane, asynchronous, + notify, where, num ); + } +} + +void CABMLDialogEntryList::GetSelection( MSG_Pane* pane, MSG_ViewIndex **indices, int *count, + int *focus) +{ +} + +void CABMLDialogEntryList::SelectItem( MSG_Pane* pane, int item ) +{ +} + + + +///////////////////////////////////////////////////////////////////////////// +// CAddrDialog + +CABMLDialog::CABMLDialog(CWnd* pParent, MSG_Pane *pane, MWContext* context) + : CDialog(CABMLDialog::IDD, pParent) +{ + CString msg; + + //{{AFX_DATA_INIT(CAddrList) + m_description = _T(""); + m_name = _T(""); + m_nickname = _T(""); + //}}AFX_DATA_INIT + + m_addingEntries = FALSE; + m_saved = TRUE; + m_errorCode = 0; + m_pFont = NULL; + m_pDropTarget = NULL; + m_pPane = pane; + + CABMLDialogEntryList *pInstance = new CABMLDialogEntryList( this ); + pInstance->QueryInterface( IID_IMsgList, (LPVOID *) &m_pIAddrList ); + + HandleErrorReturn(AB_InitializeMailingListPaneAB2(pane)); + + ApiApiPtr(api); + m_pUnkAddress = api->CreateClassInstance( + APICLASS_ADDRESSCONTROL,NULL); + m_pUnkAddress->QueryInterface(IID_IAddressControl,(LPVOID*)&m_pIAddressList); + m_pIAddressList->SetContext(context); + m_pIAddressList->SetControlParent(this); + + // these next three refer to flags around events that + // we receive from m_pIAddressList. + m_changingEntry = FALSE; + m_addingEntry = FALSE; + m_deletingEntry =FALSE; + + //{{AFX_DATA_INIT(CAddrDialog) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + +CABMLDialog::~CABMLDialog ( ) +{ + if(m_pDropTarget) { + m_pDropTarget->Revoke(); + delete m_pDropTarget; + m_pDropTarget = NULL; + } +} + +void CABMLDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAddrList) + DDX_Text(pDX, IDC_Description, m_description); + DDX_Text(pDX, IDC_NAME, m_name); + DDX_Text(pDX, IDC_NICKNAME, m_nickname); + //}}AFX_DATA_MAP +} + + +void CABMLDialog::PostNcDestroy() +{ + delete this; + +} // END OF FUNCTION CABMLDialog::PostNcDestroy() + + +void CABMLDialog::OnDestroy( ) +{ + CleanupOnClose(); + if (m_pFont) + theApp.ReleaseAppFont(m_pFont); +} + + +void CABMLDialog::CleanupOnClose() +{ + if (m_pIAddrList) + m_pIAddrList->Release(); + + HandleErrorReturn(AB_ClosePane(m_pPane)); + + m_pUnkAddress->Release(); +} + +void CABMLDialog::OnHelp() +{ + if (m_entryID == MSG_MESSAGEIDNONE) + NetHelp(HELP_ADD_LIST_MAILING_LIST); + else + NetHelp(HELP_MAIL_LIST_PROPS); +} + +void CABMLDialog::OnUpdateOnlineStatus(CCmdUI *pCmdUI) +{ + pCmdUI->Enable(!NET_IsOffline()); +} + +///////////////////////////////////////////////////////////////////////////// +// CABMLDialog Overloaded methods +///////////////////////////////////////////////////////////////////////////// +BOOL CABMLDialog::OnInitDialog( ) +{ + if (CDialog::OnInitDialog()) { + CWnd* widget; + CRect rect2, rect3; + + HDC hDC = ::GetDC(m_hWnd); + LOGFONT lf; + memset(&lf,0,sizeof(LOGFONT)); + + MWContext * context = FE_GetAddressBookContext (m_pPane, FALSE); + + lf.lfPitchAndFamily = FF_SWISS; + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = IntlGetLfCharset(CIntlWin::GetSystemLocaleCsid()); + if (CIntlWin::GetSystemLocaleCsid() == CS_LATIN1) + _tcscpy(lf.lfFaceName, "MS Sans Serif"); + else + _tcscpy(lf.lfFaceName, IntlGetUIPropFaceName(CIntlWin::GetSystemLocaleCsid())); + lf.lfHeight = -MulDiv(9, ::GetDeviceCaps(hDC, LOGPIXELSY), 72); + m_pFont = theApp.CreateAppFont( lf ); + ::SendMessage(::GetDlgItem(m_hWnd, IDC_NAME), WM_SETFONT, (WPARAM)m_pFont, FALSE); + ::SendMessage(::GetDlgItem(m_hWnd, IDC_NICKNAME), WM_SETFONT, (WPARAM)m_pFont, FALSE); + ::SendMessage(::GetDlgItem(m_hWnd, IDC_Description), WM_SETFONT, (WPARAM)m_pFont, FALSE); + ::ReleaseDC(m_hWnd,hDC); + + MSG_SetFEData( m_pPane, (void *) m_pIAddrList ); + + widget = GetDlgItem(IDC_ENTRIES); + widget->GetWindowRect(&rect2); + widget->GetClientRect(&rect3); + ScreenToClient(rect2); + + widget->DestroyWindow (); + + CRect rect(0,0,0,0); + m_pIAddressList->Create(this,IDC_ADDRESSLIST); + m_pIAddressList->AddAddressType(NULL); + m_pIAddressList->SetDefaultBitmapId (IDB_PERSON); + + CListBox * pWnd = m_pIAddressList->GetListBox(); + pWnd->Invalidate(); + pWnd->MoveWindow(rect2.left, rect2.top, rect3.right, rect3.bottom, TRUE); + m_pIAddressList->SetCSID(CIntlWin::GetSystemLocaleCsid()); + + CPaintDC dc ( pWnd ); + + pWnd->GetWindowRect(rect); + ScreenToClient(rect); + rect.InflateRect(4,4); + WFE_DrawRaisedRect(dc.GetSafeHdc(),rect); + + widget = GetDlgItem(IDC_StatusRect); + widget->GetWindowRect(&rect2); + widget->GetClientRect(&rect3); + ScreenToClient(&rect2); + + CRect windowRect, statusRect; + GetClientRect(&windowRect); + + statusRect.SetRect(0, windowRect.Height() - rect2.Height(), + windowRect.Width(), windowRect.Height()); + + widget->DestroyWindow (); + + // create the status bar + UINT aIDArray[] = { IDS_TRANSFER_STATUS, ID_SEPARATOR, IDS_ONLINE_STATUS}; + + m_barStatus.Create(this, FALSE, FALSE); + m_barStatus.MoveWindow(&statusRect, TRUE); + m_barStatus.SetIndicators( aIDArray, sizeof(aIDArray) / sizeof(UINT) ); + + //set initial online status + int idx = m_barStatus.CommandToIndex(IDS_ONLINE_STATUS); + if (idx > -1) + { + UINT nID = IDS_ONLINE_STATUS; + UINT nStyle; + int nWidth; + m_barStatus.GetPaneInfo( idx, nID, nStyle, nWidth ); + if (!NET_IsOffline()) + m_barStatus.SetPaneInfo(idx, IDS_ONLINE_STATUS, SBPS_NORMAL, nWidth); + else + m_barStatus.SetPaneInfo(idx, IDS_ONLINE_STATUS, SBPS_DISABLED, nWidth); + } + + //move separator over status bar + widget = GetDlgItem(IDC_STATUSSEPARATOR); + widget->GetWindowRect(&rect2); + widget->MoveWindow(0, statusRect.top - rect2.Height(), + windowRect.Width(), rect2.Height(), TRUE); + AddEntriesToList (-1, -1); + m_addingEntries = FALSE; + + AB_AttributeValue * values; + AB_AttribID *attribs = new AB_AttribID[NUM_MAILING_LIST_ATTRIBUTES]; + + uint16 numAttributes = NUM_MAILING_LIST_ATTRIBUTES; + + attribs[0] = AB_attribFullName; + attribs[1] = AB_attribNickName; + attribs[2] = AB_attribInfo; + + AB_GetMailingListAttributes(m_pPane, attribs, &values, &numAttributes); + + for(int i = 0; i < numAttributes; i++) + { + switch(values[i].attrib) + { + case AB_attribFullName: m_name = XP_STRDUP(values[i].u.string); + break; + case AB_attribNickName: m_nickname = XP_STRDUP(values[i].u.string); + break; + case AB_attribInfo: m_description = XP_STRDUP(values[i].u.string); + break; + } + } + + delete attribs; + + AB_FreeEntryAttributeValues(values, numAttributes); + + UpdateData(FALSE); + + if(!m_pDropTarget) { + m_pDropTarget = new CMailListDropTarget(this); + m_pDropTarget->Register(this); + } + DragAcceptFiles(); + + } else { + return FALSE; + } + + return TRUE; +} + + +///////////////////////////////////////////////////////////////////////////// +// CAddrDialog message handlers + +BEGIN_MESSAGE_MAP(CABMLDialog, CDialog) + //{{AFX_MSG_MAP(CABMLDialog) + ON_BN_CLICKED( IDOK, OnOK) + ON_BN_CLICKED( IDCANCEL, OnCancel) + ON_BN_CLICKED( IDC_REMOVEITEM, OnRemoveEntry) + ON_BN_CLICKED( ID_HELP, OnHelp) + ON_UPDATE_COMMAND_UI(IDS_ONLINE_STATUS, OnUpdateOnlineStatus) + ON_WM_CREATE() + ON_WM_DESTROY() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +BOOL CABMLDialog::Create( LPCTSTR lpszTemplateName, CWnd* pParentWnd) +{ + BOOL ret = FALSE; + if (m_MailNewsResourceSwitcher.Initialize ()) { + CDialog::Create (lpszTemplateName, pParentWnd); + ret = TRUE; + } + return ret; +} + +BOOL CABMLDialog::Create( UINT nIDTemplate, CWnd* pParentWnd) +{ + BOOL ret = FALSE; + if (m_MailNewsResourceSwitcher.Initialize ()) { + CDialog::Create (nIDTemplate, pParentWnd); + ret = TRUE; + } + return ret; +} + +BOOL CABMLDialog::Create( CWnd *pParentWnd ) +{ + BOOL ret = FALSE; + if (m_MailNewsResourceSwitcher.Initialize ()) { + CDialog::Create (IDD, pParentWnd); + ret = TRUE; + } + return ret; + +} + + +int CABMLDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + m_MailNewsResourceSwitcher.Reset(); + int res = CDialog::OnCreate(lpCreateStruct); + + MSG_SetFEData( (MSG_Pane*) m_pPane, (void *) m_pIAddrList ); + return res; +} + + +BOOL CABMLDialog::PreTranslateMessage( MSG* pMsg ) +{ + if (pMsg->message == WM_KEYDOWN) + { + if (pMsg->wParam == VK_TAB) + { + BOOL bControl = GetKeyState(VK_CONTROL) & 0x8000; + BOOL bShift = GetKeyState(VK_SHIFT) & 0x8000; + CWnd* hwndNext = NULL; + + CWnd* hwndFocus = GetFocus(); + + CWnd* hwndDescription = GetDlgItem( IDC_Description ); + CWnd* hwndEntries = m_pIAddressList->GetListBox(); + CEdit* hwndEntriesEdit = m_pIAddressList->GetAddressNameField(); + CWnd* hwndOK = GetDlgItem( IDOK ); + + if ( bShift ) { + // Tab backward + if ( hwndFocus == hwndEntries || hwndFocus == hwndEntriesEdit ) { + // Tab backward into description + hwndNext = hwndDescription; + if (IsWindow(hwndEntriesEdit->m_hWnd)) { + hwndEntriesEdit->ShowWindow(SW_HIDE); + } + } else if (hwndFocus == hwndOK) { + // Tab into list + hwndNext = hwndEntries; + } + } else { + // Tab forward + if (hwndFocus == hwndDescription) { + // Handle tabbing into list + hwndNext = hwndEntries; + } else if ( hwndFocus == hwndEntries || hwndFocus == hwndEntriesEdit ) { + if (IsWindow(hwndEntriesEdit->m_hWnd)) { + hwndEntriesEdit->ShowWindow(SW_HIDE); + } + hwndNext = hwndOK; + } + } + if ( hwndNext ) { + hwndNext->SetFocus(); + return TRUE; + } + } + } + return CDialog::PreTranslateMessage(pMsg); +} + +void CABMLDialog::OnOK() +{ + + MWContext * context = FE_GetAddressBookContext (m_pPane, FALSE); + INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(context); + + UpdateData(); + + AB_AttributeValue *values = new AB_AttributeValue[NUM_MAILING_LIST_ATTRIBUTES + 1]; + + values[0].attrib = AB_attribFullName; + values[0].u.string = XP_STRDUP(m_name.GetBuffer(0)); + + values[1].attrib = AB_attribNickName; + values[1].u.string = XP_STRDUP(m_nickname.GetBuffer(0)); + + values[2].attrib = AB_attribInfo; + values[2].u.string = XP_STRDUP(m_description.GetBuffer(0)); + + values[3].attrib = AB_attribWinCSID; + values[3].u.shortValue = INTL_GetCSIWinCSID(csi); + + AB_SetMailingListAttributes(m_pPane, values, NUM_MAILING_LIST_ATTRIBUTES + 1); + + for(int attribNum = 0; attribNum < NUM_MAILING_LIST_ATTRIBUTES + 1; attribNum++) + { + + if(AB_IsStringEntryAttributeValue(&values[attribNum])) + { + XP_FREE(values[attribNum].u.string); + } + } + + delete values; + + + //Remove all empty strings since we add them whenever inserting a + // new item + char *szType = NULL , *szName = NULL; + UINT idBitmap; + unsigned long idEntry; + + CListBox * pListBox = m_pIAddressList->GetListBox(); + int count = pListBox->GetCount(); + + for(int k = count - 1; k >= 0; k--) + { + if(m_pIAddressList->GetEntry( k,&szType, &szName, &idBitmap, &idEntry)) + { + if(szName && strlen(szName) == 0) + { + AB_CommandAB2(m_pPane, AB_DeleteCmd, (MSG_ViewIndex*)&k , 1); + } + + } + } + + // since we've accepted all additions then commit the changes. + //ensure that no list changes get through as well. + m_changingEntry = TRUE; + AB_CommitChanges(m_pPane); + m_changingEntry = FALSE; + CDialog::OnOK(); + DestroyWindow(); +} + +void CABMLDialog::OnCancel() +{ + CDialog::OnCancel(); + DestroyWindow(); +} + +void CABMLDialog::AddEntriesToList(int index, int num) +{ + uint32 count = 0; + ABID entryID; + AB_EntryType type = AB_Person; + DIR_Server* pab = NULL; + CListBox * pWnd = m_pIAddressList->GetListBox(); + +// if (m_changingEntry) +// return; + + + if (m_pPane) + { + count = MSG_GetNumLines(m_pPane); + + if (count) { + m_addingEntries = TRUE; + //if m_addingEntry is TRUE, this means that m_pIAddressList has already added + //an Entry so we don't need to add it again. + if(!m_addingEntry && !m_changingEntry) + { + if (index != -1) + { + count = index + num; + for (int i = index; i < count; i++) + { + // add the entry to the list + m_pIAddressList->InsertEntry(i, FALSE, "", "", IDB_PERSON, 0); + } + } + else + { + pWnd->ResetContent(); + index = 0; + for (int i = 0; i < count; i++) + { + // add the entry to the list + m_pIAddressList->AppendEntry(FALSE, "", "", IDB_PERSON, 0); + } + } + } + + uint16 numAttributes; + + AB_AttribID attribs[NUM_MAILING_LIST_ENTRY_ATTRIBUTES] = {AB_attribEntryType, AB_attribFullAddress}; + + AB_AttributeValue *values; + + for (int j = index; j < count; j++) + { + + char *fullname = NULL; + + numAttributes = NUM_MAILING_LIST_ENTRY_ATTRIBUTES; + HandleErrorReturn(AB_GetMailingListEntryAttributes(m_pPane, j, attribs, &values, + &numAttributes)); + + for(int k = 0; k < numAttributes; k++) + { + switch(values[k].attrib) + { + case AB_attribEntryType: type = values[k].u.entryType; + break; + case AB_attribFullAddress: fullname = XP_STRDUP(values[k].u.string); + break; + } + + } + + if(numAttributes > 0) + { + AB_FreeEntryAttributeValues(values, numAttributes); + } + + // add the entry to the list + m_pIAddressList->SetEntry(j, + "",fullname,type==AB_MailingList?IDB_MAILINGLIST:IDB_PERSON,entryID); + XP_FREEIF (fullname); + + } + m_addingEntries = FALSE; + } + else { + m_pIAddressList->AppendEntry(); + } + } + else { + // add the entry to the list + m_pIAddressList->AppendEntry(); + } + + pWnd->Invalidate(); + pWnd->UpdateWindow(); +} + +#ifdef XP_WIN16 + #define LPNMHDR NMHDR* +#endif + +void CABMLDialog::OnRemoveEntry(void) +{ + ASSERT(m_pIAddressList); + CListBox * pListBox = m_pIAddressList->GetListBox(); + if (pListBox->GetCount()) + { + CListBox * pWnd = m_pIAddressList->GetListBox(); + + if(pListBox->GetCount() == 1) + { + m_pIAddressList->RemoveSelection(); + } + else + { + m_pIAddressList->RemoveSelection(); + } + } +} + +void CABMLDialog::ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if ( pane == m_pPane ) { + ++m_iMysticPlane; + } +} + + +void CABMLDialog::ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + ABID entryID = MSG_MESSAGEIDNONE; + if ( pane == m_pPane ) { + switch ( notify ) { + case MSG_NotifyNone: + break; + + case MSG_NotifyInsertOrDelete: + // this could happen from someone deleting one of the members from the + // address book or an undo action adding a member back in + { + if (num > 0) + AddEntriesToList(CASTINT(where), CASTINT(num)); + else + AddEntriesToList(-1, -1); + } + break; + + case MSG_NotifyChanged: + { + uint16 numAttributes = NUM_MAILING_LIST_ENTRY_ATTRIBUTES; + + AB_AttribID attribs[NUM_MAILING_LIST_ENTRY_ATTRIBUTES] = {AB_attribEntryType, AB_attribFullName}; + + AB_AttributeValue *values; + + char *fullname = NULL; + AB_EntryType type = AB_Person; + if (m_pPane) + { + HandleErrorReturn(AB_GetMailingListEntryAttributes(m_pPane, where, attribs, &values, + &numAttributes)); + + for(int k = 0; k < numAttributes; k++) + { + switch(values[k].attrib) + { + case AB_attribEntryType: type = values[k].u.entryType; + break; + case AB_attribFullName: fullname = values[k].u.string; + break; + } + + } + + m_pIAddressList->SetItemBitmap(CASTINT(where), type==AB_MailingList?IDB_MAILINGLIST:IDB_PERSON); + m_pIAddressList->SetItemEntryID(CASTINT(where), entryID); + m_pIAddressList->SetItemName(CASTINT(where), fullname); + XP_FREEIF (fullname); + } + } + break; + + case MSG_NotifyAll: + case MSG_NotifyScramble: + AddEntriesToList(-1, -1); + break; + } + + if (( !--m_iMysticPlane && m_addrBookPane)) { + CListBox * pWnd = m_pIAddressList->GetListBox(); + pWnd->Invalidate(); + pWnd->UpdateWindow(); + } + } +} + + +void CABMLDialog::HandleErrorReturn(int errorid, CWnd* parent) +{ + if (errorid) { + CString s; + HWND parentWnd = NULL; + if (parent) + parentWnd = parent->m_hWnd; + if (s.LoadString( IDS_BOOKMARK_ADDRESSPROPERTIES )) + ::MessageBox(parentWnd, XP_GetString(errorid), s, MB_OK | MB_APPLMODAL); + } +} + + +// IAddressParent stuff +// these functions are in compbar.cpp, they should be prototyped +// in some header file and placed somewhere more appropriate + +extern "C" char * wfe_ExpandForNameCompletion(char * pString); +extern "C" char * wfe_ExpandName(char * pString, unsigned long* entryID, UINT* bitmapID); + +int CABMLDialog::ChangedItem (char * pString, int index, HWND hwnd, char ** ppFullName, unsigned long* entryID, UINT* bitmapID) +{ + if (!m_addingEntries) { + ABID type, field, tempID = MSG_MESSAGEIDNONE; + char* fullname = NULL; + m_saved = FALSE; + + + m_changingEntry = TRUE; + AB_NameCompletionCookie *pCookie = NULL; + int nNumResults = -1; + + m_pIAddressList->GetNameCompletionCookieInfo(&pCookie, &nNumResults, index); + if(pCookie && nNumResults == 1) + { + AB_AddNCEntryToMailingList(m_pPane, index, pCookie, TRUE); + } + else + { + char *szType; + char *szName; + UINT idBitmap; + unsigned long idEntry; + + if(m_pIAddressList->GetEntry( index, &szType, &szName, &idBitmap, &idEntry)) + { + AB_AddNakedEntryToMailingList(m_pPane, index, szName, TRUE); + + } + + + + } + + // (*bitmapID) = IDB_PERSON; + m_changingEntry = FALSE; + } + return 0; +} + +void CABMLDialog::DeletedItem (HWND hwnd, LONG id, int index) +{ + AB_CommandAB2(m_pPane, AB_DeleteCmd, (MSG_ViewIndex*)&index , 1); +// PrintItems("DeletedItem"); + +} + +void CABMLDialog::AddedItem (HWND hwnd, LONG id, int index) +{ + m_addingEntry = TRUE; + AB_NameCompletionCookie *pCookie = NULL; + int nNumResults = -1; + + m_pIAddressList->GetNameCompletionCookieInfo(&pCookie, &nNumResults, index); + if(pCookie && nNumResults == 1) + { + AB_AddNCEntryToMailingList(m_pPane, index, pCookie, FALSE); + } + else + { + char *szType; + char *szName; + UINT idBitmap; + unsigned long idEntry; + + if(m_pIAddressList->GetEntry( index, &szType, &szName, &idBitmap, &idEntry)) + { + AB_AddNakedEntryToMailingList(m_pPane, index, szName, FALSE); + + } + + + + } + m_addingEntry = FALSE; + +// AB_CommandAB2(m_pPane, AB_InsertLineCmd, (MSG_ViewIndex*)&index , 1); +// PrintItems("AddedItem"); + +} + +void CABMLDialog::PrintItems(LPSTR comment) +{ + int count = MSG_GetNumLines(m_pPane); + + uint16 numAttributes; + + AB_AttribID attribs[NUM_MAILING_LIST_ENTRY_ATTRIBUTES] = {AB_attribEntryType, AB_attribFullName}; + + AB_AttributeValue *values; + + for (int j = 0; j < count; j++) + { + + char *fullname = NULL; + + numAttributes = NUM_MAILING_LIST_ENTRY_ATTRIBUTES; + HandleErrorReturn(AB_GetMailingListEntryAttributes(m_pPane, j, attribs, &values, + &numAttributes)); + + BOOL hasFullName = FALSE; + for(int k = 0; k < numAttributes; k++) + { + switch(values[k].attrib) + { + case AB_attribEntryType: //type = values[k].u.entryType; + break; + case AB_attribFullName: if(fullname != NULL) + { + fullname = XP_STRDUP(values[k].u.string); + } + else + { + fullname = XP_STRDUP(""); + } + TRACE("%s %d %s\n", comment, j, fullname); + hasFullName = TRUE; + break; + } + + } + if(!hasFullName) + { + TRACE("%s %d \n", comment, j); + } + + if(numAttributes > 0) + { + AB_FreeEntryAttributeValues(values, numAttributes); + } + XP_FREEIF(fullname); + } + + + +} + +char * CABMLDialog::NameCompletion(char * pString) +{ + ABID entryID = -1; + ABID field = -1; + DIR_Server* pab = NULL; + + DIR_GetPersonalAddressBook (theApp.m_directories, &pab); + if (pab != NULL && theApp.m_pABook) + { + AB_GetIDForNameCompletion( + theApp.m_pABook, + pab, + &entryID,&field,(LPCTSTR)pString); + if (entryID != -1) + { + if (field == ABNickname) { + char szNickname[kMaxNameLength]; + AB_GetNickname( + pab, + theApp.m_pABook, entryID, szNickname); + if (strlen(szNickname)) + return strdup(szNickname); + } + else { + char szFullname[kMaxFullNameLength]; + AB_GetFullName(pab, theApp.m_pABook, + entryID, szFullname); + if (strlen(szFullname)) + return strdup(szFullname); + } + } + } + + return NULL; +} + +void CABMLDialog::StartNameCompletionSearch() +{ + m_barStatus.StartAnimation(); + +} + +void CABMLDialog::StopNameCompletionSearch() +{ + m_barStatus.StopAnimation(); + +} + +void CABMLDialog::SetProgressBarPercent(int32 lPercent) +{ + m_barStatus.SetPercentDone (lPercent); + +} + +void CABMLDialog::SetStatusText(const char* pMessage) +{ + m_barStatus.SetWindowText( pMessage ); +} + +CWnd *CABMLDialog::GetOwnerWindow() +{ + return this; +} + +BOOL CABMLDialog::IsDragInListBox(CPoint *pPoint) +{ + CRect listRect; + + CListBox * pListBox = m_pIAddressList->GetListBox(); + pListBox->GetWindowRect(LPRECT(listRect)); + ScreenToClient(LPRECT(listRect)); + if (listRect.PtInRect(*pPoint)) + return TRUE; + else + return FALSE; +} + +DROPEFFECT CABMLDialog::GetAddressBookIndexFormatDropEffect(COleDataObject *pDataObject) +{ + DROPEFFECT res = DROPEFFECT_NONE; + HGLOBAL hContent; + + + AB_ContainerInfo *pContInfo = AB_GetContainerForMailingList(m_pPane); + hContent = pDataObject->GetGlobalData ( ::RegisterClipboardFormat(ADDRESSBOOK_INDEX_FORMAT)); + + AddressBookDragData *pDragData = (AddressBookDragData *) GlobalLock(hContent); + + AB_DragEffect requireEffect = AB_Require_Copy; + if ((GetKeyState(VK_SHIFT) & 0x8000) && (GetKeyState(VK_CONTROL) & 0x8000)) + requireEffect = AB_Require_Copy; + else if (GetKeyState(VK_SHIFT) & 0x8000) + requireEffect = AB_Require_Move; + else if (GetKeyState(VK_CONTROL) & 0x8000) + requireEffect = AB_Require_Copy; + + AB_DragEffect effect = AB_DragEntriesIntoContainerStatus ( + pDragData->m_pane, pDragData->m_indices, pDragData->m_count, + pContInfo, + requireEffect); /* do you want to do a move? a copy? default drag? */ + + if (effect == AB_Require_Copy) + res = DROPEFFECT_COPY; + else if (effect == AB_Require_Move) + res = DROPEFFECT_MOVE; + else + res = DROPEFFECT_NONE; + + GlobalUnlock (hContent); //do we have to GlobalFree it too? + + return res; + +} + +BOOL CABMLDialog::ProcessAddressBookIndexFormat(COleDataObject *pDataObject, DROPEFFECT effect) +{ + HGLOBAL hContent; + + if(!pDataObject) + return FALSE; + + AB_ContainerInfo *pContInfo = AB_GetContainerForMailingList(m_pPane); + + if (pDataObject->IsDataAvailable( ::RegisterClipboardFormat(ADDRESSBOOK_INDEX_FORMAT) )) + hContent = pDataObject->GetGlobalData (::RegisterClipboardFormat(ADDRESSBOOK_INDEX_FORMAT)); +// else +// hContent = pDataObject->GetGlobalData (m_cfAddrIndexes); + AddressBookDragData *pDragData = (AddressBookDragData *) GlobalLock(hContent); + + AB_DragEffect requireEffect = AB_Require_Copy; + if (effect & DROPEFFECT_MOVE) + requireEffect = AB_Require_Move; + else if (effect & DROPEFFECT_COPY) + requireEffect = AB_Require_Copy; + + // call new drag drop calls that handle indexes + AB_DragEntriesIntoContainer( pDragData->m_pane, pDragData->m_indices, pDragData->m_count, + pContInfo, requireEffect); /* copy or move? */ + + return TRUE; +} + + +BOOL CABMLDialog::ProcessVCardData(COleDataObject * pDataObject, CPoint &point) +{ + UINT clipFormat, fromABFormat; + BOOL retVal; + CWnd * pWnd = GetFocus(); + ABID tempID = MSG_MESSAGEIDNONE; + HGLOBAL hEntryIDs = NULL; + LPSTR pEntryIDs = NULL; + + if (pDataObject->IsDataAvailable( + clipFormat = ::RegisterClipboardFormat(vCardClipboardFormat))) + { + if (pDataObject->IsDataAvailable( + fromABFormat = ::RegisterClipboardFormat(ADDRESSBOOK_SOURCETARGET_FORMAT))) + { + hEntryIDs = pDataObject->GetGlobalData(fromABFormat); + pEntryIDs = (LPSTR)GlobalLock(hEntryIDs); + ASSERT(pEntryIDs); + } + HGLOBAL hAddresses = pDataObject->GetGlobalData(clipFormat); + LPSTR pAddresses = (LPSTR)GlobalLock(hAddresses); + ASSERT(pAddresses); + XP_List * pEntries; + int32 iEntries; + + if (m_pIAddressList) + { + int itemNum = 0; + char * szType = NULL; + char * szName = NULL; + char * pszType = NULL; + CListBox * pListBox = m_pIAddressList->GetListBox(); + if (!AB_ConvertVCardsToExpandedName(theApp.m_pABook,pAddresses,&pEntries,&iEntries)) + { + XP_List * node = pEntries; + char *pTemp = NULL; + + if (pEntryIDs) //from Address Book + pTemp = pEntryIDs; + + for (int32 i = 0; i < iEntries+1; i++) + { + char * pString = (char *)node->object; + if (pString != NULL) + { + m_changingEntry = TRUE; + int nIndex = pListBox->GetCount() - 1; + if (pEntryIDs) //from Address Book + { + char szEntryID[20]; + ABID entryID; + ABID type; + char *fullname = NULL; + DIR_Server* pab = NULL; + + szEntryID[0] = '\0'; + int nPos = 0; + while (pTemp[nPos] != '\0') + { + if (pTemp[nPos] == '-') + { + strncpy(szEntryID, pTemp, nPos); + szEntryID[nPos] = '\0'; + pTemp = pTemp + nPos + 1; + break; + } + else + nPos++; + } + entryID = atol(szEntryID); + + DIR_GetPersonalAddressBook (theApp.m_directories, &pab); + m_errorCode = AB_AddIDToMailingListAt(m_addrBookPane, entryID, nIndex); + // need to change the bitmap based on the type + HandleErrorReturn (AB_GetType (pab, theApp.m_pABook, entryID, &type)); + // if the entry is null, use a null terminated string + HandleErrorReturn (AB_GetExpandedName (pab, + theApp.m_pABook, entryID, &fullname)); + m_pIAddressList->SetEntry(nIndex, "", fullname, type==ABTypeList?IDB_MAILINGLIST:IDB_PERSON, 0); + m_pIAddressList->AppendEntry(FALSE); + XP_FREEIF (fullname); + } + else + { + char* names = NULL; + char* addresses = NULL; + int num = 0; + + num = MSG_ParseRFC822Addresses(pString, &names, &addresses); + + if (num > 0) + { + XP_ASSERT(names); + XP_ASSERT(addresses); + + PersonEntry person; + person.Initialize(); + person.pGivenName = names; + person.pEmailAddress = addresses; + MWContext * context = FE_GetAddressBookContext ((MSG_Pane *) m_addrBookPane, FALSE); + INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(context); + person.WinCSID = INTL_GetCSIWinCSID(csi); + m_errorCode = AB_AddPersonToMailingListAt(m_addrBookPane, &person, nIndex, &tempID); + m_pIAddressList->InsertEntry(nIndex, FALSE, "", pString, IDB_PERSON, 0); + m_pIAddressList->AppendEntry(FALSE, "", "", IDB_PERSON); + + XP_FREEIF(names); + XP_FREEIF(addresses); + } + } + } + node = node->next; + if (!node) + break; + } + XP_ListDestroy(pEntries); + } + if (hEntryIDs) + GlobalUnlock(hEntryIDs); + GlobalUnlock(hAddresses); + retVal = TRUE; + m_changingEntry = FALSE; + } + } + if (pWnd && ::IsWindow(pWnd->m_hWnd)) + pWnd->SetFocus(); + return retVal; +} + +////////////////////////////////////////////////////////////////////////////// +// CMailListDropTarget + +DROPEFFECT CMailListDropTarget::OnDragOver(CWnd * pWnd, + COleDataObject * pDataObject, DWORD dwKeyState, CPoint point) +{ + DROPEFFECT deReturn = DROPEFFECT_NONE; + if(pDataObject->IsDataAvailable(::RegisterClipboardFormat(ADDRESSBOOK_INDEX_FORMAT))) + { + if(m_pOwner->IsDragInListBox(&point)) + { + return m_pOwner->GetAddressBookIndexFormatDropEffect(pDataObject); + } + + } + + if(pDataObject->IsDataAvailable( + ::RegisterClipboardFormat(vCardClipboardFormat))) + { + if (m_pOwner->IsDragInListBox(&point)) + deReturn = DROPEFFECT_COPY; + } + return(deReturn); +} + +BOOL CMailListDropTarget::OnDrop +(CWnd * pWnd, COleDataObject * pDataObject, DROPEFFECT effect, CPoint point) +{ + if(pDataObject->IsDataAvailable(::RegisterClipboardFormat(ADDRESSBOOK_INDEX_FORMAT))) + { + return m_pOwner->ProcessAddressBookIndexFormat(pDataObject, effect); + } + + if (pDataObject->IsDataAvailable(::RegisterClipboardFormat(vCardClipboardFormat)) ) + { + return m_pOwner->ProcessVCardData(pDataObject,point); + } + return FALSE; +} + + + + +#else // MOZ_NEWADDR + +#include "addrfrm.h" +#include "template.h" +#include "wfemsg.h" +#include "msg_srch.h" +#include "dirprefs.h" +#include "compfrm.h" +#include "apiaddr.h" +#include "nethelp.h" // help +#include "xp_help.h" +#include "intl_csi.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char BASED_CODE THIS_FILE[] = __FILE__; +#endif + +extern "C" { +#include "xpgetstr.h" +extern int MK_ADDR_ADD_PERSON_TO_ABOOK; +extern int MK_UNABLE_TO_OPEN_ADDR_FILE; +}; + + ///////////////////////////////////////////////////////////////////////////// // CAddrDialogEntryList @@ -179,6 +1404,7 @@ CABMLDialog::CABMLDialog(DIR_Server* dir, CWnd* pParent, APICLASS_ADDRESSCONTROL,NULL); m_pUnkAddress->QueryInterface(IID_IAddressControl,(LPVOID*)&m_pIAddressList); m_pIAddressList->SetControlParent(this); + m_pIAddressList->SetContext(context); //{{AFX_DATA_INIT(CAddrDialog) // NOTE: the ClassWizard will add member initialization here @@ -333,6 +1559,36 @@ BEGIN_MESSAGE_MAP(CABMLDialog, CDialog) //}}AFX_MSG_MAP END_MESSAGE_MAP() +BOOL CABMLDialog::Create( LPCTSTR lpszTemplateName, CWnd* pParentWnd) +{ + BOOL ret = FALSE; + if (m_MailNewsResourceSwitcher.Initialize ()) { + CDialog::Create (lpszTemplateName, pParentWnd); + ret = TRUE; + } + return ret; +} + +BOOL CABMLDialog::Create( UINT nIDTemplate, CWnd* pParentWnd) +{ + BOOL ret = FALSE; + if (m_MailNewsResourceSwitcher.Initialize ()) { + CDialog::Create (nIDTemplate, pParentWnd); + ret = TRUE; + } + return ret; +} + +BOOL CABMLDialog::Create( CWnd *pParentWnd ) +{ + BOOL ret = FALSE; + if (m_MailNewsResourceSwitcher.Initialize ()) { + CDialog::Create (IDD, pParentWnd); + ret = TRUE; + } + return ret; + +} int CABMLDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) { @@ -504,7 +1760,7 @@ void CABMLDialog::AddEntriesToList(int index, int num) if (index != -1) { count = index + num; - for (int i = index; i < count; i++) + for (int i = index; i < (int) count; i++) { // add the entry to the list m_pIAddressList->InsertEntry(i, FALSE, "", "", IDB_PERSON, 0); @@ -514,14 +1770,14 @@ void CABMLDialog::AddEntriesToList(int index, int num) { pWnd->ResetContent(); index = 0; - for (int i = 0; i < count; i++) + for (int i = 0; i < (int) count; i++) { // add the entry to the list m_pIAddressList->AppendEntry(FALSE, "", "", IDB_PERSON, 0); } } - for (int j = index; j < count; j++) + for (int j = index; j < (int) count; j++) { if ((entryID = AB_GetEntryIDAt((AddressPane*) m_addrBookPane, j)) != MSG_MESSAGEIDNONE) { @@ -804,6 +2060,7 @@ BOOL CABMLDialog::ProcessVCardData(COleDataObject * pDataObject, CPoint &point) ABID tempID = MSG_MESSAGEIDNONE; HGLOBAL hEntryIDs = NULL; LPSTR pEntryIDs = NULL; + DIR_Server* pab = NULL; if (pDataObject->IsDataAvailable( clipFormat = ::RegisterClipboardFormat(vCardClipboardFormat))) @@ -811,9 +2068,15 @@ BOOL CABMLDialog::ProcessVCardData(COleDataObject * pDataObject, CPoint &point) if (pDataObject->IsDataAvailable( fromABFormat = ::RegisterClipboardFormat(ADDRESSBOOK_SOURCETARGET_FORMAT))) { - hEntryIDs = pDataObject->GetGlobalData(fromABFormat); - pEntryIDs = (LPSTR)GlobalLock(hEntryIDs); - ASSERT(pEntryIDs); + CAddrFrame* frame = (CAddrFrame*) GetParent(); + if (frame) + pab = frame->GetCurrentDirectoryServer(); + if (DIR_AreServersSame (pab, m_dir)) + { + hEntryIDs = pDataObject->GetGlobalData(fromABFormat); + pEntryIDs = (LPSTR)GlobalLock(hEntryIDs); + ASSERT(pEntryIDs); + } } HGLOBAL hAddresses = pDataObject->GetGlobalData(clipFormat); LPSTR pAddresses = (LPSTR)GlobalLock(hAddresses); @@ -842,14 +2105,16 @@ BOOL CABMLDialog::ProcessVCardData(COleDataObject * pDataObject, CPoint &point) if (pString != NULL) { m_changingEntry = TRUE; - int nIndex = pListBox->GetCount() - 1; + uint32 count = 0; + AB_GetEntryCountInMailingList(m_addrBookPane, &count); + int nIndex = count; if (pEntryIDs) //from Address Book { char szEntryID[20]; ABID entryID; ABID type; char *fullname = NULL; - DIR_Server* pab = NULL; + pab = NULL; szEntryID[0] = '\0'; int nPos = 0; @@ -934,7 +2199,7 @@ DROPEFFECT CMailListDropTarget::OnDragOver(CWnd * pWnd, DROPEFFECT deReturn = DROPEFFECT_NONE; // Only interested in vcard if(pDataObject->IsDataAvailable( - ::RegisterClipboardFormat(vCardClipboardFormat)) ) + ::RegisterClipboardFormat(vCardClipboardFormat))) { if (m_pOwner->IsDragInListBox(&point)) deReturn = DROPEFFECT_COPY; @@ -952,4 +2217,4 @@ BOOL CMailListDropTarget::OnDrop return FALSE; } - +#endif //MOZ_NEWADDR diff --git a/mozilla/cmd/winfe/abmldlg.h b/mozilla/cmd/winfe/abmldlg.h index b0cb18ddafe..302cac86d0c 100755 --- a/mozilla/cmd/winfe/abmldlg.h +++ b/mozilla/cmd/winfe/abmldlg.h @@ -15,6 +15,173 @@ * Copyright (C) 1998 Netscape Communications Corporation. All Rights * Reserved. */ + +#include "addrfrm.h" + +#ifdef MOZ_NEWADDR + +#ifndef _abmldlg_h_ +#define _abmldlg_h_ + +// ABMLDLG.H +// +// DESCRIPTION: +// This file contains the declarations of the for the mailing list +// dialog +// + +#include "apimsg.h" +#include "xp_core.h" +#include "addrbook.h" +#include "property.h" +#include "apiaddr.h" +#include "mnrccln.h" +#include "statbar.h" + +class CNSAddressList; +class CABMLDialog; +class CABMLDialogEntryList; + + +class CMailListDropTarget : public COleDropTarget +{ +public: + + CABMLDialog* m_pOwner; +//Construction + CMailListDropTarget(CABMLDialog* pOwner) { m_pOwner = pOwner; } + BOOL OnDrop(CWnd *, COleDataObject *, DROPEFFECT, CPoint); + DROPEFFECT OnDragOver(CWnd *, COleDataObject *, DWORD, CPoint); +}; + + +/**************************************************************************** +* +* Class: CABMLDialog +* +* DESCRIPTION: +* This class is the address picker from the compose window +* +****************************************************************************/ +class CABMLDialog : public CDialog, + public IAddressParent { +// Attributes +public: + + friend class CABMLDialogEntryList; + +// Dialog Data + //{{AFX_DATA(CABMLDialog) + enum { IDD = IDD_ADDRESS_LIST }; + CString m_description; + CString m_name; + CString m_nickname; + //}}AFX_DATA + +protected: + + CNetscapeStatusBar m_barStatus; + LPADDRESSCONTROL m_pIAddressList; + LPUNKNOWN m_pUnkAddress; + int m_iMysticPlane; + HFONT m_pFont; + + LPMSGLIST m_pIAddrList; + MLPane *m_addrBookPane; + DIR_Server *m_dir; + ABID m_entryID; + BOOL m_addingEntries; + BOOL m_saved; + int m_errorCode; + BOOL m_changingEntry; + BOOL m_addingEntry; + BOOL m_deletingEntry; + MSG_Pane *m_pPane; + + CMailListDropTarget *m_pDropTarget; + + // Support loading resources from dll + CMailNewsResourceSwitcher m_MailNewsResourceSwitcher; + +// Support for IMsgList Interface (Called by CABMLDialogEntryList) + virtual void ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + void CleanupOnClose(); + void AddEntriesToList(int index, int num); + + // IAddressParent stuff + virtual void AddedItem (HWND hwnd, LONG id,int index); + virtual int ChangedItem (char * pString, int index, HWND hwnd, char** ppFullName, unsigned long* entryID, UINT* bitmapID); + virtual void DeletedItem (HWND hwnd, LONG id,int index); + void PrintItems(LPSTR comment); + + virtual char * NameCompletion (char *); + virtual void StartNameCompletionSearch(); + virtual void StopNameCompletionSearch(); + virtual void SetProgressBarPercent(int32 lPercent); + virtual void SetStatusText(const char* pMessage ); + virtual CWnd *GetOwnerWindow(); + + +// Operations +public: + CABMLDialog(CWnd* pParent = NULL, MSG_Pane *pane = NULL, MWContext* context = NULL); + ~CABMLDialog(); + BOOL Create( LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL ); + BOOL Create( UINT nIDTemplate, CWnd* pParentWnd = NULL ); + BOOL Create( CWnd *pParent ); + + enum { ToolInvalid = -1, ToolText = 0, ToolPictures = 1, ToolBoth = 2 }; + + static void HandleErrorReturn(int errorID, CWnd* parent = NULL); + MLPane* GetPane() { return m_addrBookPane; } + ABID GetEntryID() { return m_entryID; } + + CNSAddressList * GetAddressWidget(); + + void DoUpdateAddressBook( CCmdUI* pCmdUI, AB_CommandType cmd, BOOL bUseCheck = TRUE ); + + // Drop + BOOL IsDragInListBox(CPoint *pPoint); + BOOL ProcessVCardData(COleDataObject * pDataObject,CPoint &point); + BOOL ProcessAddressBookIndexFormat(COleDataObject *pDataObject, DROPEFFECT effect); + DROPEFFECT GetAddressBookIndexFormatDropEffect(COleDataObject *pDataObject); +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CABMLDialog) + public: + virtual BOOL OnInitDialog( ); + BOOL PreTranslateMessage( MSG* pMsg ); + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void PostNcDestroy( ); + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CABMLDialog) + afx_msg int OnCreate( LPCREATESTRUCT ); + afx_msg void OnDestroy( ); + afx_msg void OnOK(); + afx_msg void OnCancel(); + afx_msg void OnRemoveEntry(); + afx_msg void OnHelp(); + afx_msg void OnUpdateOnlineStatus(CCmdUI *pCmdUI); + + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +#endif +#else // MOZ_NEWADDR + #ifndef _abmldlg_h_ #define _abmldlg_h_ @@ -25,7 +192,6 @@ // dialog // -#include "addrfrm.h" #include "apimsg.h" #include "xp_core.h" #include "addrbook.h" @@ -108,14 +274,21 @@ protected: virtual int ChangedItem (char * pString, int index, HWND hwnd, char** ppFullName, unsigned long* entryID, UINT* bitmapID); virtual void DeletedItem (HWND hwnd, LONG id,int index); virtual char * NameCompletion (char *); + virtual void StartNameCompletionSearch(){;} + virtual void StopNameCompletionSearch(){;} + virtual void SetProgressBarPercent(int32 lPercent){;} + virtual void SetStatusText(const char* pMessage ){;} + virtual CWnd *GetOwnerWindow(){return NULL;} + + // Operations public: CABMLDialog(DIR_Server* dir, CWnd* pParent = NULL, ABID listID = NULL, MWContext* context = NULL); ~CABMLDialog(); - - - BOOL Create( CWnd *pParent ) { return CDialog::Create( IDD, pParent ); }; + BOOL Create( LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL ); + BOOL Create( UINT nIDTemplate, CWnd* pParentWnd = NULL ); + BOOL Create( CWnd *pParent ); enum { ToolInvalid = -1, ToolText = 0, ToolPictures = 1, ToolBoth = 2 }; @@ -159,3 +332,5 @@ protected: #endif + +#endif // MOZ_NEWADDR diff --git a/mozilla/cmd/winfe/addrdlg.cpp b/mozilla/cmd/winfe/addrdlg.cpp index 553ad5d0da7..ceedfc8c0e2 100755 --- a/mozilla/cmd/winfe/addrdlg.cpp +++ b/mozilla/cmd/winfe/addrdlg.cpp @@ -17,17 +17,2664 @@ */ // addrdlg.cpp : implementation file // - #include "stdafx.h" #include "wfemsg.h" +#include "addrdlg.h" + +#ifdef MOZ_NEWADDR + #include "msg_srch.h" #include "dirprefs.h" -#include "addrdlg.h" #include "apiaddr.h" #include "nethelp.h" #include "prefapi.h" #include "intl_csi.h" #include "srchdlg.h" +#include "abcom.h" + + +#ifdef _DEBUG +#undef THIS_FILE +static char BASED_CODE THIS_FILE[] = __FILE__; +#endif + +extern "C" { +#include "xpgetstr.h" +extern int MK_ADDR_CCNAME; +extern int MK_ADDR_BCCNAME; +extern int MK_ADDR_TONAME; +}; + +#define ADDRESS_DIALOG_TIMER 7 +#define TYPEDOWN_SPEED 300 +#define LDAP_SEARCH_SPEED 1250 +#define ADDRDLG_OUTLINER_TYPEDOWN_TIMER 251 +#define OUTLINER_TYPEDOWN_SPEED 1250 + + +class CAddrDialog; + + +CAddrDialogCX::CAddrDialogCX(CAddrDialog *pDialog) +: CStubsCX(AddressCX, MWContextAddressBook) +{ + m_pDialog = pDialog; + m_lPercent = 0; + m_bAnimated = FALSE; +} + + +void CAddrDialogCX::SetProgressBarPercent(MWContext *pContext, int32 lPercent ) { + // Ensure the safety of the value. + + lPercent = lPercent < 0 ? 0 : ( lPercent > 100 ? 100 : lPercent ); + + if ( m_lPercent == lPercent ) { + return; + } + + m_lPercent = lPercent; + if (m_pDialog) { + m_pDialog->SetProgressBarPercent(lPercent); + } +} + +void CAddrDialogCX::Progress(MWContext *pContext, const char *pMessage) { + m_csProgress = pMessage; + if ( m_pDialog ) { + m_pDialog->SetStatusText(pMessage); + } +} + +int32 CAddrDialogCX::QueryProgressPercent() { + return m_lPercent; +} + + +void CAddrDialogCX::AllConnectionsComplete(MWContext *pContext) +{ + // Call the base. + CStubsCX::AllConnectionsComplete(pContext); + + // Also, we can clear the progress bar now. + m_lPercent = 0; + if ( m_pDialog ) { + m_pDialog->SetProgressBarPercent(m_lPercent); + m_pDialog->AllConnectionsComplete(pContext); + } + if (m_pDialog) { + m_pDialog->SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, (LPARAM)0); + } +} + +void CAddrDialogCX::UpdateStopState( MWContext *pContext ) +{ + if (m_pDialog) { + m_pDialog->SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, (LPARAM)0); + } +} + +CWnd *CAddrDialogCX::GetDialogOwner() const { + return m_pDialog; +} + + +///////////////////////////////////////////////////////////////////////////// +// CAddrDialogEntryList + +class CAddrDialogEntryList: public IMsgList { + + CAddrDialog *m_pAddrDialog; + unsigned long m_ulRefCount; + +public: +// IUnknown Interface + STDMETHODIMP QueryInterface(REFIID,LPVOID *); + STDMETHODIMP_(ULONG) AddRef(void); + STDMETHODIMP_(ULONG) Release(void); + +// IMsgList Interface + virtual void ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void GetSelection( MSG_Pane* pane, MSG_ViewIndex **indices, int *count, + int *focus); + virtual void SelectItem( MSG_Pane* pane, int item ); + + virtual void CopyMessagesInto( MSG_Pane *pane, MSG_ViewIndex *indices, int count, + MSG_FolderInfo *folderInfo) {} + virtual void MoveMessagesInto( MSG_Pane *pane, MSG_ViewIndex *indices, int count, + MSG_FolderInfo *folderInfo) {} + + CAddrDialogEntryList( CAddrDialog *pAddrDialog ) { + m_ulRefCount = 0; + m_pAddrDialog = pAddrDialog; + } +}; + + +STDMETHODIMP CAddrDialogEntryList::QueryInterface(REFIID refiid, LPVOID * ppv) +{ + *ppv = NULL; + if (IsEqualIID(refiid,IID_IUnknown)) + *ppv = (LPUNKNOWN) this; + else if (IsEqualIID(refiid,IID_IMsgList)) + *ppv = (LPMSGLIST) this; + else if (IsEqualIID(refiid,IID_IMailFrame)) + *ppv = (LPMAILFRAME) m_pAddrDialog; + + if (*ppv != NULL) { + AddRef(); + return NOERROR; + } + + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP_(ULONG) CAddrDialogEntryList::AddRef(void) +{ + return ++m_ulRefCount; +} + +STDMETHODIMP_(ULONG) CAddrDialogEntryList::Release(void) +{ + ULONG ulRef; + ulRef = --m_ulRefCount; + if (m_ulRefCount == 0) + delete this; + return ulRef; +} + +void CAddrDialogEntryList::ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if (m_pAddrDialog) { + m_pAddrDialog->ListChangeStarting( pane, asynchronous, + notify, where, num ); + } +} + +void CAddrDialogEntryList::ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if (m_pAddrDialog) { + m_pAddrDialog->ListChangeFinished( pane, asynchronous, + notify, where, num ); + } +} + +void CAddrDialogEntryList::GetSelection( MSG_Pane* pane, MSG_ViewIndex **indices, int *count, + int *focus) +{ +} + +void CAddrDialogEntryList::SelectItem( MSG_Pane* pane, int item ) +{ +} + + + +///////////////////////////////////////////////////////////////////////////// +// CAddrDialog + +CAddrDialog::CAddrDialog( + CWnd* pParent, /*=NULL*/ + BOOL isMapi, LPSTR winText, MAPIAddressCallbackProc mapiCB, MAPIAddressGetAddrProc mapiGetProc // rhp - MAPI + ) + : CDialog(CAddrDialog::IDD, pParent) +{ + + CString msg; + int result = 0; + INTL_CharSetInfo csi; + + m_pCX = new CAddrDialogCX( this ); + csi = LO_GetDocumentCharacterSetInfo(m_pCX->GetContext()); + + m_pCX->GetContext()->type = MWContextAddressBook; + m_pCX->GetContext()->fancyFTP = TRUE; + m_pCX->GetContext()->fancyNews = TRUE; + m_pCX->GetContext()->intrupt = FALSE; + m_pCX->GetContext()->reSize = FALSE; + INTL_SetCSIWinCSID(csi, CIntlWin::GetSystemLocaleCsid()); + + m_pOutliner = NULL; + m_addrBookPane = NULL; + m_addrContPane = NULL; + m_bSearching = FALSE; + m_directory = 0; + m_pDropTarget = NULL; + m_idefButtonID = IDC_TO; + + m_EditWnd.SetOwner(this); + CAddrDialogEntryList *pInstance = new CAddrDialogEntryList( this ); + pInstance->QueryInterface( IID_IMsgList, (LPVOID *) &m_pIAddrList ); + + + // rhp - MAPI stuff... + m_isMAPI = isMapi; + m_mapiHeader = NULL; + m_mapiCBProc = NULL; + m_mapiGetAddrProc = NULL; + + if (m_isMAPI) + { + if ( (winText) && (*winText) ) + { + m_mapiHeader = strdup(winText); + } + + m_mapiCBProc = mapiCB; + m_mapiGetAddrProc = mapiGetProc; + } + + CAddrFrame::HandleErrorReturn((result = AB_CreateABPane(&m_addrBookPane, + m_pCX->GetContext(), + WFE_MSGGetMaster()))); + + if (result) + return; + + CAddrFrame::HandleErrorReturn((result = AB_CreateContainerPane(&m_addrContPane, + m_pCX->GetContext(), + WFE_MSGGetMaster()))); + + if (result) { + AB_ClosePane (m_addrBookPane); + return; + } + + CAddrFrame::HandleErrorReturn((result = AB_InitializeContainerPane(m_addrContPane))); + + if (result) { + AB_ClosePane (m_addrContPane); + AB_ClosePane (m_addrBookPane); + return; + } + + AB_ContainerInfo *info = AB_GetContainerForIndex(m_addrContPane, 0); + + ASSERT (info); + + CAddrFrame::HandleErrorReturn((result = AB_InitializeABPane(m_addrBookPane, + info))); + if (result) { + AB_ClosePane (m_addrContPane); + AB_ClosePane (m_addrBookPane); + return; + } + + //set property sheets for address book pane + HandleErrorReturn((result = AB_SetShowPropertySheetForEntryFunc( + (MSG_Pane *)m_addrBookPane, + ShowPropertySheetForEntry))); + + if (result) { + AB_ClosePane (m_addrContPane); + AB_ClosePane (m_addrBookPane); + } + + //set property sheets for container pane + HandleErrorReturn((result = AB_SetShowPropertySheetForEntryFunc( + (MSG_Pane *)m_addrContPane, + ShowPropertySheetForEntry))); + + if (result) { + AB_ClosePane (m_addrContPane); + AB_ClosePane (m_addrBookPane); + } + + //set ldap property sheets for container pane + HandleErrorReturn((result = AB_SetShowPropertySheetForDirFunc( + (MSG_Pane *)m_addrContPane, + ShowPropertySheetForDir))); + + if (result) { + AB_ClosePane (m_addrContPane); + AB_ClosePane (m_addrBookPane); + } + + //{{AFX_DATA_INIT(CAddrDialog) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + +void CAddrDialog::OnKeyDown ( UINT nChar, UINT nRepCnt, UINT nFlags ) +{ + CDialog::OnKeyDown ( nChar, nRepCnt, nFlags ); +} + +void CAddrDialog::CleanupOnClose() +{ + // DestroyContext will call Interrupt, but if we wait until after DestroyContext + // to call MSG_SearchFree, the MWContext will be gone, and we'll be reading freed memory + + PREF_SetIntPref("mail.addr_picker.sliderwidth", m_pSplitter->GetPaneSize()); + + if (XP_IsContextBusy (m_pCX->GetContext())) + XP_InterruptContext (m_pCX->GetContext()); + MSG_SearchFree ((MSG_Pane*) m_addrBookPane); + + if (m_pIAddrList) + m_pIAddrList->Release(); + + if (m_addrBookPane) + HandleErrorReturn(AB_ClosePane(m_addrBookPane)); + + if (m_addrContPane) + HandleErrorReturn(AB_ClosePane(m_addrContPane)); + + if(!m_pCX->IsDestroyed()) { + m_pCX->DestroyContext(); + } + if (m_pFont){ + theApp.ReleaseAppFont(m_pFont); + } + + if (m_pOutlinerParent){ + delete m_pOutlinerParent; + } + + if (m_pDirOutlinerParent){ + delete m_pDirOutlinerParent; + } + + if (m_pSplitter){ + delete m_pSplitter; + } + + if (m_pDropTarget) { + m_pDropTarget->Revoke(); + delete m_pDropTarget; + m_pDropTarget = NULL; + } + + // rhp - for MAPI + if (m_isMAPI) + { + if (m_mapiHeader) + free(m_mapiHeader); + } +} + +///////////////////////////////////////////////////////////////////////////// +// CAddrDialog Overloaded methods +///////////////////////////////////////////////////////////////////////////// + +// rhp - this is needed for the population of the to address type... +void +CAddrDialog::ProcessMAPIAddressPopulation(void) +{ + int index = 0; + LPSTR name; + LPSTR address; + int addrType; + + if (!m_mapiGetAddrProc) + return; + + CListBox *pBucket = GetBucket(); + + while ( m_mapiGetAddrProc(&name, &address, &addrType) ) + { + char *formatted; + char tempString[512] = ""; + int nIndex = -1; + NSADDRESSLIST *pAddress = new NSADDRESSLIST; + + ASSERT(pAddress); + if (!pAddress) + continue; + + if ((name) && (*name)) + { + strcat(tempString, name); + strcat(tempString, " "); + } + + if ( (!address) || (!(*address)) ) + continue; + + strcat(tempString, "<"); + strcat(tempString, address); + strcat(tempString, ">"); + + pAddress->ulHeaderType = addrType; + pAddress->idBitmap = 0; + pAddress->idEntry = 0; + pAddress->szAddress = strdup (tempString); + + GetFormattedString(tempString, addrType, &formatted); + if (formatted) + { + nIndex = pBucket->InsertString( index, formatted ); + free (formatted); + } + + if ( nIndex < 0 ) + return; + + pBucket->SetItemDataPtr( nIndex, pAddress ); + ++index; + } + + OnSelchange(); +} + +BOOL CAddrDialog::OnInitDialog( ) +{ + if (CDialog::OnInitDialog()) { + CWnd* widget; + CRect rect2, rect3, rect4; + UINT aIDArray[] = { IDS_SECURITY_STATUS, IDS_TRANSFER_STATUS, ID_SEPARATOR, + IDS_ONLINE_STATUS}; + int result = 0; + + CListBox *pBucket = GetBucket(); + + widget = GetDlgItem(IDC_ADDRESSLIST); + widget->GetWindowRect(&rect2); + widget->GetClientRect(&rect3); + GetClientRect(&rect4); + ClientToScreen(&rect4); + rect2.OffsetRect(-rect4.left, -rect4.top); + + widget->DestroyWindow (); + + // create slider control + m_pSplitter = (CMailNewsSplitter *) RUNTIME_CLASS(CMailNewsSplitter)->CreateObject(); + + ASSERT(m_pSplitter); + +#ifdef _WIN32 + m_pSplitter->CreateEx(0, NULL, NULL, + WS_CHILD|WS_VISIBLE|WS_TABSTOP, + 0, 0, 0, 0, + this->m_hWnd, (HMENU) IDC_ADDRESSLIST ); +#else + CCreateContext Context; + Context.m_pCurrentFrame = NULL; // nothing to base on + Context.m_pCurrentDoc = NULL; // nothing to base on + Context.m_pNewViewClass = NULL; // nothing to base on + Context.m_pNewDocTemplate = NULL; // nothing to base on + m_pSplitter->Create( NULL, NULL, + WS_CHILD|WS_VISIBLE |WS_TABSTOP, + rect2, this, IDC_ADDRESSLIST, &Context ); +#endif + + // create the outliner control + m_pOutlinerParent = new CAddrOutlinerParent; +#ifdef _WIN32 + m_pOutlinerParent->CreateEx ( WS_EX_CLIENTEDGE, NULL, _T("NSOutlinerParent"), + WS_TABSTOP|WS_VISIBLE|WS_CHILD|WS_CLIPCHILDREN, + 0, 0, 0, 0, + m_pSplitter->m_hWnd, (HMENU) 99); +#else + rect2.SetRectEmpty(); + m_pOutlinerParent->Create( NULL, _T("NSOutlinerParent"), + WS_BORDER|WS_TABSTOP|WS_VISIBLE|WS_CHILD, + rect2, m_pSplitter, 99); +#endif + + m_pOutlinerParent->CreateColumns ( ); + m_pOutlinerParent->EnableFocusFrame(TRUE); + m_pOutliner = (CAddrOutliner *) m_pOutlinerParent->m_pOutliner; + m_pOutliner->SetPane(m_addrBookPane); + m_pOutliner->SetContext( m_pCX->GetContext() ); + m_pOutliner->SetOutlinerOwner(this); + + + // create the directory outliner control + m_pDirOutlinerParent = new CDirOutlinerParent; + +#ifdef _WIN32 + m_pDirOutlinerParent->CreateEx(WS_EX_CLIENTEDGE, NULL, _T("NSOutlinerParent"), + WS_TABSTOP|WS_VISIBLE|WS_CHILD|WS_CLIPCHILDREN, + 0,0,0,0, m_pSplitter->m_hWnd, (HMENU) 100 ); +#else + m_pDirOutlinerParent->Create( NULL, _T("NSOutlinerParent"), + WS_BORDER|WS_TABSTOP|WS_VISIBLE|WS_CHILD, + CRect(0,0,0,0), m_pSplitter, 100); +#endif + + m_pDirOutliner = (CDirOutliner *) m_pDirOutlinerParent->m_pOutliner; + m_pDirOutlinerParent->CreateColumns ( ); + m_pDirOutlinerParent->EnableFocusFrame(TRUE); + m_pDirOutliner->SetPane(m_addrContPane); + m_pDirOutliner->SetOutlinerOwner(this); + m_pDirOutliner->SelectItem(0); + + + // m_pDirOutliner->SetDirectoryIndex(0); + + // set the width of the panes in the slider + int32 prefInt = -1; + PREF_GetIntPref("mail.addr_picker.sliderwidth", &prefInt); + RECT rect; + GetClientRect(&rect); + m_pSplitter->AddPanes(m_pDirOutlinerParent, m_pOutlinerParent, prefInt, TRUE); + m_pSplitter->SetWindowPos(GetDlgItem(ID_NAVIGATE_INTERRUPT), rect2.left, rect2.top, rect3.right, rect3.bottom, SWP_SHOWWINDOW); + + m_pDirOutlinerParent->SetWindowPos(GetDlgItem(ID_NAVIGATE_INTERRUPT), 0, 0, + rect3.right, rect3.bottom, SWP_NOMOVE|SWP_NOSIZE); + m_pOutlinerParent->SetWindowPos(m_pDirOutlinerParent, 0, 0, + rect3.right, rect3.bottom, SWP_NOMOVE|SWP_NOSIZE); + // reset the tab order + widget = GetDlgItem (IDC_TO); + widget->SetWindowPos(m_pOutlinerParent, 0, 0, + rect3.right, rect3.bottom, SWP_NOMOVE|SWP_NOSIZE); + UpdateDirectories(); + + // create the status bar + widget = GetDlgItem(IDC_StatusRect); + widget->GetWindowRect(&rect2); + widget->GetClientRect(&rect3); + ScreenToClient(&rect2); + + widget->DestroyWindow (); + + m_barStatus.Create(this, TRUE, FALSE); + + m_barStatus.MoveWindow(&rect2, TRUE); + + m_barStatus.SetIndicators( aIDArray, sizeof(aIDArray) / sizeof(UINT) ); + + int idx = m_barStatus.CommandToIndex(IDS_ONLINE_STATUS); + if (idx > -1) + { + UINT nID = IDS_ONLINE_STATUS; + UINT nStyle; + int nWidth; + m_barStatus.GetPaneInfo( idx, nID, nStyle, nWidth ); + if (!NET_IsOffline()) + m_barStatus.SetPaneInfo(idx, IDS_ONLINE_STATUS, SBPS_NORMAL, nWidth); + else + m_barStatus.SetPaneInfo(idx, IDS_ONLINE_STATUS, SBPS_DISABLED, nWidth); + } + + + DoUpdateWidget(IDC_DIRSEARCH, AB_LDAPSearchCmd, TRUE); + DoUpdateWidget(IDC_TO, AB_NewMessageCmd, TRUE); + UpdateMsgButtons(); + + CGenericFrame *pCompose = (CGenericFrame *)GetParent(); + + ApiApiPtr(api); + LPUNKNOWN pUnk = api->CreateClassInstance( + APICLASS_ADDRESSCONTROL, NULL, (APISIGNATURE)pCompose); + if (pUnk) + { + LPADDRESSCONTROL pIAddressControl; + HRESULT hRes = pUnk->QueryInterface(IID_IAddressControl,(LPVOID*)&pIAddressControl); + ASSERT(hRes==NOERROR); + LPNSADDRESSLIST pList = NULL; + int count = pIAddressControl->GetAddressList(&pList); + pUnk->Release(); + for (int index = 0; index < count; index++) + { + if (pList[index].szAddress) + { + if (strlen (pList[index].szAddress)) + { + NSADDRESSLIST *pAddress = new NSADDRESSLIST; + char * formatted; + int nIndex = -1; + ASSERT(pAddress); + pAddress->ulHeaderType = pList[index].ulHeaderType; + pAddress->idBitmap = pList[index].idBitmap; + pAddress->idEntry = pList[index].idEntry; + pAddress->szAddress = strdup (pList[index].szAddress); + GetFormattedString(pList[index].szAddress, pList[index].ulHeaderType, &formatted); + if (formatted) + { + nIndex = pBucket->InsertString( index, formatted ); + free (formatted); + } + free (pList[index].szAddress); + if ( nIndex < 0 ) + return 0; + pBucket->SetItemDataPtr( nIndex, pAddress ); + } + } + } + free(pList); + OnSelchange(); + } else + { + return FALSE; + } + } else + { + return FALSE; + } + + HDC hDC = ::GetDC(m_hWnd); + LOGFONT lf; + memset(&lf,0,sizeof(LOGFONT)); + lf.lfPitchAndFamily = FF_SWISS; + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = IntlGetLfCharset(CIntlWin::GetSystemLocaleCsid()); + if (CIntlWin::GetSystemLocaleCsid() == CS_LATIN1) + _tcscpy(lf.lfFaceName, "MS Sans Serif"); + else + _tcscpy(lf.lfFaceName, IntlGetUIPropFaceName(CIntlWin::GetSystemLocaleCsid())); + lf.lfHeight = -MulDiv(9, ::GetDeviceCaps(hDC, LOGPIXELSY), 72); + m_pFont = theApp.CreateAppFont( lf ); + ::ReleaseDC(m_hWnd,hDC); + + m_EditWnd.SubclassDlgItem(IDC_ADDRNAME, this); + + ::SendMessage(::GetDlgItem(m_hWnd, IDC_ADDRNAME), WM_SETFONT, (WPARAM)m_pFont, FALSE); + ::SendMessage(::GetDlgItem(m_hWnd, IDC_ADDRESSBKT), WM_SETFONT, (WPARAM)m_pFont, FALSE); + + if(!m_pDropTarget) { + m_pDropTarget = new CAddressPickerDropTarget(this); + m_pDropTarget->Register(this); + } + DragAcceptFiles(); + + CComboBox *directory = (CComboBox*) GetDlgItem(IDC_DIRECTORIES); + directory->SetCurSel (0); + m_pOutliner->SetDirectoryIndex( directory->GetCurSel()); + m_pDirOutliner->SetFocusLine(0); + if (m_pOutliner->GetTotalLines()) + m_pOutliner->SelectItem (0); + GetDlgItem(IDC_ADDRNAME)->SetFocus(); + SendMessage(DM_SETDEFID, m_idefButtonID, TRUE); + GetDlgItem(m_idefButtonID)->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + GetDlgItem(IDC_DONE_EDITING)->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + + // rhp - for MAPI + if (m_isMAPI) + { + ProcessMAPIAddressPopulation(); + + if (m_mapiHeader) + { + SetWindowText(m_mapiHeader); + } + } + + return FALSE; +} + + +void CAddrDialog::GetFormattedString(char* fullname, MSG_HEADER_SET header, char** formatted) +{ + + CString formattedString; + if (fullname) { + switch (header) { + case MSG_TO_HEADER_MASK: + formattedString.Format(XP_GetString (MK_ADDR_TONAME), fullname); + break; + case MSG_CC_HEADER_MASK: + formattedString.Format(XP_GetString (MK_ADDR_CCNAME), fullname); + break; + case MSG_BCC_HEADER_MASK: + formattedString.Format(XP_GetString (MK_ADDR_BCCNAME), fullname); + break; + default: + formattedString.Format(XP_GetString (MK_ADDR_TONAME), fullname); + } + } + (*formatted) = strdup (formattedString); +} + +void CAddrDialog::Progress(const char *pMessage) +{ + m_barStatus.SetWindowText( pMessage ); +} + + +void CAddrDialog::SetProgressBarPercent(int32 lPercent) +{ + m_barStatus.SetPercentDone (lPercent); +} // END OF FUNCTION CAddrDialog::DrawProgressBar() + + +///////////////////////////////////////////////////////////////////////////// +// CAddrDialog message handlers + +BEGIN_MESSAGE_MAP(CAddrDialog, CDialog) + //{{AFX_MSG_MAP(CAddrDialog) + ON_WM_TIMER () + ON_EN_SETFOCUS(IDC_ADDRNAME, OnSetFocusName) + ON_EN_CHANGE(IDC_ADDRNAME, OnChangeName) + ON_CBN_SELCHANGE(IDC_DIRECTORIES, OnChangeDirectory) + ON_BN_CLICKED(IDC_DIRSEARCH, OnDirectorySearch) + ON_BN_CLICKED(ID_NAVIGATE_INTERRUPT, OnStopSearch) + ON_BN_CLICKED( IDC_DONE_EDITING, OnDone) + ON_BN_CLICKED( IDCANCEL, OnCancel) + ON_WM_CREATE() + ON_WM_DESTROY() + ON_WM_KEYDOWN() + ON_COMMAND(IDC_TO, OnComposeMsg) + ON_COMMAND(IDC_CC, OnComposeCCMsg) + ON_COMMAND(IDC_BCC, OnComposeBCCMsg) + ON_COMMAND(ID_ITEM_PROPERTIES, OnGetProperties) + ON_LBN_SELCHANGE(IDC_ADDRESSBKT, OnSelchange) + ON_COMMAND(ID_HELP, OnHelp) + ON_LBN_SETFOCUS(IDC_ADDRESSBKT, OnSetFocusBucket) + ON_UPDATE_COMMAND_UI(IDS_ONLINE_STATUS, OnUpdateOnlineStatus) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +BOOL CAddrDialog::PreTranslateMessage( MSG* pMsg ) +{ + if (pMsg->message == WM_KEYDOWN && pMsg->hwnd == m_pOutliner->GetSafeHwnd()) + { + if (pMsg->wParam != VK_TAB && pMsg->wParam != VK_ESCAPE && pMsg->wParam != VK_RETURN) { + ::SendMessage(pMsg->hwnd, WM_KEYDOWN, pMsg->wParam, pMsg->lParam); + return TRUE; + } + } + + if (pMsg->message == WM_KEYDOWN && pMsg->hwnd == GetBucket()->GetSafeHwnd()) + { + if (pMsg->wParam == VK_DELETE || pMsg->wParam == VK_BACK) { + OnRemove(); + return TRUE; + } + } + + if (pMsg->message == WM_KEYDOWN && pMsg->hwnd == GetDlgItem(IDC_ADDRNAME)->GetSafeHwnd()) + { + if (pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN) { + ::SendMessage(m_pOutliner->GetSafeHwnd(), WM_KEYDOWN, pMsg->wParam, pMsg->lParam); + CWnd* widget = NULL; + widget = GetDlgItem (GetDefaultButtonID()); + if (widget) { + SendMessage(DM_SETDEFID, GetDefaultButtonID(), TRUE); + widget->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + widget = GetDlgItem (IDC_DONE_EDITING); + widget->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + } + return TRUE; + } + } + + if (pMsg->message == WM_KEYDOWN) { + if (pMsg->wParam == VK_TAB) { + HWND hwndNext = NULL; + HWND hwndFocus = ::GetFocus(); + + HWND hwndPossibleNext = ::GetNextDlgTabItem( m_hWnd, pMsg->hwnd, FALSE ); + + HWND hwndPossiblePrev = ::GetNextDlgTabItem( m_hWnd, pMsg->hwnd, TRUE ); + + HWND hwndDirOutliner = m_pDirOutliner ? m_pDirOutliner->m_hWnd : NULL; + HWND hwndOutliner = m_pOutliner ? m_pOutliner->m_hWnd : NULL; + HWND hwndSlider = m_pSplitter ? m_pSplitter->m_hWnd : NULL; + HWND hwndPropButton = GetDlgItem(ID_ITEM_PROPERTIES) ? GetDlgItem(ID_ITEM_PROPERTIES)->m_hWnd : NULL; + + + if ( GetKeyState(VK_SHIFT) & 0x8000 ) { + + // Tab backward + if (hwndFocus == hwndOutliner) { + // Handle tabbing out of outliner into the directory list + if (m_pSplitter->IsOnePaneClosed()) + hwndNext = hwndPossiblePrev; + else + hwndNext = hwndDirOutliner; + } else if ( hwndFocus == hwndDirOutliner ) { + // Handle tabbing out of the slider + hwndNext = hwndPossiblePrev; + } else if ( hwndPossiblePrev == hwndSlider ) { + // Handle tabbing back to the outliner from the + // to/cc/bcc buttons the bucket + hwndNext = hwndOutliner; + } + + } else { + + // Tab forward + if ( hwndPossibleNext == hwndSlider ) { + // handle tabbing into the directory list + if (m_pSplitter->IsOnePaneClosed()) + hwndNext = hwndOutliner; + else + hwndNext = hwndDirOutliner; + } else if (hwndFocus == hwndDirOutliner) { + // Handle tabbing out of the directory list + // and into the results list + hwndNext = hwndOutliner; + } + + } + if ( hwndNext ) { + ::SetFocus( hwndNext ); + return TRUE; + } + } + } // if tab && keydown + + return CDialog::PreTranslateMessage(pMsg); +} + +void CAddrDialog::UpdateDirectories() +{ + DIR_Server* dir; + CComboBox *widget = (CComboBox*) GetDlgItem(IDC_DIRECTORIES); + + widget->ResetContent(); + + XP_List *pTraverse = theApp.m_directories; + while(dir = (DIR_Server *)XP_ListNextObject(pTraverse)) { + if (dir->dirType == PABDirectory || dir->dirType == LDAPDirectory) + widget->AddString(dir->description); + } + if (m_directory == -1) + widget->SetCurSel(0); + else + widget->SetCurSel(m_directory); + + m_pDirOutliner->UpdateCount(); +} + + +DIR_Server * CAddrDialog::GetCurrentDirectoryServer() +{ + return (DIR_Server*) XP_ListGetObjectNum (theApp.m_directories, m_pDirOutliner->GetDirectoryIndex() + 1); +} + + +void CAddrDialog::OnTimer(UINT nID) +{ + CWnd::OnTimer(nID); + if (nID == ADDRESS_DIALOG_TIMER) { + KillTimer(m_uTypedownClock); + if (!m_name.IsEmpty()) { + HandleErrorReturn(AB_TypedownSearch(m_addrBookPane, m_name, MSG_VIEWINDEXNONE)); + +// DIR_Server* dir; +// dir = GetCurrentDirectoryServer(); +// if (dir->dirType == LDAPDirectory) +// PerformListDirectory (m_name.GetBuffer(0)); +// else +// PerformTypedown(m_name.GetBuffer(0)); + m_name.ReleaseBuffer(); + } + } +} + + +void CAddrDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAddrDialog) + DDX_Text(pDX, IDC_ADDRNAME, m_name); + DDX_CBIndex(pDX, IDC_DIRECTORIES, m_directory); + //}}AFX_DATA_MAP +} + + +void CAddrDialog::OnChangeName() +{ + UpdateData(TRUE); + + GetDlgItem(IDC_TO)->EnableWindow(FALSE); + GetDlgItem(IDC_CC)->EnableWindow(FALSE); + GetDlgItem(IDC_BCC)->EnableWindow(FALSE); + + // TODO: Add your control notification handler code here + if (IsSearching()) { + CString checkName (szLoadString(IDS_SEARCHRESULTS)); + if (stricmp (checkName, m_name) != 0) { + OnDirectorySearch(); + SendMessage(DM_SETDEFID, m_idefButtonID, TRUE); + GetDlgItem(m_idefButtonID)->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + GetDlgItem(IDC_DONE_EDITING)->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + } + else + return; + } + + SearchText(FALSE); +} + +void CAddrDialog::SearchText(BOOL bImmediately) +{ + + if (m_name != m_save) { + m_save = m_name; + KillTimer(m_uTypedownClock); + if (m_name.GetLength()) + { + if(bImmediately) + { + //in this case we want to start a new search, not accept a result + //into the list. + GetDlgItem(IDC_TO)->EnableWindow(FALSE); + GetDlgItem(IDC_CC)->EnableWindow(FALSE); + GetDlgItem(IDC_BCC)->EnableWindow(FALSE); + m_uTypedownClock = SetTimer(ADDRESS_DIALOG_TIMER, 0, NULL); + } + else + { + DIR_Server* dir = NULL; + SendMessage(DM_SETDEFID, m_idefButtonID, TRUE); + GetDlgItem(m_idefButtonID)->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + GetDlgItem(IDC_DONE_EDITING)->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + dir = GetCurrentDirectoryServer(); + if (dir->dirType == PABDirectory) + m_uTypedownClock = SetTimer(ADDRESS_DIALOG_TIMER, TYPEDOWN_SPEED, NULL); + else { + int32 prefInt = LDAP_SEARCH_SPEED; + PREF_GetIntPref("ldap_1.autoComplete.interval", &prefInt); + m_uTypedownClock = SetTimer(ADDRESS_DIALOG_TIMER, prefInt, NULL); + } + } + } + } + + +} + +void CAddrDialog::OnSetFocusName() +{ + CEdit *widget = (CEdit*) GetDlgItem(IDC_ADDRNAME); + if (widget) + widget->SetSel(0, -1, TRUE); + SendMessage(DM_SETDEFID, m_idefButtonID, TRUE); + GetDlgItem(m_idefButtonID)->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + GetDlgItem(IDC_DONE_EDITING)->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); +} + +void CAddrDialog::OnSetFocusBucket() +{ + CListBox *pBucket = (CListBox*)GetDlgItem(IDC_ADDRESSBKT); + + if (pBucket->GetCount()) { + SendMessage(DM_SETDEFID, IDC_DONE_EDITING, TRUE); + GetDlgItem(IDC_DONE_EDITING)->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + GetDlgItem(m_idefButtonID)->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + } +} + +void CAddrDialog::OnUpdateOnlineStatus(CCmdUI *pCmdUI) +{ + pCmdUI->Enable(!NET_IsOffline()); +} + +void CAddrDialog::OnChangeDirectory() +{ + // TODO: Add your control notification handler code here + if (IsSearching()) + return; + + UpdateData(TRUE); + + if (m_directory != m_savedir) { + m_savedir = m_directory; + if (m_directory != -1) { + // if (m_pDirOutliner) + // m_pDirOutliner->OnChangeDirectory(m_directory); + PerformChangeDirectory(m_directory); + } + } +} + +void CAddrDialog::OnSelchange() +{ + CListBox *pBucket = (CListBox*)GetDlgItem(IDC_ADDRESSBKT); + + BOOL bEnabled = (pBucket->GetCount() > 0)? TRUE : FALSE; + pBucket->EnableWindow (bEnabled); + GetDlgItem(IDC_DONE_EDITING)->EnableWindow(bEnabled); + if (bEnabled) { + SendMessage(DM_SETDEFID, IDC_DONE_EDITING, TRUE); + GetDlgItem(IDC_DONE_EDITING)->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + GetDlgItem(m_idefButtonID)->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + } + else { + GetDlgItem(IDC_ADDRNAME)->SetFocus(); + SendMessage(DM_SETDEFID, m_idefButtonID, TRUE); + GetDlgItem(m_idefButtonID)->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + GetDlgItem(IDC_DONE_EDITING)->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + } + + + // TODO: Add your control notification handler code here +} + +void CAddrDialog::DoUpdateWidget( int command, AB_CommandType cmd, BOOL bUseCheck ) +{ + + CWnd* widget; + + XP_Bool bSelectable = FALSE, bPlural = FALSE; + MSG_COMMAND_CHECK_STATE sState; + + if (m_addrBookPane) { + if (m_pOutliner) { + MSG_ViewIndex *indices = NULL; + int count = 0; + m_pOutliner->GetSelection(indices, count); + AB_CommandStatusAB2(m_addrBookPane, + cmd, + indices, count, + &bSelectable, + &sState, + NULL, + &bPlural); + } else { + AB_CommandStatusAB2(m_addrBookPane, + cmd, + NULL, 0, + &bSelectable, + &sState, + NULL, + &bPlural); + } + } + + widget = GetDlgItem ( command ); + widget->EnableWindow(bSelectable); +} + + +void CAddrDialog::OnDirectorySearch() +{ + // TODO: Add your control notification handler code here + if (m_directory != -1) + PerformDirectorySearch(); +} + +int CAddrDialog::DoModal () +{ + if (!m_MailNewsResourceSwitcher.Initialize()) + return -1; + return CDialog::DoModal(); +} + + +int CAddrDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + m_MailNewsResourceSwitcher.Reset(); + int res = CDialog::OnCreate(lpCreateStruct); + + MSG_SetFEData( (MSG_Pane*) m_addrBookPane, (LPVOID) (LPUNKNOWN) (LPMSGLIST) m_pIAddrList ); + MSG_SetFEData( (MSG_Pane*) m_addrContPane, (LPVOID) (LPUNKNOWN) (LPMSGLIST) m_pIAddrList ); + return res; +} + +// rhp - This is for MAPI processing... +void +CAddrDialog::ProcessMAPIOnDone(void) +{ + CListBox *pBucket = GetBucket(); + + int count = pBucket->GetCount(); + if (count != LB_ERR && count > 0) + { + for (int index = 0; index < count; index++) + { + NSADDRESSLIST * pAddress = (NSADDRESSLIST *)(pBucket->GetItemDataPtr(index)); + ASSERT(pAddress); + if (m_mapiCBProc) + { + m_mapiCBProc(count, index, pAddress->ulHeaderType, + pAddress->szAddress); // rhp - for MAPI + } + delete (pAddress); + } + } + + CDialog::OnOK(); + CleanupOnClose(); +} + +void CAddrDialog::OnDone() +{ + NSADDRESSLIST* pAddressList; + CListBox *pBucket = GetBucket(); + + // rhp - for MAPI... + if (m_isMAPI) + { + ProcessMAPIOnDone(); + return; + } + + int count = pBucket->GetCount(); + if (count != LB_ERR && count > 0) + { + pAddressList = (NSADDRESSLIST *)calloc(count, sizeof(NSADDRESSLIST)); + if (pAddressList) + { + for (int index = 0; index < count; index++) + { + NSADDRESSLIST * pAddress = (NSADDRESSLIST *)(pBucket->GetItemDataPtr(index)); + ASSERT(pAddress); + pAddressList[index].ulHeaderType = pAddress->ulHeaderType; + pAddressList[index].idBitmap = pAddress->idBitmap; + pAddressList[index].idEntry = pAddress->idEntry; + pAddressList[index].szAddress = pAddress->szAddress; + delete (pAddress); + } + } + + CGenericFrame *pCompose = (CGenericFrame *)GetParent(); + + ApiApiPtr(api); + LPUNKNOWN pUnk = api->CreateClassInstance( + APICLASS_ADDRESSCONTROL, NULL, (APISIGNATURE)pCompose); + if (pUnk) + { + LPADDRESSCONTROL pIAddressControl; + HRESULT hRes = pUnk->QueryInterface(IID_IAddressControl,(LPVOID*)&pIAddressControl); + ASSERT(hRes==NOERROR); + int ct = pIAddressControl->SetAddressList(pAddressList, count); + pUnk->Release(); + } + } + + CDialog::OnOK(); + CleanupOnClose(); +} + + +void CAddrDialog::OnCancel() +{ + CDialog::OnCancel(); + CleanupOnClose(); +} + +void CAddrDialog::ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if ( pane == (MSG_Pane*) m_addrBookPane ) { + if ( m_pOutliner ) { + m_pOutliner->MysticStuffStarting( asynchronous, notify, + where, num ); + } + } + else if(pane == (MSG_Pane*)m_addrContPane) + { + if(m_pDirOutliner) + { + m_pDirOutliner->MysticStuffStarting(asynchronous, notify, where, num); + } + } +} + +void CAddrDialog::ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if ( pane == (MSG_Pane*) m_addrBookPane ) { + if ( m_pOutliner ) { + m_pOutliner->MysticStuffFinishing( asynchronous, notify, + where, num ); + UpdateMsgButtons(); + } + } + else if(pane == (MSG_Pane*)m_addrContPane) + { + if(m_pDirOutliner) + { + m_pDirOutliner->MysticStuffFinishing(asynchronous, notify, where, num); + UpdateMsgButtons(); + } + } + +} + + +void CAddrDialog::SetStatusText(const char* pMessage) +{ + m_barStatus.SetWindowText( pMessage ); +} + + +void CAddrDialog::SetSearchResults(MSG_ViewIndex index, int32 num) +{ + + CString csStatus; + + ASSERT(m_pOutliner); + AB_LDAPSearchResultsAB2(m_addrBookPane, index, num); + if (num > 1 ) { + csStatus.Format( szLoadString(IDS_SEARCHHITS), num ); + } else if ( num > 0 ) { + csStatus.LoadString( IDS_SEARCHONEHIT ); + } else { + csStatus.LoadString( IDS_SEARCHNOHITS ); + } + + m_barStatus.SetWindowText( csStatus ); + +} + +STDMETHODIMP CAddrDialog::QueryInterface(REFIID refiid, LPVOID * ppv) +{ + *ppv = NULL; + if (IsEqualIID(refiid,IID_IUnknown)) + *ppv = (LPUNKNOWN) (LPMAILFRAME) this; + else if (IsEqualIID(refiid,IID_IMailFrame)) + *ppv = (LPMAILFRAME) this; + + if (*ppv != NULL) { + AddRef(); + return NOERROR; + } + + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP_(ULONG) CAddrDialog::AddRef(void) +{ + return 0; // Not a real component +} + +STDMETHODIMP_(ULONG) CAddrDialog::Release(void) +{ + return 0; // Not a real component +} + +// IMailFrame interface +CMailNewsFrame *CAddrDialog::GetMailNewsFrame() +{ + return (CMailNewsFrame *) NULL; +} + +MSG_Pane *CAddrDialog::GetPane() +{ + return (MSG_Pane*) m_addrBookPane; +} + +void CAddrDialog::PaneChanged(MSG_Pane *pane, XP_Bool asynchronous, + MSG_PANE_CHANGED_NOTIFY_CODE notify, int32 value) +{ + switch(notify) + { + case MSG_PaneNotifyTypeDownCompleted: + m_pOutliner->OnTypedown(value); + break; + case MSG_PaneNotifyStartSearching: + m_bSearching = TRUE; + m_barStatus.StartAnimation(); + break; + + case MSG_PaneNotifyStopSearching: + m_bSearching = FALSE; + break; + + } +} + + +void CAddrDialog::AllConnectionsComplete( MWContext *pContext ) +{ + OnStopSearch(); + + int total = m_pOutliner->GetTotalLines(); + CString csStatus; + if ( total > 1 ) { + csStatus.Format( szLoadString( IDS_SEARCHHITS ), total ); + } else if ( total > 0 ) { + csStatus.LoadString( IDS_SEARCHONEHIT ); + } else { + csStatus.LoadString( IDS_SEARCHNOHITS ); + } + m_barStatus.SetWindowText( csStatus ); + + SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, (LPARAM)0); +} + + +void CAddrDialog::PerformTypedown (char* name) +{ + if (!m_bSearching) + m_pOutliner->OnTypedown (name); +} + +void CAddrDialog::PerformListDirectory (char* name) +{ + // Build Search + m_barStatus.SetWindowText( szLoadString( IDS_SEARCHING ) ); + m_bSearching = TRUE; + GetDlgItem(IDC_DIRECTORIES)->EnableWindow(FALSE); + GetDlgItem( IDC_DIRSEARCH)->EnableWindow(FALSE); + GetDlgItem( ID_NAVIGATE_INTERRUPT)->EnableWindow(TRUE); + m_pOutliner->UpdateCount(); + m_barStatus.StartAnimation(); + + HandleErrorReturn(AB_SearchDirectoryAB2(m_addrBookPane, name)); +} + + +void CAddrDialog::MoveSelections(MSG_HEADER_SET header) +{ + CString csAddress; + MSG_ViewIndex *indices; + int count; + CGenericFrame * pCompose = (CGenericFrame *)GetParent(); + CListBox *pBucket = GetBucket(); + pBucket->EnableWindow (TRUE); + ABID entryID = 0; + + m_pOutliner->GetSelection(indices, count); + AB_AttribID attribs[2] = {AB_attribEntryType, AB_attribFullAddress}; + uint16 numAttribs; + AB_AttributeValue *pEntryValues; + + for (int32 i = 0; i < count; i++) { + // should we stop on error? + char* fullname = NULL; + CString formattedString; + numAttribs = 2; + AB_GetEntryAttributesForPane(m_addrBookPane, indices[i], attribs, + &pEntryValues,&numAttribs); + + AB_EntryType type =AB_Person; + + for(int j = 0; j < numAttribs; j++) + { + switch(pEntryValues[j].attrib) + { + case AB_attribEntryType: type = pEntryValues[j].u.entryType; + break; + case AB_attribFullAddress: fullname = XP_STRDUP(pEntryValues[j].u.string); + break; + } + } + if (fullname){ + AddStringToBucket(pBucket, header, fullname, type, entryID); + } + AB_FreeEntryAttributeValues(pEntryValues, numAttribs); + + } + CEdit *widget = (CEdit*) GetDlgItem(IDC_ADDRNAME); + if (widget) + widget->SetSel(0, -1, TRUE); + pBucket->EnableWindow (TRUE); + SendMessage(DM_SETDEFID, IDC_DONE_EDITING, TRUE); + GetDlgItem(IDC_DONE_EDITING)->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + GetDlgItem(m_idefButtonID)->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); +} + +void CAddrDialog::AddStringToBucket +(CListBox *pBucket, MSG_HEADER_SET header, char* fullname, AB_EntryType type, ABID entryID) +{ + CString formattedString; + switch (header) { + case MSG_TO_HEADER_MASK: + formattedString.Format(XP_GetString(MK_ADDR_TONAME), fullname); + break; + case MSG_CC_HEADER_MASK: + formattedString.Format(XP_GetString(MK_ADDR_CCNAME), fullname); + break; + case MSG_BCC_HEADER_MASK: + formattedString.Format(XP_GetString(MK_ADDR_BCCNAME), fullname); + break; + default: + formattedString.Format(XP_GetString(MK_ADDR_TONAME), fullname); + } + + if (pBucket->FindStringExact(0, (LPCTSTR) formattedString ) == LB_ERR) { + int idx = pBucket->AddString(formattedString); + if ((idx != LB_ERR) || (idx != LB_ERRSPACE)) + { + NSADDRESSLIST *pAddress = new NSADDRESSLIST; + ASSERT(pAddress); + pAddress->ulHeaderType = header; + + if (type == ABTypeList) + pAddress->idBitmap = IDB_MAILINGLIST; + else + pAddress->idBitmap = IDB_PERSON; + + pAddress->idEntry = entryID; + pAddress->szAddress = fullname; + pBucket->SetItemDataPtr( idx, pAddress ); + } + } + int total = pBucket->GetCount(); + if (total) + { + GetDlgItem(IDC_DONE_EDITING)->EnableWindow(TRUE); + pBucket->SetCurSel(total - 1); + } + else + GetDlgItem(IDC_DONE_EDITING)->EnableWindow(FALSE); +} + + +void CAddrDialog::OnRemove() +{ + CListBox *pBucket = GetBucket(); + int prevSel = pBucket->GetCurSel(); + if (prevSel != -1) + { + NSADDRESSLIST * pAddress = (NSADDRESSLIST *)(pBucket->GetItemDataPtr(prevSel)); + if (pAddress->szAddress) + free (pAddress->szAddress); + delete pAddress; + + int count = pBucket->DeleteString (prevSel); + if (count) { + if (prevSel) + pBucket->SetCurSel (prevSel - 1); + else + pBucket->SetCurSel (prevSel); + } + OnSelchange(); + } +} + + +void CAddrDialog::OnComposeMsg() +{ + MoveSelections(MSG_TO_HEADER_MASK); + m_idefButtonID = IDC_TO; +} + + +void CAddrDialog::OnComposeCCMsg() +{ + MoveSelections(MSG_CC_HEADER_MASK); + m_idefButtonID = IDC_CC; +} + + +void CAddrDialog::OnComposeBCCMsg() +{ + MoveSelections(MSG_BCC_HEADER_MASK); + m_idefButtonID = IDC_BCC; +} + + +void CAddrDialog::OnGetProperties() +{ + MSG_ViewIndex *indices; + int count; + HWND hwndFocus = ::GetFocus(); + + + HWND hwndDirOutliner = m_pDirOutliner ? m_pDirOutliner->m_hWnd : NULL; + HWND hwndOutliner = m_pOutliner ? m_pOutliner->m_hWnd : NULL; + if (hwndFocus == hwndDirOutliner) + { + m_pDirOutliner->GetSelection(indices, count); + HandleErrorReturn(AB_CommandAB2 (m_addrContPane, AB_PropertiesCmd, indices, count)); + } + else + { + m_pOutliner->GetSelection(indices, count); + HandleErrorReturn(AB_CommandAB2 (m_addrBookPane, AB_PropertiesCmd, indices, count)); + } +} + +void CAddrDialog::HandleErrorReturn(int errorid) +{ + if (errorid) { + CString s; + if (s.LoadString( IDS_BOOKMARK_ADDRESSPROPERTIES )) + ::MessageBox(NULL, XP_GetString(errorid), s, MB_OK); + } +} + + +void CAddrDialog::PerformChangeDirectory (int dirIndex) +{ + DIR_Server* dir = GetCurrentDirectoryServer(); + AB_ContainerInfo *pCurrentContainerInfo = AB_GetContainerForIndex(m_addrContPane, dirIndex); + HandleErrorReturn(AB_ChangeABContainer(m_addrBookPane, pCurrentContainerInfo)); + m_pOutliner->SetDirectoryIndex(dirIndex); + DoUpdateWidget(IDC_DIRSEARCH, AB_LDAPSearchCmd, TRUE); + DoUpdateWidget(IDC_TO, AB_NewMessageCmd, TRUE); + m_pOutliner->UpdateCount( ); + + int idx = m_barStatus.CommandToIndex(IDS_SECURITY_STATUS); + if (idx > -1) { + UINT nID = IDS_SECURITY_STATUS; + UINT nStyle; + int nWidth; + m_barStatus.GetPaneInfo( idx, nID, nStyle, nWidth ); + if (dir->isSecure) + m_barStatus.SetPaneInfo(idx, IDS_SECURITY_STATUS, SBPS_NORMAL, nWidth); + else + m_barStatus.SetPaneInfo(idx, IDS_SECURITY_STATUS, SBPS_DISABLED, nWidth); + } + UpdateMsgButtons(); +} + + +void CAddrDialog::OnUpdateDirectorySelection (int dirIndex, BOOL indexChanged) +{ + if(indexChanged) + { + CComboBox *widget = (CComboBox*) GetDlgItem(IDC_DIRECTORIES); + widget->SetCurSel(dirIndex); + PerformChangeDirectory(dirIndex); + m_save = ""; + } +} + +AB_ContainerInfo * CAddrDialog::GetCurrentContainerInfo() +{ + return (AB_GetContainerForIndex(m_addrContPane, m_pDirOutliner->GetDirectoryIndex())); +} + +void CAddrDialog::SelectionChanged() +{ + DoUpdateWidget(IDC_TO, AB_NewMessageCmd, TRUE); + UpdateMsgButtons(); + CWnd* widget = NULL; + widget = GetDlgItem (GetDefaultButtonID()); + if (widget) { + SendMessage(DM_SETDEFID, GetDefaultButtonID(), TRUE); + widget->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + widget = GetDlgItem (IDC_DONE_EDITING); + widget->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + } + + +} + +void CAddrDialog::DoubleClick() +{ + SetDefaultButtonID (IDC_TO); + MoveSelections (MSG_TO_HEADER_MASK); +} + +CWnd* CAddrDialog::GetOwnerWindow() +{ + return this; +} + +void CAddrDialog::OnStopSearch () +{ + if ( m_bSearching) { + // We've ended the search + XP_InterruptContext( m_pCX->GetContext() ); + HandleErrorReturn(AB_FinishSearchAB2(m_addrBookPane)); + m_bSearching = FALSE; + GetDlgItem(IDC_DIRECTORIES)->EnableWindow(TRUE); + GetDlgItem( IDC_DIRSEARCH)->EnableWindow(TRUE); + GetDlgItem(ID_NAVIGATE_INTERRUPT)->EnableWindow (FALSE); + m_pDirOutliner->EnableWindow(TRUE); + m_barStatus.StopAnimation(); + if (m_pOutliner->GetTotalLines()) + m_pOutliner->SelectItem (0); + return; + } +} + + + +void CAddrDialog::PerformDirectorySearch () +{ + if ( m_bSearching) { + OnStopSearch (); + return; + } + + + CSearchDialog searchDlg ((UINT) IDS_ADRSEARCH, + (MSG_Pane*) m_addrBookPane, + GetCurrentDirectoryServer(), + this); + int result = searchDlg.DoModal(); + + // Build Search + if (result == IDOK) + { + GetDlgItem(IDC_DIRSEARCH)->EnableWindow (FALSE); + GetDlgItem(ID_NAVIGATE_INTERRUPT)->EnableWindow (TRUE); + GetDlgItem(IDC_DIRECTORIES)->EnableWindow(FALSE); + GetDlgItem(IDC_ADDRNAME)->SetWindowText(""); + + // Build Search + m_barStatus.SetWindowText( szLoadString( IDS_SEARCHING ) ); + m_bSearching = TRUE; + GetDlgItem(IDC_ADDRNAME)->SetWindowText(CString (szLoadString(IDS_SEARCHRESULTS))); + m_pOutliner->UpdateCount(); + m_pOutliner->SetFocus(); + m_pDirOutliner->EnableWindow(FALSE); + + HandleErrorReturn(AB_SearchDirectoryAB2(m_addrBookPane, NULL)); + } + +} + + +////////////////////////////////////////////////////////////////////////////// +// CAddrDialogOutliner +BEGIN_MESSAGE_MAP(CAddrDialogOutliner, CMSelectOutliner) + //{{AFX_MSG_MAP(CAddrDialogOutliner) + ON_WM_KEYDOWN() + ON_WM_TIMER() + ON_WM_KILLFOCUS() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +CAddrDialogOutliner::CAddrDialogOutliner ( ) +{ + m_attribSortBy = ID_COLADDR_NAME; + ApiApiPtr(api); + m_pUnkUserImage = api->CreateClassInstance(APICLASS_IMAGEMAP); + if (m_pUnkUserImage) { + m_pUnkUserImage->QueryInterface(IID_IImageMap,(LPVOID*)&m_pIUserImage); + ASSERT(m_pIUserImage); + m_pIUserImage->Initialize(IDB_ADDRESSBOOK,16,16); + } + m_bSortAscending = TRUE; + m_iMysticPlane = 0; + m_dirIndex = 0; + m_hFont = NULL; + m_uTypedownClock = 0; +} + +CAddrDialogOutliner::~CAddrDialogOutliner ( ) +{ + if (m_pUnkUserImage) { + if (m_pIUserImage) + m_pUnkUserImage->Release(); + } + + if (m_hFont) { + theApp.ReleaseAppFont(m_hFont); + } +} + +DIR_Server* CAddrDialogOutliner::GetCurrentDirectoryServer () +{ + return (DIR_Server*)XP_ListGetObjectNum(theApp.m_directories, m_dirIndex + 1); +} + +void CAddrDialogOutliner::SetDirectoryIndex(int dirIndex ) +{ + m_dirIndex = dirIndex; + DIR_Server* pServer = GetCurrentDirectoryServer (); + int iCount = GetNumColumns(); + for (int i = 0; i < iCount; i++) { + CString cs; + int iColumn = GetColumnAtPos(i); + if (pServer->dirType == LDAPDirectory) + { + DIR_AttributeId id; + const char *text = NULL; + switch (iColumn) { + case ID_COLADDR_TYPE: + text = NULL; + break; + case ID_COLADDR_NAME: + MSG_SearchAttribToDirAttrib(attribCommonName, &id); + text = DIR_GetAttributeName(pServer, id); + break; + case ID_COLADDR_EMAIL: + MSG_SearchAttribToDirAttrib(attrib822Address, &id); + text = DIR_GetAttributeName(pServer, id); + break; + case ID_COLADDR_COMPANY: + MSG_SearchAttribToDirAttrib(attribOrganization, &id); + text = DIR_GetAttributeName(pServer, id); + break; + case ID_COLADDR_PHONE: + MSG_SearchAttribToDirAttrib(attribPhoneNumber, &id); + text = DIR_GetAttributeName(pServer, id); + break; + case ID_COLADDR_LOCALITY: + MSG_SearchAttribToDirAttrib(attribLocality, &id); + text = DIR_GetAttributeName(pServer, id); + break; + case ID_COLADDR_NICKNAME: + text = NULL; + break; + default: + break; + } + if (text) + SetColumnName(iColumn, text); + } + else + { + switch (iColumn) { + case ID_COLADDR_TYPE: + cs = ""; + break; + case ID_COLADDR_NAME: + cs.LoadString(IDS_USERNAME); + break; + case ID_COLADDR_EMAIL: + cs.LoadString(IDS_EMAILADDRESS); + break; + case ID_COLADDR_COMPANY: + cs.LoadString(IDS_COMPANYNAME); + break; + case ID_COLADDR_PHONE: + cs.LoadString(IDS_PHONE); + break; + case ID_COLADDR_LOCALITY: + cs.LoadString(IDS_LOCALITY); + break; + case ID_COLADDR_NICKNAME: + cs.LoadString(IDS_NICKNAME); + break; + default: + break; + } + if (cs.GetLength()) + SetColumnName(iColumn, cs); + } + } + GetParent()->Invalidate(); + GetParent()->UpdateWindow(); + ClearSelection(); + if (m_iTotalLines) + SelectItem (0); +} + + +void CAddrDialogOutliner::OnTimer(UINT nID) +{ + CMSelectOutliner::OnTimer(nID); + if (nID == ADDRDLG_OUTLINER_TYPEDOWN_TIMER) { + KillTimer(m_uTypedownClock); + m_psTypedown = ""; + } +} + +void CAddrDialogOutliner::OnKeyDown ( UINT nChar, UINT nRepCnt, UINT nFlags ) +{ + CMSelectOutliner::OnKeyDown ( nChar, nRepCnt, nFlags ); + KillTimer(m_uTypedownClock); + if (nChar > VK_HELP) { + KillTimer(m_uTypedownClock); + m_psTypedown += nChar; + OnTypedown (m_psTypedown.GetBuffer (0)); + m_psTypedown.ReleaseBuffer(-1); + int32 prefInt = OUTLINER_TYPEDOWN_SPEED; + PREF_GetIntPref("ldap_1.autoComplete.interval", &prefInt); + m_uTypedownClock = SetTimer(ADDRDLG_OUTLINER_TYPEDOWN_TIMER, prefInt, NULL); + } +} + +void CAddrDialogOutliner::OnKillFocus( CWnd* pNewWnd ) +{ + CMSelectOutliner::OnKillFocus (pNewWnd ); + m_psTypedown = ""; + KillTimer(m_uTypedownClock); +} + + +void CAddrDialogOutliner::OnTypedown (char* name) +{ + MSG_ViewIndex index; + uint startIndex; + + if (GetFocusLine() != -1) + startIndex = GetFocusLine(); + else + startIndex = 0; + + AB_GetIndexMatchingTypedown(m_pane, &index, + (LPCTSTR) name, startIndex); + ScrollIntoView(CASTINT(index)); + SelectItem (CASTINT(index)); +} + +void CAddrDialogOutliner::UpdateCount( ) +{ + uint32 count; + + AB_GetEntryCount(GetCurrentDirectoryServer (), theApp.m_pABook, &count, ABTypeAll, NULL); + SetTotalLines(CASTINT(count)); +} + + +void CAddrDialogOutliner::SetPane(ABPane *pane) +{ + m_pane = pane; + uint32 count; + + if (m_pane) { + AB_GetEntryCount(GetCurrentDirectoryServer (), theApp.m_pABook, &count, ABTypeAll, NULL); + SetTotalLines(CASTINT(count)); + Invalidate(); + UpdateWindow(); + } +} + +void CAddrDialogOutliner::MysticStuffStarting( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num ) +{ + ++m_iMysticPlane; +} + +void CAddrDialogOutliner::MysticStuffFinishing( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num ) +{ + +#ifdef _WIN32 + CWnd *pParent = GetParentOwner(); +#else + CWnd *pParent = GetOwner(); + pParent = pParent->GetParent(); + ASSERT(pParent); +#endif + + switch ( notify ) + { + + case MSG_NotifyNone: + break; + + case MSG_NotifyInsertOrDelete: + // if its insert or delete then tell my frame to add the next chunk of values + // from the search + if (notify == MSG_NotifyInsertOrDelete + && ((CAddrDialog*)pParent)->IsSearching() && num > 0) + { + ((CAddrDialog*)pParent)->SetSearchResults(where, num); + HandleInsert(where, num); + } + else + { + if (num > 0) + HandleInsert(where, num); + else + HandleDelete(where, -num); + } + break; + + case MSG_NotifyChanged: + InvalidateLines( (int) where, (int) num ); + break; + + case MSG_NotifyAll: + case MSG_NotifyScramble: + Invalidate(); + break; + } + + if (( !--m_iMysticPlane && m_pane)) + { + uint32 count; + AB_GetEntryCount(GetCurrentDirectoryServer (), theApp.m_pABook, &count, ABTypeAll, NULL); + SetTotalLines(CASTINT(count)); + Invalidate(); + UpdateWindow(); + } +} + + +void CAddrDialogOutliner::SetTotalLines( int count) +{ + CMSelectOutliner::SetTotalLines(count); + if (count = 0) + ClearSelection(); +} + + + + +BOOL CAddrDialogOutliner::RenderData ( UINT iColumn, CRect &rect, CDC &dc, const char * text ) +{ + if ( iColumn != ID_COLADDR_TYPE ) + return CMSelectOutliner::RenderData ( iColumn, rect, dc, text ); + + int idxImage = 0; + + if (m_EntryLine.entryType == ABTypeList) + idxImage = IDX_ADDRESSBOOKLIST; + else + idxImage = IDX_ADDRESSBOOKPERSON; + + m_pIUserImage->DrawImage ( idxImage, + rect.left + ( ( rect.Width ( ) - 16 ) / 2 ), rect.top, &dc, FALSE ); + return TRUE; +} + + +int CAddrDialogOutliner::TranslateIcon ( void * pLineData ) +{ + AB_EntryLine* line = (AB_EntryLine*) pLineData; + int idxImage = 0; + + if (line->entryType == ABTypeList) + idxImage = IDX_ADDRESSBOOKLIST; + else + idxImage = IDX_ADDRESSBOOKPERSON; + return idxImage; +} + +int CAddrDialogOutliner::TranslateIconFolder (void * pData) +{ + // We're a flat list, so we're never a folder + return ( OUTLINER_ITEM ); +} + + +BOOL CAddrDialogOutliner::ColumnCommand ( int iColumn, int iLine ) +{ + // We have no column commands + return FALSE; +} + +HFONT CAddrDialogOutliner::GetLineFont(void *pLineData) +{ + if (!m_hFont) + { + HDC hDC = ::GetDC(m_hWnd); + LOGFONT lf; + memset(&lf,0,sizeof(LOGFONT)); + + lf.lfPitchAndFamily = FF_SWISS; + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = IntlGetLfCharset(CIntlWin::GetSystemLocaleCsid()); + if (CIntlWin::GetSystemLocaleCsid() == CS_LATIN1) + _tcscpy(lf.lfFaceName, "MS Sans Serif"); + else + _tcscpy(lf.lfFaceName, IntlGetUIPropFaceName(CIntlWin::GetSystemLocaleCsid())); + lf.lfHeight = -MulDiv(9, ::GetDeviceCaps(hDC, LOGPIXELSY), 72); + m_hFont = theApp.CreateAppFont( lf ); + ::ReleaseDC(m_hWnd,hDC); + } + return m_hFont; +} + + +void * CAddrDialogOutliner::AcquireLineData ( int line ) +{ + if ( line >= m_iTotalLines) + return NULL; + if (!AB_GetEntryLine(m_pane, line, &m_EntryLine )) + return NULL; + + return &m_EntryLine; +} + + +void CAddrDialogOutliner::GetTreeInfo ( int iLine, uint32 * pFlags, int * pDepth, OutlinerAncestorInfo ** pAncestor ) +{ + if ( pFlags ) *pFlags = 0; // Flags? + if ( pDepth ) *pDepth = 0; // We're flat, remember? +} + + +void CAddrDialogOutliner::ReleaseLineData ( void * ) +{ +} + + +LPCTSTR CAddrDialogOutliner::GetColumnText ( UINT iColumn, void * pLineData ) +{ + AB_EntryLine* line = (AB_EntryLine*) pLineData; + + switch (iColumn) { + case ID_COLADDR_NAME: + return line->fullname; + break; + case ID_COLADDR_EMAIL: + return line->emailAddress; + break; + case ID_COLADDR_COMPANY: + return line->companyName; + break; + case ID_COLADDR_PHONE: + if (line->entryType == ABTypePerson) + return line->workPhone; + break; + case ID_COLADDR_LOCALITY: + return line->locality; + break; + case ID_COLADDR_NICKNAME: + return line->nickname; + break; + default: + break; + } + return (""); +} + +void CAddrDialogOutliner::OnSelChanged() +{ +#ifdef _WIN32 + CWnd *pParent = GetParentOwner(); +#else + CWnd *pParent = GetOwner(); + pParent = pParent->GetParent(); + ASSERT(pParent); +#endif + ((CAddrDialog*) pParent)->DoUpdateWidget(IDC_TO, AB_NewMessageCmd, TRUE); + ((CAddrDialog*) pParent)->UpdateMsgButtons(); + CWnd* widget = NULL; + widget = ((CAddrDialog*) pParent)->GetDlgItem (((CAddrDialog*) pParent)->GetDefaultButtonID()); + if (widget) { + SendMessage(DM_SETDEFID, ((CAddrDialog*) pParent)->GetDefaultButtonID(), TRUE); + widget->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + widget = ((CAddrDialog*) pParent)->GetDlgItem (IDC_DONE_EDITING); + widget->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + } +} + +void CAddrDialogOutliner::OnSelDblClk() +{ +#ifdef _WIN32 + CWnd *pParent = GetParentOwner(); +#else + CWnd *pParent = GetOwner(); + pParent = pParent->GetParent(); + ASSERT(pParent); +#endif + + ((CAddrDialog*) pParent)->SetDefaultButtonID (IDC_TO); + ((CAddrDialog*) pParent)->MoveSelections (MSG_TO_HEADER_MASK); +} + +///////////////////////////////////////////////////////////////////////////// +// CAddrOutlinerParent + +BEGIN_MESSAGE_MAP(CAddrDialogOutlinerParent, COutlinerParent) + //{{AFX_MSG_MAP(CAddrDialogOutlinerParent) + ON_WM_LBUTTONUP() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +CAddrDialogOutlinerParent::CAddrDialogOutlinerParent() +{ + +} + + +CAddrDialogOutlinerParent::~CAddrDialogOutlinerParent() +{ +} + + +BOOL CAddrDialogOutlinerParent::RenderData ( int idColumn, CRect & rect, CDC &dc, const char * text ) +{ + int cx = 3, cy = 0; + CAddrDialogOutliner *pOutliner = (CAddrDialogOutliner *) m_pOutliner; + + // Calculate text offset from top using font height. + TEXTMETRIC tm; + dc.GetTextMetrics ( &tm ); + cy = ( rect.bottom - rect.top - tm.tmHeight ) / 2; + + // Draw Text String + dc.TextOut (rect.left + cx, rect.top + cy, text, _tcslen(text) ); + + // Draw Sort Indicator + MSG_COMMAND_CHECK_STATE sortType = pOutliner->m_attribSortBy == idColumn ? MSG_Checked : MSG_Unchecked; + + int idxImage = pOutliner->m_bSortAscending ? IDX_SORTINDICATORDOWN : IDX_SORTINDICATORUP; + CSize cs = dc.GetTextExtent(text, _tcslen(text)); + + if (idColumn == pOutliner->m_attribSortBy && cs.cx + 22 <= rect.Width()) { + m_pIImage->DrawTransImage( idxImage, + rect.left + 8 + cs.cx, + (rect.top + rect.bottom) / 2 - 4, + &dc ); + } + + return TRUE; +} + + +COutliner * CAddrDialogOutlinerParent::GetOutliner ( void ) +{ + return new CAddrDialogOutliner; +} + + +void CAddrDialogOutlinerParent::CreateColumns ( void ) +{ + CString cs; + + m_pOutliner->AddColumn ("", ID_COLADDR_TYPE, 24, 0, ColumnFixed, 0, TRUE ); + cs.LoadString(IDS_USERNAME); + m_pOutliner->AddColumn (cs, ID_COLADDR_NAME, 175, 0, ColumnVariable, 1500); + cs.LoadString(IDS_EMAILADDRESS); + m_pOutliner->AddColumn (cs, ID_COLADDR_EMAIL, 175, 0, ColumnVariable, 1500); + cs.LoadString(IDS_COMPANYNAME); + m_pOutliner->AddColumn (cs, ID_COLADDR_COMPANY, 175, 0, ColumnVariable, 1500 ); + cs.LoadString(IDS_PHONE); + m_pOutliner->AddColumn (cs, ID_COLADDR_PHONE, 175, 0, ColumnVariable, 1500, FALSE); + cs.LoadString(IDS_LOCALITY); + m_pOutliner->AddColumn (cs, ID_COLADDR_LOCALITY, 175, 0, ColumnVariable, 1500 ); + cs.LoadString(IDS_NICKNAME); + m_pOutliner->AddColumn (cs, ID_COLADDR_NICKNAME, 175, 0, ColumnVariable, 1500 ); + m_pOutliner->SetHasPipes( FALSE ); + + m_pOutliner->SetVisibleColumns(DEF_VISIBLE_COLUMNS); + m_pOutliner->LoadXPPrefs("mailnews.abook_columns_win"); + +} + + +BOOL CAddrDialogOutlinerParent::ColumnCommand ( int idColumn ) +{ + ABID lastSelection; + + CAddrDialogOutliner *pOutliner = (CAddrDialogOutliner *) m_pOutliner; + + if (pOutliner->GetFocusLine() != -1) + lastSelection = AB_GetEntryIDAt((AddressPane*) pOutliner->GetPane(), pOutliner->GetFocusLine()); + + SetCursor ( theApp.LoadStandardCursor ( IDC_WAIT ) ); + + if (idColumn == pOutliner->m_attribSortBy) { + pOutliner->m_bSortAscending = !pOutliner->m_bSortAscending; + } + else + pOutliner->m_bSortAscending = TRUE; + + pOutliner->m_attribSortBy = idColumn; + + switch (idColumn) { + case ID_COLADDR_TYPE: + AB_Command(pOutliner->GetPane(), AB_SortByTypeCmd, 0, 0); + break; + case ID_COLADDR_NAME: + AB_Command(pOutliner->GetPane(), AB_SortByFullNameCmd, 0, 0); + break; + case ID_COLADDR_NICKNAME: + AB_Command(pOutliner->GetPane(), AB_SortByNickname, 0, 0); + break; + case ID_COLADDR_LOCALITY: + AB_Command(pOutliner->GetPane(), AB_SortByLocality, 0, 0); + break; + case ID_COLADDR_COMPANY: + AB_Command(pOutliner->GetPane(), AB_SortByCompanyName, 0, 0); + break; + case ID_COLADDR_EMAIL: + AB_Command(pOutliner->GetPane(), AB_SortByEmailAddress, 0, 0); + break; + default: + AB_Command(pOutliner->GetPane(), AB_SortByFullNameCmd, 0, 0); + break; + } + + + if (pOutliner->GetFocusLine() != -1) { + uint index = CASTUINT(AB_GetIndexOfEntryID ((AddressPane*) pOutliner->GetPane(), lastSelection)); + pOutliner->SelectItem (index); + pOutliner->ScrollIntoView(index); + } + + Invalidate(); + pOutliner->Invalidate(); + SetCursor ( theApp.LoadStandardCursor ( IDC_ARROW ) ); + return TRUE; +} + +void CAddrDialogOutlinerParent::OnLButtonUp( UINT nFlags, CPoint point ) +{ + BOOL bSaveColumns = (m_pOutliner && + (m_bResizeColumn || m_bDraggingHeader || m_iPusherHit))? TRUE : FALSE; + COutlinerParent::OnLButtonUp(nFlags, point); + if (bSaveColumns) + m_pOutliner->SaveXPPrefs("mailnews.abook_columns_win"); +} + + + +////////////////////////////////////////////////////////////////////////////// +// CAddrDialogDirOutliner +BEGIN_MESSAGE_MAP(CAddrDialogDirOutliner, CMSelectOutliner) + //{{AFX_MSG_MAP(CAddrDialogDirOutliner) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +CAddrDialogDirOutliner::CAddrDialogDirOutliner ( ) +{ + ApiApiPtr(api); + m_pUnkUserImage = api->CreateClassInstance(APICLASS_IMAGEMAP); + if (m_pUnkUserImage) { + m_pUnkUserImage->QueryInterface(IID_IImageMap,(LPVOID*)&m_pIUserImage); + ASSERT(m_pIUserImage); + m_pIUserImage->Initialize(IDB_DIRLIST,16,16); + } + m_iMysticPlane = 0; + m_dirIndex = 0; + m_hFont = NULL; +} + +CAddrDialogDirOutliner::~CAddrDialogDirOutliner ( ) +{ + if (m_pUnkUserImage) { + if (m_pIUserImage) + m_pUnkUserImage->Release(); + } + + if (m_hFont) { + theApp.ReleaseAppFont(m_hFont); + } +} + + +void CAddrDialogDirOutliner::SetDirectoryIndex(int dirIndex ) +{ + m_dirIndex = dirIndex; + SelectItem (CASTINT(m_dirIndex)); +} + + +void CAddrDialogDirOutliner::UpdateCount( ) +{ + m_iTotalLines = XP_ListCount (theApp.m_directories); + if (!m_iTotalLines) + ClearSelection(); + Invalidate(); + UpdateWindow(); +} + + +void CAddrDialogDirOutliner::SetPane(ABPane *pane) +{ + m_pane = pane; + + if (m_pane) { + SetTotalLines(XP_ListCount (theApp.m_directories)); + Invalidate(); + UpdateWindow(); + } +} + +void CAddrDialogDirOutliner::MysticStuffStarting( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num ) +{ + ++m_iMysticPlane; +} + +void CAddrDialogDirOutliner::MysticStuffFinishing( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num ) +{ + +#ifdef _WIN32 + CWnd *pParent = GetParentOwner(); +#else + CWnd *pParent = GetOwner(); + pParent = pParent->GetParent(); + ASSERT(pParent); +#endif + + switch ( notify ) + { + + case MSG_NotifyNone: + break; + + case MSG_NotifyInsertOrDelete: + // if its insert or delete then tell my frame to add the next chunk of values + // from the search + if (num > 0) + HandleInsert(where, num); + else + HandleDelete(where, -num); + + break; + + case MSG_NotifyChanged: + InvalidateLines( (int) where, (int) num ); + break; + + case MSG_NotifyAll: + case MSG_NotifyScramble: + Invalidate(); + break; + } + + if (( !--m_iMysticPlane && m_pane)) { + SetTotalLines(XP_ListCount (theApp.m_directories)); + Invalidate(); + UpdateWindow(); + } +} + + +void CAddrDialogDirOutliner::SetTotalLines( int count) +{ + CMSelectOutliner::SetTotalLines(count); + if (count = 0) + ClearSelection(); +} + + + + +BOOL CAddrDialogDirOutliner::RenderData ( UINT iColumn, CRect &rect, CDC &dc, const char * text ) +{ + if ( iColumn != ID_COLDIR_TYPE ) + return CMSelectOutliner::RenderData ( iColumn, rect, dc, text ); + int idxImage; + + if (m_pDirLine->dirType == LDAPDirectory) + idxImage = IDX_DIRLDAPAB; + else + idxImage = IDX_DIRPERSONALAB; + + m_pIUserImage->DrawImage ( idxImage, + rect.left + ( ( rect.Width ( ) - 16 ) / 2 ), rect.top, &dc, FALSE ); + return TRUE; +} + + +int CAddrDialogDirOutliner::TranslateIcon ( void * pLineData ) +{ + DIR_Server* line = (DIR_Server*) pLineData; + int idxImage = 0; + + if (m_pDirLine->dirType == ABTypeList) + idxImage = IDX_DIRLDAPAB; + else + idxImage = IDX_DIRPERSONALAB; + return idxImage; +} + +int CAddrDialogDirOutliner::TranslateIconFolder (void * pData) +{ + // We're a flat list, so we're never a folder + return ( OUTLINER_ITEM ); +} + + +BOOL CAddrDialogDirOutliner::ColumnCommand ( int iColumn, int iLine ) +{ + // We have no column commands + return FALSE; +} + +HFONT CAddrDialogDirOutliner::GetLineFont(void *pLineData) +{ + if (!m_hFont) + { + HDC hDC = ::GetDC(m_hWnd); + LOGFONT lf; + memset(&lf,0,sizeof(LOGFONT)); + + lf.lfPitchAndFamily = FF_SWISS; + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = IntlGetLfCharset(CIntlWin::GetSystemLocaleCsid()); + if (CIntlWin::GetSystemLocaleCsid() == CS_LATIN1) + _tcscpy(lf.lfFaceName, "MS Sans Serif"); + else + _tcscpy(lf.lfFaceName, IntlGetUIPropFaceName(CIntlWin::GetSystemLocaleCsid())); + lf.lfHeight = -MulDiv(9, ::GetDeviceCaps(hDC, LOGPIXELSY), 72); + m_hFont = theApp.CreateAppFont( lf ); + ::ReleaseDC(m_hWnd,hDC); + } + return m_hFont; +} + + +void * CAddrDialogDirOutliner::AcquireLineData ( int line ) +{ + if ( line >= m_iTotalLines) + return NULL; + m_pDirLine = (DIR_Server*) XP_ListGetObjectNum(theApp.m_directories, line + 1); + + return m_pDirLine; +} + + +void CAddrDialogDirOutliner::GetTreeInfo ( int iLine, uint32 * pFlags, int * pDepth, OutlinerAncestorInfo ** pAncestor ) +{ + if ( pFlags ) *pFlags = 0; // Flags? + if ( pDepth ) *pDepth = 0; // We're flat, remember? +} + + +void CAddrDialogDirOutliner::ReleaseLineData ( void * ) +{ +} + + +LPCTSTR CAddrDialogDirOutliner::GetColumnText ( UINT iColumn, void * pLineData ) +{ + DIR_Server* line = (DIR_Server*) pLineData; + + switch (iColumn) { + case ID_COLDIR_NAME: + return line->description; + break; + default: + break; + } + return (""); +} + +void CAddrDialogDirOutliner::OnSelChanged() +{ +#ifdef _WIN32 + CWnd *pParent = GetParentOwner(); +#else + CWnd *pParent = GetOwner(); + pParent = pParent->GetParent(); + ASSERT(pParent); +#endif + MSG_ViewIndex *indices; + int count; + + if (((CAddrDialog*) pParent)->IsSearching()) + return; + + GetSelection(indices, count); + + if (count == 1) + ((CAddrDialog*) pParent)->OnUpdateDirectorySelection(indices[0], TRUE); +} + +void CAddrDialogDirOutliner::OnSelDblClk() +{ + +} + +///////////////////////////////////////////////////////////////////////////// +// CAddrOutlinerParent + +BEGIN_MESSAGE_MAP(CAddrDialogDirOutlinerParent, COutlinerParent) + //{{AFX_MSG_MAP(CAddrDialogDirOutlinerParent) + ON_WM_LBUTTONUP() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +CAddrDialogDirOutlinerParent::CAddrDialogDirOutlinerParent() +{ + +} + + +CAddrDialogDirOutlinerParent::~CAddrDialogDirOutlinerParent() +{ +} + + +BOOL CAddrDialogDirOutlinerParent::RenderData ( int idColumn, CRect & rect, CDC &dc, const char * text ) +{ + int cx = 3, cy = 0; + CAddrDialogDirOutliner *pOutliner = (CAddrDialogDirOutliner *) m_pOutliner; + + // Calculate text offset from top using font height. + TEXTMETRIC tm; + dc.GetTextMetrics ( &tm ); + cy = ( rect.bottom - rect.top - tm.tmHeight ) / 2; + + // Draw Text String + dc.TextOut (rect.left + cx, rect.top + cy, text, _tcslen(text) ); + + return TRUE; +} + + +COutliner * CAddrDialogDirOutlinerParent::GetOutliner ( void ) +{ + return new CAddrDialogDirOutliner; +} + + +void CAddrDialogDirOutlinerParent::CreateColumns ( void ) +{ + + int iCol0 = 0, + iCol1 = 0; + CString cs; + + m_pOutliner->AddColumn ("", ID_COLDIR_TYPE, 24, 0, ColumnFixed, 0, TRUE ); + cs.LoadString(IDS_USERNAME); + m_pOutliner->AddColumn (cs, ID_COLDIR_NAME, 1500, 0, ColumnVariable, iCol0 ? iCol0 : 1500 ); + m_pOutliner->SetHasPipes( FALSE ); + + m_pOutliner->SetVisibleColumns(DEF_DIRVISIBLE_COLUMNS); + m_pOutliner->LoadXPPrefs("mailnews.abook_dir_columns_win"); + +} + + +void CAddrDialogDirOutlinerParent::OnLButtonUp( UINT nFlags, CPoint point ) +{ + BOOL bSaveColumns = (m_pOutliner && + (m_bResizeColumn || m_bDraggingHeader || m_iPusherHit))? TRUE : FALSE; + COutlinerParent::OnLButtonUp(nFlags, point); + if (bSaveColumns) + m_pOutliner->SaveXPPrefs("mailnews.abook_dir_columns_win"); +} + + + +void CAddrDialog::OnHelp() +{ + NetHelp(HELP_SELECT_ADDRESSES); +} + + +BOOL CAddrDialog::IsDragInListBox(CPoint *pPoint) +{ + CRect listRect; + + CListBox *pBucket = GetBucket(); + pBucket->GetWindowRect(LPRECT(listRect)); + ScreenToClient(LPRECT(listRect)); + if (listRect.PtInRect(*pPoint)) + return TRUE; + else + return FALSE; +} + +BOOL CAddrDialog::ProcessVCardData(COleDataObject * pDataObject, CPoint &point) +{ + UINT clipFormat; + BOOL retVal = TRUE;; + CWnd * pWnd = GetFocus(); + XP_List * pEntries; + int32 iEntries; + + if (pDataObject->IsDataAvailable( + clipFormat = ::RegisterClipboardFormat(vCardClipboardFormat))) + { + HGLOBAL hAddresses = pDataObject->GetGlobalData(clipFormat); + LPSTR pAddresses = (LPSTR)GlobalLock(hAddresses); + ASSERT(pAddresses); + if (!AB_ConvertVCardsToExpandedName(theApp.m_pABook,pAddresses,&pEntries,&iEntries)) + { + CListBox *pBucket = GetBucket(); + + XP_List * node = pEntries; + for (int32 i = 0; i < iEntries+1; i++) + { + char * pString = (char *)node->object; + if (pString != NULL) + AddStringToBucket(pBucket, MSG_TO_HEADER_MASK, pString, AB_Person, -1); + node = node->next; + if (!node) + break; + } + XP_ListDestroy(pEntries); + } + } + + if (pWnd && ::IsWindow(pWnd->m_hWnd)) + pWnd->SetFocus(); + return retVal; +} + +void CAddrDialog::UpdateMsgButtons() +{ + if (m_pOutliner) + { + MSG_ViewIndex *indices; + int count; + BOOL bEnable; + + m_pOutliner->GetSelection(indices, count); + bEnable = (count > 0) ? TRUE : FALSE; + GetDlgItem(IDC_TO)->EnableWindow(bEnable); + GetDlgItem(IDC_CC)->EnableWindow(bEnable); + GetDlgItem(IDC_BCC)->EnableWindow(bEnable); +#ifdef MOZ_NEWADDR + GetDlgItem(ID_ITEM_PROPERTIES)->EnableWindow(bEnable); +#else + //leave disabled for now. + GetDlgItem(ID_ITEM_PROPERTIES)->EnableWindow(FALSE); +#endif + } + DoUpdateWidget(IDC_DIRSEARCH, AB_LDAPSearchCmd, TRUE); + if (m_bSearching) + GetDlgItem(ID_NAVIGATE_INTERRUPT)->EnableWindow(TRUE); + else + GetDlgItem(ID_NAVIGATE_INTERRUPT)->EnableWindow(FALSE); +} + +////////////////////////////////////////////////////////////////////////////// +// CAddressPickerDropTarget + +DROPEFFECT CAddressPickerDropTarget::OnDragOver(CWnd * pWnd, + COleDataObject * pDataObject, DWORD dwKeyState, CPoint point) +{ + DROPEFFECT deReturn = DROPEFFECT_NONE; + // Only interested in vcard + if(pDataObject->IsDataAvailable( + ::RegisterClipboardFormat(vCardClipboardFormat)) ) + { + if (m_pOwner->IsDragInListBox(&point)) + deReturn = DROPEFFECT_COPY; + } + return(deReturn); +} + +BOOL CAddressPickerDropTarget::OnDrop +(CWnd * pWnd, COleDataObject * pDataObject, DROPEFFECT, CPoint point) +{ + if (pDataObject->IsDataAvailable(::RegisterClipboardFormat(vCardClipboardFormat)) ) + { + return m_pOwner->ProcessVCardData(pDataObject,point); + } + return FALSE; +} + + + + +#else //MOZ_NEWADDR + +#include "msg_srch.h" +#include "dirprefs.h" +#include "apiaddr.h" +#include "nethelp.h" +#include "prefapi.h" +#include "intl_csi.h" +#include "srchdlg.h" + #ifdef _DEBUG #undef THIS_FILE @@ -492,8 +3139,8 @@ BOOL CAddrDialog::OnInitDialog( ) m_pDirOutliner->SetPane(m_addrBookPane); m_pDirOutliner->SetDirectoryIndex(0); - // 4 seems to work with all the beveled border - int32 prefInt = 4; + // set the width of the panes in the slider + int32 prefInt = -1; PREF_GetIntPref("mail.addr_picker.sliderwidth", &prefInt); RECT rect; GetClientRect(&rect); @@ -861,17 +3508,21 @@ void CAddrDialog::DoDataExchange(CDataExchange* pDX) void CAddrDialog::OnChangeName() { + UpdateData(TRUE); + // TODO: Add your control notification handler code here if (IsSearching()) { - OnDirectorySearch(); - SendMessage(DM_SETDEFID, m_idefButtonID, TRUE); - GetDlgItem(m_idefButtonID)->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); - GetDlgItem(IDC_DONE_EDITING)->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); - return; + CString checkName (szLoadString(IDS_SEARCHRESULTS)); + if (stricmp (checkName, m_name) != 0) { + OnDirectorySearch(); + SendMessage(DM_SETDEFID, m_idefButtonID, TRUE); + GetDlgItem(m_idefButtonID)->SendMessage(BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0)); + GetDlgItem(IDC_DONE_EDITING)->SendMessage(BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); + } + else + return; } - UpdateData(TRUE); - if (m_name != m_save) { m_save = m_name; KillTimer(m_uTypedownClock); @@ -999,6 +3650,13 @@ void CAddrDialog::OnDirectorySearch() PerformDirectorySearch(); } +int CAddrDialog::DoModal () +{ + if (!m_MailNewsResourceSwitcher.Initialize()) + return -1; + return CDialog::DoModal(); +} + int CAddrDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) { @@ -1372,7 +4030,7 @@ void CAddrDialog::OnGetProperties() if (pOutliner) { pOutliner->GetSelection(indices, count); - // AB_Command(pOutliner->GetPane(), AB_ImportLdapEntriesCmd, indices, count); + // AB_Command(pOutliner->GetPane(), AB_ImportLdapEntriesCmd, indices, count); } } @@ -1430,7 +4088,7 @@ void CAddrDialog::OnStopSearch () GetDlgItem(ID_NAVIGATE_INTERRUPT)->EnableWindow (FALSE); m_pDirOutliner->EnableWindow(TRUE); m_barStatus.StopAnimation(); - if (m_pOutliner->GetTotalLines() && (m_pOutliner->GetFocusLine() != -1)) + if (m_pOutliner->GetTotalLines()) m_pOutliner->SelectItem (0); return; } @@ -1445,17 +4103,11 @@ void CAddrDialog::PerformDirectorySearch () return; } - CUIntArray buttonLabels; - buttonLabels.SetSize (4, 1); - buttonLabels [0] = IDS_SEARCH_PROMPT; - buttonLabels [1] = IDS_CANCEL_BUTTON; - buttonLabels [2] = IDS_HELP_BUTTON; - buttonLabels [3] = IDS_ADVSEARCH; CSearchDialog searchDlg ((UINT) IDS_ADRSEARCH, (MSG_Pane*) m_addrBookPane, GetCurrentDirectoryServer(), - this, 4, BUTTON_RIGHT, &buttonLabels); + this); int result = searchDlg.DoModal(); // Build Search @@ -1469,6 +4121,7 @@ void CAddrDialog::PerformDirectorySearch () // Build Search m_barStatus.SetWindowText( szLoadString( IDS_SEARCHING ) ); m_bSearching = TRUE; + GetDlgItem(IDC_ADDRNAME)->SetWindowText(CString (szLoadString(IDS_SEARCHRESULTS))); m_pOutliner->UpdateCount(); m_pOutliner->SetFocus(); m_pDirOutliner->EnableWindow(FALSE); @@ -2111,7 +4764,6 @@ void CAddrDialogDirOutliner::UpdateCount( ) void CAddrDialogDirOutliner::SetPane(ABPane *pane) { m_pane = pane; - uint32 count; if (m_pane) { SetTotalLines(XP_ListCount (theApp.m_directories)); @@ -2455,7 +5107,12 @@ void CAddrDialog::UpdateMsgButtons() GetDlgItem(IDC_TO)->EnableWindow(bEnable); GetDlgItem(IDC_CC)->EnableWindow(bEnable); GetDlgItem(IDC_BCC)->EnableWindow(bEnable); +#ifdef MOZ_NEWADDR GetDlgItem(ID_ITEM_PROPERTIES)->EnableWindow(bEnable); +#else + //leave disabled for now. + GetDlgItem(ID_ITEM_PROPERTIES)->EnableWindow(FALSE); +#endif } DoUpdateWidget(IDC_DIRSEARCH, AB_LDAPSearchCmd, TRUE); if (m_bSearching) @@ -2492,3 +5149,4 @@ BOOL CAddressPickerDropTarget::OnDrop } +#endif // MOZ_NEWADDR diff --git a/mozilla/cmd/winfe/addrdlg.h b/mozilla/cmd/winfe/addrdlg.h index ef21bf4da26..7685318b205 100755 --- a/mozilla/cmd/winfe/addrdlg.h +++ b/mozilla/cmd/winfe/addrdlg.h @@ -18,6 +18,511 @@ #ifndef _addrdlg_h_ #define _addrdlg_h_ +#include "addrfrm.h" + + +#ifdef MOZ_NEWADDR + +// ADDRDLG.H +// +// DESCRIPTION: +// This file contains the declarations of the for the address picker +// dialog +// + +#include "outliner.h" +#include "apimsg.h" +#include "addrbook.h" +#include "mailfrm.h" +#include "mailpriv.h" +#include "mnrccln.h" + +class COutlinerView; +class CAddrDialog; +class CAddrDialogOutliner; +class CAddrDialogOutlinerParent; +class CAddrDialogDirOutliner; +class CAddrDialogDirOutlinerParent; +class CAddrDialogEntryList; + +// Definitions for column headings in the outliner control + +#define DEF_VISIBLE_COLUMNS 5 +#define ID_COLADDR_TYPE 1 +#define ID_COLADDR_NAME 2 +#define ID_COLADDR_EMAIL 3 +#define ID_COLADDR_COMPANY 4 +#define ID_COLADDR_PHONE 5 +#define ID_COLADDR_LOCALITY 6 +#define ID_COLADDR_NICKNAME 7 + +#define DEF_DIRVISIBLE_COLUMNS 2 +#define ID_COLDIR_TYPE 1 +#define ID_COLDIR_NAME 2 + +// array of indexes for IDB_ADDRESSBOOK bitmap +#define IDX_ADDRESSBOOKPERSON 0 +#define IDX_ADDRESSBOOKLIST 1 +#define IDX_ADDRESSBOOKPERCARD 2 + +// array of indexes for IDB_DIRLIST bitmap +#define IDX_DIRLDAPAB 0 +#define IDX_DIRPERSONALAB 1 + +class CAddressPickerDropTarget : public COleDropTarget +{ +public: + + CAddrDialog* m_pOwner; +//Construction + CAddressPickerDropTarget(CAddrDialog* pOwner) { m_pOwner = pOwner; } + BOOL OnDrop(CWnd *, COleDataObject *, DROPEFFECT, CPoint); + DROPEFFECT OnDragOver(CWnd *, COleDataObject *, DWORD, CPoint); +}; + +// address book context +class CAddrDialogCX: public CStubsCX +{ +protected: + CAddrDialog* m_pDialog; + + int32 m_lPercent; + CString m_csProgress; + BOOL m_bAnimated; + +public: + CAddrDialogCX(CAddrDialog *pDialog); + // void DestroyContext(); + +public: + int32 QueryProgressPercent(); + void SetProgressBarPercent(MWContext *pContext, int32 lPercent); + + void Progress(MWContext *pContext, const char *pMessage); + void AllConnectionsComplete(MWContext *pContext); + + void UpdateStopState( MWContext *pContext ); + + CWnd *GetDialogOwner() const; +}; + + + +/**************************************************************************** +* +* Class: CAddrDialogOutlinerParent +* +* DESCRIPTION: +* This class is the window around the column/list object in the address +* book. It is mainly purpose is to draw the column headings. +* +****************************************************************************/ +class CAddrDialogOutlinerParent : public COutlinerParent +{ +public: + CAddrDialogOutlinerParent(); + virtual ~CAddrDialogOutlinerParent(); + virtual COutliner * GetOutliner ( ); + virtual void CreateColumns ( ); + virtual BOOL RenderData ( int idColumn, CRect & rect, CDC & dc, const char *); + virtual BOOL ColumnCommand ( int idColumn ); + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CAddrDialogOutlinerParent) + afx_msg void OnLButtonUp ( UINT nFlags, CPoint point ); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +/**************************************************************************** +* +* Class: CAddrDialogDirOutlinerParent +* +* DESCRIPTION: +* This class is the window around the column directorylist +* object in the address book. It is mainly purpose is to draw +* the column headings. +* +****************************************************************************/ +class CAddrDialogDirOutlinerParent : public COutlinerParent +{ +public: + CAddrDialogDirOutlinerParent(); + virtual ~CAddrDialogDirOutlinerParent(); + virtual COutliner * GetOutliner ( ); + virtual void CreateColumns ( ); + virtual BOOL RenderData ( int idColumn, CRect & rect, CDC & dc, const char *); + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CAddrDialogDirOutlinerParent) + afx_msg void OnLButtonUp ( UINT nFlags, CPoint point ); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + + +/**************************************************************************** +* +* Class: CAddrDialogDirOutliner +* +* DESCRIPTION: +* This class is the column/list object for the directory list +* in the address book +* +****************************************************************************/ +class CAddrDialogDirOutliner : public CMSelectOutliner +{ +friend class CAddrDialogDirOutlinerParent; + +protected: + int m_lineindex; + char* m_pszExtraText; + CLIPFORMAT m_cfAddresses; + ABPane* m_pane; + int m_iMysticPlane; + MWContext* m_pContext; + int m_dirIndex; + DIR_Server* m_pDirLine; + HFONT m_hFont; + +public: + CAddrDialogDirOutliner ( ); + virtual ~CAddrDialogDirOutliner ( ); + + void UpdateCount(); + void OnChangeDirectory(int dirIndex); + void SetDirectoryIndex (int dirIndex); + int GetDirectoryIndex () { return m_dirIndex; } + + virtual void OnSelChanged(); + virtual void SetTotalLines( int iLines ); + virtual void OnSelDblClk(); + + virtual HFONT GetLineFont( void *pLineData ); + virtual LPCTSTR GetColumnText ( UINT iColumn, void * pLineData ); + virtual void * AcquireLineData ( int iLine ); + virtual void ReleaseLineData ( void * pLineData ); + virtual void GetTreeInfo ( int iLine, uint32 * pFlags, int * iDepth, + OutlinerAncestorInfo ** pAncestor ); + virtual int TranslateIcon ( void *); + virtual int TranslateIconFolder ( void *); + virtual BOOL ColumnCommand ( int iColumn, int iLine ); + + void SetPane( ABPane *pane ); + ABPane* GetPane() { return m_pane; } + + MWContext *GetContext() { return m_pContext; } + void SetContext( MWContext *pContext ) { m_pContext = pContext; } + + virtual void MysticStuffStarting( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num); + virtual void MysticStuffFinishing( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num); + + virtual BOOL RenderData ( UINT iColumn, CRect & rect, CDC & pdc, const char * ); + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CAddrDialogDirOutliner) + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() + + +}; + +/**************************************************************************** +* +* Class: CAddrDialog +* +* DESCRIPTION: +* This class is the address picker from the compose window +* +****************************************************************************/ +typedef BOOL (*MAPIAddressCallbackProc)(int totalCount, int currentIndex, + int addrType, LPSTR addrString); // rhp - for MAPI +typedef BOOL (*MAPIAddressGetAddrProc)(LPSTR *name, LPSTR *address, int *addrType); // rhp - for MAPI + +class CAddrDialog : public CDialog, public IMailFrame, public CAddrBookOutlinerOwner, + public CAddrBarEditWndOwner { + +// Attributes +public: + + friend class CAddrDialogEntryList; + + int m_iWidth; + UINT m_uTypedownClock; + CString m_save; + int m_savedir; + int m_idefButtonID; + + enum { IDD = IDD_ADDRESSPICKER }; + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAddrDialog) +public: +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + //{{AFX_DATA(CAddrDialog) + CString m_name; + int m_directory; + //}}AFX_DATA + +protected: + + CNetscapeStatusBar m_barStatus; + + CMailNewsSplitter *m_pSplitter; + CAddrOutlinerParent *m_pOutlinerParent; + CAddrOutliner *m_pOutliner; + CDirOutliner *m_pDirOutliner; + CDirOutlinerParent *m_pDirOutlinerParent; + CAddrDialogCX *m_pCX; + HFONT m_pFont; + CAddrBarEditWnd m_EditWnd; + + LPMSGLIST m_pIAddrList; + MSG_Pane *m_addrBookPane; + MSG_Pane *m_addrContPane; + BOOL m_bSearching; + CMailNewsResourceSwitcher m_MailNewsResourceSwitcher; + + CAddressPickerDropTarget *m_pDropTarget; + + // rhp - MAPI stuff... + BOOL m_isMAPI; + LPSTR m_mapiHeader; + MAPIAddressCallbackProc m_mapiCBProc; + MAPIAddressGetAddrProc m_mapiGetAddrProc; + void ProcessMAPIOnDone(void); + void ProcessMAPIAddressPopulation(void); + + // IUnknown Interface + STDMETHODIMP QueryInterface(REFIID,LPVOID *); + STDMETHODIMP_(ULONG) AddRef(void); + STDMETHODIMP_(ULONG) Release(void); + +// Support for IMsgList Interface (Called by CAddrDialogEntryList) + virtual void ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + + CListBox * GetBucket() { return (CListBox*)GetDlgItem(IDC_ADDRESSBKT); } + + DIR_Server* GetCurrentDirectoryServer (); + void PerformDirectorySearch (); + void PerformChangeDirectory (int dirIndex); + void PerformTypedown (char* searchString); + void PerformListDirectory (char* searchString); + void UpdateDirectories(); + void CleanupOnClose(); + void GetFormattedString(char* fullname, MSG_HEADER_SET header, char** formatted); + void AddStringToBucket(CListBox *pBucket, MSG_HEADER_SET header, + char* fullname, AB_EntryType type, ABID entryID); + +// Operations +public: + CAddrDialog(CWnd* pParent = NULL, + BOOL isMapi = FALSE, LPSTR winText = NULL, + MAPIAddressCallbackProc mapiCB = NULL, + MAPIAddressGetAddrProc mapiGetProc = NULL); // rhp - MAPI + + + + void OnUpdateDirectorySelection (int dirIndex, BOOL indexChanged); + void SelectionChanged(); + void DoubleClick(); + CWnd *GetOwnerWindow(); + int GetDefaultButtonID () { return m_idefButtonID; } + void SetDefaultButtonID (int newDefault) { m_idefButtonID = newDefault; } + void MoveSelections(MSG_HEADER_SET header); + enum { ToolInvalid = -1, ToolText = 0, ToolPictures = 1, ToolBoth = 2 }; + + // From CStubsCX + void Progress(const char *pMessage); + void SetProgressBarPercent(int32 lPercent); + void AllConnectionsComplete(MWContext *pContext); + void SetStatusText(const char* pMessage); + void DoUpdateWidget( int command, AB_CommandType cmd, BOOL bUseCheck ); + + // Support for IMailFrame + virtual CMailNewsFrame *GetMailNewsFrame(); + virtual MSG_Pane *GetPane(); + virtual void PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, + MSG_PANE_CHANGED_NOTIFY_CODE, int32 value); + virtual void AttachmentCount(MSG_Pane *messagepane, void* closure, + int32 numattachments, XP_Bool finishedloading) {}; + virtual void UserWantsToSeeAttachments(MSG_Pane *messagepane, void *closure) {}; + + // Callback from LDAP search + void SetSearchResults(MSG_ViewIndex index, int32 num); + XP_Bool IsSearching () { return m_bSearching; } + + AB_ContainerInfo * GetCurrentContainerInfo(); + + static void HandleErrorReturn(int errorID); + + void Create(); + void DoUpdateAddressBook( CCmdUI* pCmdUI, AB_CommandType cmd, BOOL bUseCheck = TRUE ); + + //drop + BOOL IsDragInListBox(CPoint *pPoint); + BOOL ProcessVCardData(COleDataObject * pDataObject,CPoint &point); + + void UpdateMsgButtons(); + // CAddrBarEditWndOwner implementation + void SearchText(BOOL bImmediately); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAddrDialog) + public: + virtual BOOL OnInitDialog( ); + virtual BOOL PreTranslateMessage(MSG* pMsg); + virtual int DoModal(); + protected: + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CAddrDialog) + afx_msg void OnKeyDown ( UINT nChar, UINT nRepCnt, UINT nFlags ); + afx_msg int OnCreate( LPCREATESTRUCT ); + afx_msg void OnSize( UINT, int, int); + afx_msg void OnTimer( UINT ); + afx_msg void OnSetFocusName(); + afx_msg void OnSetFocusBucket(); + afx_msg void OnUpdateOnlineStatus(CCmdUI *pCmdUI); + afx_msg void OnChangeName(); + afx_msg void OnChangeDirectory(); + afx_msg void OnDirectorySearch(); + afx_msg void OnStopSearch(); + afx_msg void OnDone(); + afx_msg void OnCancel(); + afx_msg void OnComposeMsg(void); + afx_msg void OnComposeCCMsg(void); + afx_msg void OnComposeBCCMsg(void); + afx_msg void OnGetProperties(void); + afx_msg void OnRemove(void); + afx_msg void OnSortType(void); + afx_msg void OnSortName(void); + afx_msg void OnSortNickName(void); + afx_msg void OnSortEmailAddress(void); + afx_msg void OnSortCompany(void); + afx_msg void OnSortLocality(void); + afx_msg void OnSortAscending(void); + afx_msg void OnSortDescending(void); + afx_msg void OnSelchange(); + afx_msg void OnHelp(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +/**************************************************************************** +* +* Class: CAddrDialogOutliner +* +* DESCRIPTION: +* This class is the column/list object in the address book +* +****************************************************************************/ +class CAddrDialogOutliner : public CMSelectOutliner +{ +friend class CAddrDialogOutlinerParent; + +protected: + int m_attribSortBy; + char* m_pszExtraText; + CLIPFORMAT m_cfAddresses; + ABPane* m_pane; + int m_iMysticPlane; + BOOL m_bSortAscending; + MWContext* m_pContext; + int m_dirIndex; + AB_EntryLine m_EntryLine; + HFONT m_hFont; + CString m_psTypedown; + UINT m_uTypedownClock; + +public: + CAddrDialogOutliner ( ); + virtual ~CAddrDialogOutliner ( ); + + void UpdateCount(); + void OnTypedown (char* name); + void OnChangeDirectory(int dirIndex); + int GetSortBy() { return m_attribSortBy; } + void SetDirectoryIndex (int dirIndex); + int GetDirectoryIndex () { return m_dirIndex; } + BOOL GetSortAscending() { return m_bSortAscending; } + DIR_Server* GetCurrentDirectoryServer (); + + virtual void OnSelChanged(); + virtual void SetTotalLines( int iLines ); + virtual void OnSelDblClk(); + + virtual HFONT GetLineFont( void *pLineData ); + virtual LPCTSTR GetColumnText ( UINT iColumn, void * pLineData ); + virtual void * AcquireLineData ( int iLine ); + virtual void ReleaseLineData ( void * pLineData ); + virtual void GetTreeInfo ( int iLine, uint32 * pFlags, int * iDepth, + OutlinerAncestorInfo ** pAncestor ); + virtual int TranslateIcon ( void *); + virtual int TranslateIconFolder ( void *); + + void SetPane( ABPane *pane ); + ABPane* GetPane() { return m_pane; } + + MWContext *GetContext() { return m_pContext; } + void SetContext( MWContext *pContext ) { m_pContext = pContext; } + + virtual void MysticStuffStarting( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num); + virtual void MysticStuffFinishing( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num); + + virtual BOOL RenderData ( UINT iColumn, CRect & rect, CDC & pdc, const char * ); + + virtual BOOL ColumnCommand ( int iColumn, int iLine ); + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CAddrDialogOutliner) + afx_msg void OnTimer( UINT ); + afx_msg void OnKeyDown ( UINT nChar, UINT nRepCnt, UINT nFlags ); + afx_msg void OnKillFocus( CWnd* pNewWnd ); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() + + +}; + +#else //MOZ_NEWADDR // ADDRDLG.H // // DESCRIPTION: @@ -379,6 +884,7 @@ public: public: virtual BOOL OnInitDialog( ); virtual BOOL PreTranslateMessage(MSG* pMsg); + virtual int DoModal(); protected: //}}AFX_VIRTUAL @@ -505,3 +1011,5 @@ protected: }; #endif + +#endif //MOZ_NEWADDR diff --git a/mozilla/cmd/winfe/addrfrm.cpp b/mozilla/cmd/winfe/addrfrm.cpp index d2a3e673bfd..cef98f619d5 100755 --- a/mozilla/cmd/winfe/addrfrm.cpp +++ b/mozilla/cmd/winfe/addrfrm.cpp @@ -20,14 +20,15 @@ // #include "stdafx.h" + +#include "rosetta.h" #include "addrfrm.h" -#ifdef FEATURE_ADDRPROP #include "addrprop.h" -#endif #include "template.h" #include "xpgetstr.h" #include "wfemsg.h" #include "msg_srch.h" +#include "msgcom.h" #include "dirprefs.h" #include "nethelp.h" #include "xp_help.h" @@ -37,10 +38,14 @@ #include "intl_csi.h" #include "mailpriv.h" #include "mnprefs.h" +#include "mnrccln.h" //RHP - Need this include for the call in confhook.cpp #include "confhook.h" +//#include "fegui.h" // for FE_GetProgramDirectory() +extern "C" char *FE_GetProgramDirectory(char *buffer, int length); + #ifndef _AFXDLL #undef new #endif @@ -68,6 +73,7 @@ extern int MK_ADDR_LAST_FIRST_SEP; #define TYPEDOWN_SPEED 300 #define LDAP_SEARCH_SPEED 1250 #define OUTLINER_TYPEDOWN_SPEED 1250 +#define _MAX_ARG_LEN_ 128 static UINT AddrCodes[] = { ID_ITEM_ADDUSER, @@ -79,12 +85,136 @@ static UINT AddrCodes[] = { ID_NAVIGATE_INTERRUPT }; +#ifdef MOZ_NEWADDR +typedef enum{ + AB_ColumnFEID0 = AB_ColumnID0 + 1, + AB_ColumnFEID1, + AB_ColumnFEID2, + AB_ColumnFEID3, + AB_ColumnFEID4, + AB_ColumnFEID5, + AB_ColumnFEID6 +} AB_ColumnFEID; + +static AB_ContainerAttribute ContainerAttribs [] = { + attribContainerType, + attribName, + attribDepth, + attribNumChildren +}; + + +int ShowPropertySheetForEntry (MSG_Pane * pane, MWContext * context) +{ + BOOL result = FALSE; + + if(MSG_GetPaneType(pane) == AB_PERSONENTRYPANE) + { + // Need to get given name + AB_AttribID id = AB_attribDisplayName; + AB_AttributeValue *value; + uint16 numItems = 1; + + AB_GetPersonEntryAttributes(pane, &id, &value, &numItems); + + BOOL bNew = FALSE; + CString title; + if(numItems > 0 && value->attrib == AB_attribDisplayName) + { + title.Format(XP_GetString (MK_ADDR_BOOK_CARD), value->u.string); + bNew = FALSE; + } + else + { + title = XP_GetString (MK_ADDR_NEW_CARD); + bNew = TRUE; + } + + + CAddrEditProperties prop(NULL, + (const char *) title, ABSTRACTCX(context)->GetDialogOwner(), + pane, context, bNew); + + result = prop.DoModal(); + + if (result == IDOK) + result = TRUE; + if (result == IDCANCEL) + result = FALSE; + + if(numItems > 0) + { + AB_FreeEntryAttributeValues(value, numItems); + } + } + else if(MSG_GetPaneType(pane) == AB_MAILINGLISTPANE) + { + + CABMLDialog* dialog; + + dialog = new CABMLDialog (ABSTRACTCX(context)->GetDialogOwner(), pane, context); + + if (dialog->Create(ABSTRACTCX(context)->GetDialogOwner())) + result = TRUE; + } + + + return result; +} + +int ShowPropertySheetForDir(DIR_Server *server, MWContext *context, MSG_Pane *pane, + XP_Bool newDirectory) +{ + + BOOL result = FALSE; + + if(server->dirType == LDAPDirectory) + { + + CAddrLDAPProperties dialog(ABSTRACTCX(context)->GetDialogOwner(), context, + server, "ldaptest"); + + if(dialog.DoModal() == IDOK) + { + CAddrFrame::HandleErrorReturn(AB_UpdateDIRServerForContainerPane(pane, server)); + } + result = TRUE; + } + else if(server->dirType == PABDirectory) + { + + LPTSTR name = newDirectory ? "" : server->description; + + char *newName = FE_PromptWithCaption(context, "Address Book Info", "Name", name); + + if(newName) + { + server->description = XP_STRDUP(newName); + + CAddrFrame::HandleErrorReturn(AB_UpdateDIRServerForContainerPane(pane, server)); + } + + result = TRUE; + } + + return result; +} + + +int FE_ShowPropertySheetFor (MWContext* context, ABID entryID, PersonEntry* pPerson) +{ + + return TRUE; +} + + + +#else int FE_ShowPropertySheetFor (MWContext* context, ABID entryID, PersonEntry* pPerson) { DIR_Server *pab = NULL; BOOL result = FALSE; -#ifdef FEATURE_ADDRPROP DIR_GetPersonalAddressBook (theApp.m_directories, &pab); XP_ASSERT (pab); @@ -130,16 +260,3831 @@ int FE_ShowPropertySheetFor (MWContext* context, ABID entryID, PersonEntry* pPer result = FALSE; // if it is -1 then there was a memory problem creating the dialog // and we should return that -#endif return result; } +#endif +// +// This will be the central function where we will call the +// import utility +// +// Args: makeCall - true if we are called from the address book +// false - if we are called from another mail window +// +void WFE_MSGLaunchMigrationUtility(HWND parent, int calledFromAddressBook, + char* directory) +{ + char szCommandLine[_MAX_ARG_LEN_]; + // the args for the import utility are + // -d for mail directory, + // -t for import type 0==mail 1==address book + // and -v for version number + + strcpy (szCommandLine, ""); + + // format the command line + if (calledFromAddressBook == 0) + { + strcpy (szCommandLine, "-d"); + char mailDirectory[256]; + int nLen = 255; + strcpy (mailDirectory, ""); + PREF_GetCharPref("mail.directory", mailDirectory, &nLen); + strcpy (szCommandLine, mailDirectory); + // strcpy (szCommandLine, " -t0 "); + } + else + { + strcpy (szCommandLine, "-a"); + strcpy (szCommandLine, directory); + strcpy (szCommandLine, " -t1 "); + } + +// strcpy (szCommandLine, "-v"); +// strcpy (szCommandLine, XP_AppVersion); + + // + // Check to see if the executable is defined on the machine. If it is not, then + // show a message and return. + char executable [_MAX_PATH + 32]; + strcpy (executable, ""); + FE_GetProgramDirectory( executable, _MAX_PATH + 32 ); + if ( *executable ) { +#ifdef WIN32 + strcat( executable, "import32.exe" ); +#else + strcat( executable, "import16.exe" ); +#endif + } + + // try to launch the import app + int uSpawn = (int) ShellExecute(NULL, "open", executable, szCommandLine, ".", SW_SHOW); + if(uSpawn <= 32) + { + char szMsg[80]; + switch(uSpawn) + { + case 0: + case 8: + sprintf(szMsg, szLoadString(IDS_WINEXEC_0_8)); + break; + case 2: + case 3: + sprintf(szMsg, szLoadString(IDS_WINEXEC_2_3)); + break; + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + sprintf(szMsg, szLoadString(IDS_WINEXEC_10_THRU_15)); + break; + case 16: + sprintf(szMsg, szLoadString(IDS_WINEXEC_16)); + break; + case 21: + sprintf(szMsg, szLoadString(IDS_WINEXEC_21)); + break; + default: + sprintf(szMsg, szLoadString(IDS_WINEXEC_XX), uSpawn); + break; + } + + CString s; + if (s.LoadString( IDS_BOOKMARK_ADDRESSPROPERTIES )) + { + ::MessageBox(parent, szMsg, s, MB_OK | MB_APPLMODAL); + } + } +} + void CAddrCX::DestroyContext() { CStubsCX::DestroyContext(); } +#ifdef MOZ_NEWADDR + +CAddrBarEditWnd::CAddrBarEditWnd() +{ + +} + +CAddrBarEditWnd::~CAddrBarEditWnd() +{ + +} + +BEGIN_MESSAGE_MAP(CAddrBarEditWnd,CEdit) +END_MESSAGE_MAP() + + +BOOL CAddrBarEditWnd::PreTranslateMessage ( MSG * msg ) +{ + if ( msg->message == WM_KEYDOWN) + { + switch(msg->wParam) + { + case VK_RETURN: + m_pOwner->SearchText(TRUE); + break; + + } + } + return CEdit::PreTranslateMessage ( msg ); +} + + + +CAddrBar::CAddrBar() +{ + m_iWidth = 0; + m_uTypedownClock = 0; + m_save = ""; + m_pFont = NULL; + m_bRemoveLDAPDir = FALSE; + + PREF_GetBoolPref("mail.addr_book.ldap.disabled", &m_bRemoveLDAPDir); + m_EditWnd.SetOwner(this); + //{{AFX_DATA_INIT(CAddrbkView) + m_name = _T(""); + //}}AFX_DATA_INIT + // TODO: add construction code here +} + +CAddrBar::~CAddrBar() +{ + if (m_pFont) { + theApp.ReleaseAppFont(m_pFont); + } +} + +///////////////////////////////////////////////////////////////////////////// +// CAddrBar Message handlers + +BEGIN_MESSAGE_MAP(CAddrBar, CDialogBar) + //{{AFX_MSG_MAP(CAddrFrame) + ON_WM_CREATE() + ON_WM_SIZE() + ON_WM_TIMER () + ON_EN_CHANGE(IDC_ADDRNAME, OnChangeName) + ON_EN_SETFOCUS(IDC_ADDRNAME, OnSetFocusName) + ON_BN_CLICKED(IDC_DIRSEARCH, OnExtDirectorySearch) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + + +BOOL CAddrBar::Create(CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID) +{ + BOOL res = CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID); + + m_iWidth = m_sizeDefault.cx; + m_EditWnd.SubclassDlgItem(IDC_ADDRNAME, this); + + return res; +} + + +int CAddrBar::OnCreate( LPCREATESTRUCT lpCreateStruct ) +{ + int retval = CDialogBar::OnCreate( lpCreateStruct); + + HDC hDC = ::GetDC(m_hWnd); + LOGFONT lf; + memset(&lf,0,sizeof(LOGFONT)); + lf.lfPitchAndFamily = FF_SWISS; + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = IntlGetLfCharset(CIntlWin::GetSystemLocaleCsid()); + if (CIntlWin::GetSystemLocaleCsid() == CS_LATIN1) + _tcscpy(lf.lfFaceName, "MS Sans Serif"); + else + _tcscpy(lf.lfFaceName, IntlGetUIPropFaceName(CIntlWin::GetSystemLocaleCsid())); + lf.lfHeight = -MulDiv(9, ::GetDeviceCaps(hDC, LOGPIXELSY), 72); + m_pFont = theApp.CreateAppFont( lf ); + ::ReleaseDC(m_hWnd,hDC); + + CRect rect; + GetClientRect(&rect); + m_sizeDefault = rect.Size(); + + return retval; +} + + +void CAddrBar::OnTimer(UINT nID) +{ + CWnd::OnTimer(nID); + if (nID == ADDRESS_BOOK_TIMER) { + KillTimer(m_uTypedownClock); + CAddrFrame* frame = (CAddrFrame*) GetParentFrame(); + if (!m_name.IsEmpty()) { + frame->OnTypedown(m_name.GetBuffer(0)); + m_name.ReleaseBuffer(); + } + } +} + +void CAddrBar::OnKillFocus( CWnd* pNewWnd ) +{ + KillTimer(m_uTypedownClock); +} + +void CAddrBar::DoDataExchange(CDataExchange* pDX) +{ + CDialogBar::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAddrbkView) + DDX_Text(pDX, IDC_ADDRNAME, m_name); + //}}AFX_DATA_MAP +} + + +void CAddrBar::OnChangeName() +{ + // TODO: Add your control notification handler code here + CAddrFrame* frame = (CAddrFrame*) GetParentFrame(); + UpdateData(TRUE); + if (frame->IsSearching()) { + CString checkName (szLoadString(IDS_SEARCHRESULTS)); + if (stricmp (checkName, m_name) != 0) + frame->OnExtendedDirectorySearch(); + else + return; + } + + SearchText(FALSE); +} + +void CAddrBar::SearchText(BOOL bImmediately) +{ + CAddrFrame* frame = (CAddrFrame*) GetParentFrame(); + + if (m_name != m_save) { + m_save = m_name; + KillTimer(m_uTypedownClock); + if (m_name.GetLength()) + { + if(bImmediately) + { + m_uTypedownClock = SetTimer(ADDRESS_BOOK_TIMER, 0, NULL); + } + else + { + DIR_Server* dir; + dir = frame->GetCurrentDirectoryServer(); + if (dir->dirType == PABDirectory) + m_uTypedownClock = SetTimer(ADDRESS_BOOK_TIMER, TYPEDOWN_SPEED, NULL); + else { + int32 prefInt = LDAP_SEARCH_SPEED; + PREF_GetIntPref("ldap_1.autoComplete.interval", &prefInt); + m_uTypedownClock = SetTimer(ADDRESS_BOOK_TIMER, prefInt, NULL); + } + } + } + } + + +} + + +void CAddrBar::OnSetFocusName() +{ + CEdit *widget = (CEdit*) GetDlgItem(IDC_ADDRNAME); + widget->SetSel(0, -1, TRUE); +} + +void CAddrBar::ClearSavedText() +{ + m_save = ""; +} + +void CAddrBar::ChangeDirectoryName(char * directoryName) +{ + CWnd* widget = GetDlgItem ( IDC_STATIC1 ); + if (widget) + widget->SetWindowText (directoryName); +} + + +void CAddrBar::OnExtDirectorySearch() +{ + // TODO: Add your control notification handler code here + CAddrFrame* frame = (CAddrFrame*) GetParentFrame(); + if (frame) { + KillTimer(m_uTypedownClock); + frame->OnExtendedDirectorySearch(); + } +} + + +static void GrowWindow( CWnd *pWnd, int dx, int dy ) +{ + CRect rect; + CWnd *parent; + + pWnd->GetWindowRect(&rect); + if (parent = pWnd->GetParent()) + parent->ScreenToClient(&rect); + + rect.bottom += dy; + if (rect.right + dx > 0) + rect.right += dx; + + pWnd->MoveWindow(&rect); +} + + +static void SlideWindow( CWnd *pWnd, int dx, int dy ) +{ + CRect rect; + CWnd *parent; + + pWnd->GetWindowRect(&rect); + if (parent = pWnd->GetParent()) + parent->ScreenToClient(&rect); + + rect.top += dy; + rect.left += dx; + rect.bottom += dy; + rect.right += dx; + + pWnd->MoveWindow(&rect, TRUE); +} + + +void CAddrBar::OnSize( UINT nType, int cx, int cy ) +{ + CDialogBar::OnSize( nType, cx, cy ); + if ( cx && m_iWidth && ( cx != m_iWidth ) ) { + CWnd *widget; + int dx = cx - m_iWidth; + + /* widget = GetDlgItem(IDC_DIRSEARCH); + if (widget) { + SlideWindow(widget, dx, 0); + widget->GetWindowRect(&rect1); + } */ + + widget = GetDlgItem(IDC_ADDRNAME); + if (widget) { + CWnd *parent; + CRect rect; + CRect rect1; + + widget->GetWindowRect(&rect); + if (parent = widget->GetParent()) { + parent->GetWindowRect(&rect1); + parent->ScreenToClient(&rect1); + parent->ScreenToClient(&rect); + rect.right = rect1.right - 8; + } + widget->MoveWindow(&rect); + } + m_iWidth = cx; + } +} + +class CAddrFrame; + +///////////////////////////////////////////////////////////////////////////// +// CAddrEntryList + +class CAddrEntryList: public IMsgList { + + CAddrFrame *m_pAddrFrame; + unsigned long m_ulRefCount; + +public: +// IUnknown Interface + STDMETHODIMP QueryInterface(REFIID,LPVOID *); + STDMETHODIMP_(ULONG) AddRef(void); + STDMETHODIMP_(ULONG) Release(void); + +// IMsgList Interface + virtual void ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void GetSelection( MSG_Pane* pane, MSG_ViewIndex **indices, int *count, + int *focus); + virtual void SelectItem( MSG_Pane* pane, int item ); + + virtual void CopyMessagesInto( MSG_Pane *pane, MSG_ViewIndex *indices, int count, + MSG_FolderInfo *folderInfo) {} + virtual void MoveMessagesInto( MSG_Pane *pane, MSG_ViewIndex *indices, int count, + MSG_FolderInfo *folderInfo) {} + + CAddrEntryList( CAddrFrame *pAddrFrame ) { + m_ulRefCount = 0; + m_pAddrFrame = pAddrFrame; + } +}; + + +STDMETHODIMP CAddrEntryList::QueryInterface(REFIID refiid, LPVOID * ppv) +{ + *ppv = NULL; + if (IsEqualIID(refiid,IID_IUnknown)) + *ppv = (LPUNKNOWN) this; + else if (IsEqualIID(refiid,IID_IMsgList)) + *ppv = (LPMSGLIST) this; + else if (IsEqualIID(refiid,IID_IMailFrame)) + *ppv = (LPMAILFRAME) m_pAddrFrame; + + if (*ppv != NULL) { + AddRef(); + return NOERROR; + } + + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP_(ULONG) CAddrEntryList::AddRef(void) +{ + return ++m_ulRefCount; +} + +STDMETHODIMP_(ULONG) CAddrEntryList::Release(void) +{ + ULONG ulRef; + ulRef = --m_ulRefCount; + if (m_ulRefCount == 0) + delete this; + return ulRef; +} + +void CAddrEntryList::ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if (m_pAddrFrame) { + m_pAddrFrame->ListChangeStarting( pane, asynchronous, + notify, where, num ); + } +} + +void CAddrEntryList::ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if (m_pAddrFrame) { + m_pAddrFrame->ListChangeFinished( pane, asynchronous, + notify, where, num ); + } +} + +void CAddrEntryList::GetSelection( MSG_Pane* pane, MSG_ViewIndex **indices, int *count, + int *focus) +{ +} + +void CAddrEntryList::SelectItem( MSG_Pane* pane, int item ) +{ +} + +///////////////////////////////////////////////////////////////////////////// +// CAddrFrame + +CAddrFrame *CAddrFrame::Open() +{ + if (!WFE_MSGCheckWizard()) + return NULL; + + if (!theApp.m_pAddressWindow) //starts the address book window + { + theApp.m_pAddressWindow = new CAddrFrame(); + if(!theApp.m_pAddressWindow) return NULL; + CCreateContext Context; + Context.m_pCurrentFrame = NULL; // nothing to base on + Context.m_pCurrentDoc = NULL; // nothing to base on + Context.m_pNewViewClass = NULL; // nothing to base on + Context.m_pNewDocTemplate = NULL; // nothing to base on + theApp.m_pAddressWindow->LoadFrame(IDR_ADDRESS_MENU, + WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE |WS_CLIPCHILDREN|WS_CLIPSIBLINGS, NULL, &Context); + } + else + { + theApp.m_pAddressWindow->ActivateFrame(); + } + + return theApp.m_pAddressWindow; +} + + +CAddrFrame::CAddrFrame() +{ + CString msg; + INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(GetContext()); + + m_cxType = AddressCX; + + GetContext()->type = MWContextAddressBook; + GetContext()->fancyFTP = TRUE; + GetContext()->fancyNews = TRUE; + GetContext()->intrupt = FALSE; + GetContext()->reSize = FALSE; + INTL_SetCSIWinCSID(csi, CIntlWin::GetSystemLocaleCsid()); + + m_pSplitter = NULL; + m_pOutliner = NULL; + m_pOutlinerParent = NULL; + m_pDirOutliner = NULL; + m_pDirOutlinerParent = NULL; + m_addrBookPane = NULL; + m_addrContPane = NULL; + m_bSearching = FALSE; + m_iProgress = 0; + m_iWidth = 0; + + CAddrEntryList *pInstance = new CAddrEntryList( this ); + pInstance->QueryInterface( IID_IMsgList, (LPVOID *) &m_pIAddrList ); +} + + +CAddrFrame::~CAddrFrame() +{ + if (m_pIAddrList) + m_pIAddrList->Release(); + + if (m_addrBookPane) + HandleErrorReturn(AB_ClosePane(m_addrBookPane)); + + if (m_addrContPane) + HandleErrorReturn(AB_ClosePane(m_addrContPane)); + + theApp.m_pAddressWindow = NULL; +} + +///////////////////////////////////////////////////////////////////////////// +// CAddrFrame Overloaded methods + +BOOL CAddrFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + cs.hwndParent = NULL; + + cs.x = cs.y = 0; + cs.cx = cs.cy = 300; // Arbitrary + + BOOL bRet = CGenericFrame::PreCreateWindow(cs); + +#ifdef _WIN32 + cs.dwExStyle &= ~WS_EX_CLIENTEDGE; +#endif + + return bRet; +} + + +BOOL CAddrFrame::LoadFrame( UINT nIDResource, DWORD dwDefaultStyle, + CWnd* pParentWnd, CCreateContext* pContext) +{ + BOOL ret = CGenericFrame::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext); + + if (ret) { + + WINDOWPLACEMENT wp; + wp.length = sizeof(WINDOWPLACEMENT); + GetWindowPlacement(&wp); + + if (wp.rcNormalPosition.left < 0 || wp.rcNormalPosition.top < 0) { + SetWindowPos( NULL, 0 , 0, 0, 0, SWP_NOSIZE); + GetWindowPlacement(&wp); + SetWindowPos( NULL, abs (wp.rcNormalPosition.left) , abs (wp.rcNormalPosition.top), + 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE); + } + else + ShowWindow(SW_SHOW); + } + + return ret; +} + + +BOOL CAddrFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext ) +{ + BOOL res = CGenericFrame::OnCreateClient(lpcs, pContext); + if (res) { + + m_pSplitter = (CMailNewsSplitter *) RUNTIME_CLASS(CMailNewsSplitter)->CreateObject(); + + ASSERT(m_pSplitter); + +#ifdef _WIN32 + m_pSplitter->CreateEx(0, NULL, NULL, + WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, + 0,0,0,0, this->m_hWnd, (HMENU)AFX_IDW_PANE_FIRST, pContext ); +#else + m_pSplitter->Create( NULL, NULL, + WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, + CRect(0,0,0,0), this, AFX_IDW_PANE_FIRST, pContext ); +#endif + + m_pOutlinerParent = new CAddrOutlinerParent; +#ifdef _WIN32 + m_pOutlinerParent->CreateEx(WS_EX_CLIENTEDGE, NULL, NULL, + WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, + 0,0,0,0, m_pSplitter->m_hWnd, (HMENU) IDW_RESULTS_PANE, NULL ); +#else + m_pOutlinerParent->Create( NULL, NULL, + WS_BORDER|WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, + CRect(0,0,0,0), m_pSplitter, IDW_RESULTS_PANE ); +#endif + + m_pOutliner = (CAddrOutliner *) m_pOutlinerParent->m_pOutliner; + m_pOutlinerParent->CreateColumns ( ); + m_pOutlinerParent->EnableFocusFrame(TRUE); + m_pOutliner->SetContext( GetContext() ); + m_pOutliner->SetOutlinerOwner(this); + SetMainContext (this); + SetActiveContext (this); + + m_pDirOutlinerParent = new CDirOutlinerParent; +#ifdef _WIN32 + m_pDirOutlinerParent->CreateEx(WS_EX_CLIENTEDGE, NULL, NULL, + WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, + 0,0,0,0, m_pSplitter->m_hWnd, (HMENU) IDW_RESULTS_PANE, NULL ); +#else + m_pDirOutlinerParent->Create( NULL, NULL, + WS_BORDER|WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, + CRect(0,0,0,0), m_pSplitter, IDW_RESULTS_PANE ); +#endif + + m_pDirOutliner = (CDirOutliner *) m_pDirOutlinerParent->m_pOutliner; + m_pDirOutliner->SetOutlinerOwner(this); + m_pDirOutlinerParent->CreateColumns ( ); + m_pDirOutlinerParent->EnableFocusFrame(TRUE); + + + int32 prefInt = -1; + PREF_GetIntPref("mail.addr_book.sliderwidth", &prefInt); + RECT rect; + GetClientRect(&rect); + m_pSplitter->AddPanes(m_pDirOutlinerParent, m_pOutlinerParent, prefInt, TRUE); + } + + return res; +} + + +BOOL CAddrFrame::PreTranslateMessage( MSG* pMsg ) +{ + if (pMsg->message == WM_KEYDOWN) + { + if (pMsg->wParam == VK_DELETE) + { + if (GetFocus() == m_barAddr.GetDlgItem(IDC_ADDRNAME)) { + return FALSE; + } + } + + if (pMsg->wParam == VK_TAB) { + HWND hwndNext = NULL; + HWND hwndFocus = ::GetFocus(); + + HWND hwndDirOutliner = m_pDirOutliner ? m_pDirOutliner->m_hWnd : NULL; + HWND hwndOutliner = m_pOutliner ? m_pOutliner->m_hWnd : NULL; + + HWND hwndAddrBarFirst = ::GetNextDlgTabItem( m_barAddr.m_hWnd, NULL, FALSE ); + + HWND hwndAddrBarLast = ::GetNextDlgTabItem( m_barAddr.m_hWnd, hwndAddrBarFirst, TRUE ); + + if ( GetKeyState(VK_SHIFT) & 0x8000 ) { + + // Tab backward + if ( hwndFocus == hwndAddrBarFirst ) { + // Handle tabbing into outliner + hwndNext = hwndOutliner; + } else if (hwndFocus == hwndOutliner) { + // Handle tabbing out of outliner into the directory list + if (m_pSplitter->IsOnePaneClosed()) + hwndNext = hwndAddrBarLast; + else + hwndNext = hwndDirOutliner; + } else if ( hwndFocus == hwndDirOutliner ) { + // Handle tabbing into the outliner + hwndNext = hwndAddrBarLast; + } + + } else { + + // Tab forward + if (hwndFocus == hwndOutliner) { + // Handle tabbing out of outliner + hwndNext = hwndAddrBarFirst; + } else if ( hwndFocus == hwndAddrBarLast ) { + // handle tabbing into the directory list + if (m_pSplitter->IsOnePaneClosed()) + hwndNext = hwndOutliner; + else + hwndNext = hwndDirOutliner; + } else if (hwndFocus == hwndDirOutliner) { + // Handle tabbing out of the directory list + hwndNext = hwndOutliner; + } + + } + if ( hwndNext ) { + ::SetFocus( hwndNext ); + return TRUE; + } + } // if tab + } // if keydown + return CGenericFrame::PreTranslateMessage(pMsg); +} + + +void CAddrFrame::OnHelpMenu() +{ + NetHelp(HELP_ADDRESS_BOOK); +} + + +void CAddrFrame::Progress(MWContext *pContext, const char *pMessage) +{ + LPNSSTATUSBAR pIStatusBar = NULL; + m_pChrome->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar ); + if ( pIStatusBar ) { + pIStatusBar->SetStatusText(pMessage); + pIStatusBar->Release(); + } +} + + +void CAddrFrame::SetProgressBarPercent(MWContext *pContext, int32 lPercent) +{ + lPercent = lPercent < 0 ? 0 : ( lPercent > 100 ? 100 : lPercent ); + + if ( m_iProgress == lPercent ) { + return; + } + + m_iProgress = lPercent; + if (GetChrome()) { + LPNSSTATUSBAR pIStatusBar = NULL; + GetChrome()->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar ); + if ( pIStatusBar ) { + pIStatusBar->SetProgress( CASTINT(lPercent) ); + pIStatusBar->Release(); + } + } +} + + +STDMETHODIMP CAddrFrame::QueryInterface(REFIID refiid, LPVOID * ppv) +{ + *ppv = NULL; + if (IsEqualIID(refiid,IID_IUnknown)) + *ppv = (LPUNKNOWN) (LPMSGLIST) m_pIAddrList; + else if (IsEqualIID(refiid,IID_IMailFrame)) + *ppv = (LPMAILFRAME) this; + else if (IsEqualIID(refiid,IID_IMsgList)) + *ppv = (LPMSGLIST) m_pIAddrList; + + if (*ppv != NULL) { + AddRef(); + return NOERROR; + } + + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP_(ULONG) CAddrFrame::AddRef(void) +{ + return 0; // Not a real component +} + +STDMETHODIMP_(ULONG) CAddrFrame::Release(void) +{ + return 0; // Not a real component +} + +// IMailFrame interface +CMailNewsFrame *CAddrFrame::GetMailNewsFrame() +{ + return (CMailNewsFrame *) NULL; +} + +MSG_Pane *CAddrFrame::GetPane() +{ + return m_addrBookPane; +} + +MSG_Pane *CAddrFrame::GetResultsPane() +{ + return m_addrBookPane; +} + +MSG_Pane *CAddrFrame::GetContainerPane() +{ + return m_addrContPane; +} + +void CAddrFrame::PaneChanged(MSG_Pane *pane, XP_Bool asynchronous, + MSG_PANE_CHANGED_NOTIFY_CODE notify, int32 value) +{ + switch(notify) + { + case MSG_PaneDirectoriesChanged: + if(pane == m_addrContPane) + { + } + break; + + case MSG_PaneNotifyTypeDownCompleted: + m_pOutliner->OnTypedown(value); + break; + + case MSG_PaneNotifyStartSearching: + StartSearching(); + break; + case MSG_PaneNotifyStopSearching: + m_bSearching = FALSE; + break; + } + +} + +void CAddrFrame::StartSearching() +{ + m_bSearching = TRUE; + //make sure we can update the stop button + LPNSTOOLBAR pIToolBar = NULL; + GetChrome()->QueryInterface( IID_INSToolBar, (LPVOID *) &pIToolBar ); + if ( pIToolBar ) { + CToolbarButton *pButton = pIToolBar->GetButtonByID(ID_NAVIGATE_INTERRUPT); + + if(pButton) + { + pButton->Enable(TRUE); + pButton->Invalidate(); + } + pIToolBar->Release(); + } + GetChrome()->StartAnimation(); +} + + +///////////////////////////////////////////////////////////////////////////// +// CAddrFrame message handlers + +BEGIN_MESSAGE_MAP(CAddrFrame, CGenericFrame) + //{{AFX_MSG_MAP(CAddrFrame) + ON_WM_CREATE() + ON_WM_CLOSE() + ON_WM_SHOWWINDOW( ) + ON_WM_DESTROY() + ON_WM_GETMINMAXINFO() + ON_UPDATE_COMMAND_UI(ID_VIEW_ABTOOLBAR, OnUpdateViewCommandToolbar) + ON_COMMAND(ID_VIEW_ABTOOLBAR, OnViewCommandToolbar) + ON_UPDATE_COMMAND_UI(ID_TOOLS_ADDRESSBOOK, OnUpdateShowAddressBookWindow) + ON_UPDATE_COMMAND_UI(IDS_SECURITY_STATUS, OnUpdateSecureStatus) + ON_COMMAND(ID_FILE_IMPORT, OnImportFile) + ON_UPDATE_COMMAND_UI( ID_FILE_IMPORT, OnUpdateImport ) + ON_COMMAND(ID_FILE_SAVEAS, OnExportFile) + ON_UPDATE_COMMAND_UI( ID_FILE_SAVEAS, OnUpdateExport ) + ON_COMMAND(ID_FILE_CLOSE, OnFileClose) + ON_UPDATE_COMMAND_UI( IDC_DIRSEARCH, OnUpdateSearch ) + ON_COMMAND(IDC_DIRSEARCH, OnExtDirectorySearch) + ON_COMMAND(ID_NAVIGATE_INTERRUPT, OnStopSearch) + ON_UPDATE_COMMAND_UI(ID_NAVIGATE_INTERRUPT, OnUpdateStopSearch) + ON_COMMAND(ID_FILE_NEWMESSAGE, OnComposeMsg) + ON_UPDATE_COMMAND_UI(ID_FILE_NEWMESSAGE, OnUpdateComposeMsg) + ON_COMMAND(ID_LIVE_CALL, OnCall) + ON_UPDATE_COMMAND_UI(ID_LIVE_CALL, OnUpdateCall) + ON_COMMAND(ID_ITEM_ADDUSER, OnAddUser) + ON_UPDATE_COMMAND_UI(ID_ITEM_ADDUSER, OnUpdateAddUser) + ON_COMMAND(ID_FILE_NEWAB, OnAddAB) + ON_UPDATE_COMMAND_UI(ID_FILE_NEWAB, OnUpdateAddAB) + ON_COMMAND(ID_FILE_NEWDIR, OnAddDir) + ON_UPDATE_COMMAND_UI(ID_FILE_NEWDIR, OnUpdateAddDir) + ON_COMMAND(ID_EDIT_DOMAINS, OnHTMLDomains) + ON_UPDATE_COMMAND_UI(ID_EDIT_DOMAINS, OnUpdateHTMLDomains) + ON_COMMAND(ID_ITEM_ADDLIST, OnAddList) + ON_UPDATE_COMMAND_UI(ID_ITEM_ADDLIST, OnUpdateAddList) + ON_COMMAND(ID_EDIT_DELETE, OnDeleteItem) + ON_UPDATE_COMMAND_UI(ID_EDIT_DELETE, OnUpdateDeleteItem) + ON_COMMAND(ID_EDIT_UNDO, OnUndo) + ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateUndo) + ON_COMMAND(ID_EDIT_REDO, OnRedo) + ON_UPDATE_COMMAND_UI(ID_EDIT_REDO, OnUpdateRedo) + ON_COMMAND(ID_ITEM_PROPERTIES, OnItemProperties) + ON_UPDATE_COMMAND_UI(ID_ITEM_PROPERTIES, OnUpdateItemProperties) + ON_COMMAND(ID_SORT_COL0, OnSortColumn0) + ON_UPDATE_COMMAND_UI(ID_SORT_COL0, OnUpdateSortColumn0) + ON_COMMAND(ID_SORT_COL1, OnSortColumn1) + ON_UPDATE_COMMAND_UI(ID_SORT_COL1, OnUpdateSortColumn1) + ON_COMMAND(ID_SORT_COL2, OnSortColumn2) + ON_UPDATE_COMMAND_UI(ID_SORT_COL2, OnUpdateSortColumn2) + ON_COMMAND(ID_SORT_COL3, OnSortColumn3) + ON_UPDATE_COMMAND_UI(ID_SORT_COL3, OnUpdateSortColumn3) + ON_COMMAND(ID_SORT_COL4, OnSortColumn4) + ON_UPDATE_COMMAND_UI(ID_SORT_COL4, OnUpdateSortColumn4) + ON_COMMAND(ID_SORT_COL5, OnSortColumn5) + ON_UPDATE_COMMAND_UI(ID_SORT_COL5, OnUpdateSortColumn5) + ON_COMMAND(ID_SORT_COL6, OnSortColumn6) + ON_UPDATE_COMMAND_UI(ID_SORT_COL6, OnUpdateSortColumn6) + ON_COMMAND(ID_ASCENDING, OnSortAscending) + ON_UPDATE_COMMAND_UI(ID_ASCENDING, OnUpdateSortAscending) + ON_COMMAND(ID_DECENDING, OnSortDescending) + ON_UPDATE_COMMAND_UI(ID_DECENDING, OnUpdateSortDescending) + ON_COMMAND(ID_CREATE_CARD, OnCreateCard) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +int CAddrFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + void WFE_AddNewFrameToFrameList(CGenericFrame * pFrame); + int res = CGenericFrame::OnCreate(lpCreateStruct); + int result = 0; + AB_ContainerInfo * info = NULL; + + HandleErrorReturn((result = AB_CreateABPane(&m_addrBookPane, + GetContext(), + WFE_MSGGetMaster()))); + + if (result) + return -1; + + HandleErrorReturn((result = AB_CreateContainerPane(&m_addrContPane, + GetContext(), + WFE_MSGGetMaster()))); + + if (result) { + AB_ClosePane (m_addrBookPane); + return -1; + } + + HandleErrorReturn((result = AB_InitializeContainerPane(m_addrContPane))); + + if (result) { + AB_ClosePane (m_addrContPane); + AB_ClosePane (m_addrBookPane); + return -1; + } + + info = AB_GetContainerForIndex(m_addrContPane, 0); + + ASSERT (info); + + HandleErrorReturn((result = AB_InitializeABPane(m_addrBookPane, + info))); + if (result) { + AB_ClosePane (m_addrContPane); + AB_ClosePane (m_addrBookPane); + return -1; + } + + //set property sheets for address book pane + HandleErrorReturn((result = AB_SetShowPropertySheetForEntryFunc( + (MSG_Pane *)m_addrBookPane, + ShowPropertySheetForEntry))); + + if (result) { + AB_ClosePane (m_addrContPane); + AB_ClosePane (m_addrBookPane); + return -1; + } + + //set property sheets for container pane + HandleErrorReturn((result = AB_SetShowPropertySheetForEntryFunc( + (MSG_Pane *)m_addrContPane, + ShowPropertySheetForEntry))); + + if (result) { + AB_ClosePane (m_addrContPane); + AB_ClosePane (m_addrBookPane); + return -1; + } + + //set ldap property sheets for container pane + HandleErrorReturn((result = AB_SetShowPropertySheetForDirFunc( + (MSG_Pane *)m_addrContPane, + ShowPropertySheetForDir))); + + if (result) { + AB_ClosePane (m_addrContPane); + AB_ClosePane (m_addrBookPane); + return -1; + } + + int32 prefSortByInt; + XP_Bool prefSortAscending = TRUE; + PREF_GetIntPref("mail.addr_book.sortby", &prefSortByInt); + PREF_GetBoolPref("mail.addr_book.sort_ascending", &prefSortAscending); + AB_SortByAttribute(m_addrBookPane, + (AB_AttribID) (prefSortByInt - 1), + prefSortAscending); + + //I'm hardcoding because I don't want this translated + GetChrome()->CreateCustomizableToolbar("Address_Book"/*ID_ADDRESS_BOOK*/, 3, TRUE); + CButtonToolbarWindow *pWindow; + BOOL bOpen, bShowing; + + int32 nPos; + + //I'm hardcoding because I don't want this translated + GetChrome()->LoadToolbarConfiguration(ID_ADDRESS_BOOK_TOOLBAR, CString("Address_Book_Toolbar"), nPos, bOpen, bShowing); + + LPNSTOOLBAR pIToolBar = NULL; + GetChrome()->QueryInterface( IID_INSToolBar, (LPVOID *) &pIToolBar ); + if ( pIToolBar ) { + pIToolBar->Create( this, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | CBRS_TOP | WS_BORDER); + pIToolBar->SetButtons( AddrCodes, sizeof(AddrCodes)/sizeof(UINT) ); + pIToolBar->SetSizes( CSize( 30, 27 ), CSize( 23, 21 ) ); + pIToolBar->LoadBitmap( MAKEINTRESOURCE( IDB_ADDRESSTOOLBARP ) ); + pIToolBar->SetToolbarStyle( theApp.m_pToolbarStyle ); + pWindow = new CButtonToolbarWindow(CWnd::FromHandlePermanent(pIToolBar->GetHWnd()), theApp.m_pToolbarStyle, 43, 27, eLARGE_HTAB); + GetChrome()->GetCustomizableToolbar()->AddNewWindow(ID_ADDRESS_BOOK_TOOLBAR, pWindow,nPos, 50, 37, 0, CString(szLoadString(ID_ADDRESS_BOOK_TOOLBAR)),theApp.m_pToolbarStyle, bOpen, FALSE); + GetChrome()->ShowToolbar(ID_ADDRESS_BOOK_TOOLBAR, bShowing); +#ifdef XP_WIN16 + GetChrome()->GetCustomizableToolbar()->SetBottomBorder(TRUE); +#endif + + pIToolBar->Release(); + } + + LPNSSTATUSBAR pIStatusBar = NULL; + GetChrome()->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar ); + if ( pIStatusBar ) { + pIStatusBar->Create( this ); + pIStatusBar->Release(); + } + + + m_barAddr.Create( this, IDD_ADDRESSBOOK, CBRS_TOP, 1 ); + // Initially size window to only dialog + title bar. + int BorderX = GetSystemMetrics(SM_CXFRAME); + + CRect rect; + m_barAddr.GetWindowRect(rect); +#ifdef _WIN32 + CSize size = m_barAddr.CalcFixedLayout(FALSE, FALSE); +#else + CSize size = m_barAddr.m_sizeDefault; +#endif + + // Figure height of title bar + bottom border + m_iWidth = size.cx; + + int16 iLeft,iRight,iTop,iBottom; + PREF_GetRectPref("mail.addr_book_window_rect", &iLeft, &iTop, &iRight, &iBottom); + int screenY = ::GetSystemMetrics(SM_CYFULLSCREEN); + int screenX = ::GetSystemMetrics(SM_CXFULLSCREEN); + + if ((iLeft >= 0) && (iTop >= 0) && (iRight < screenX) && (iBottom < screenY)) + { + if (iRight - iLeft > m_iWidth) + size.cx = iRight - iLeft; + size.cy = iBottom - iTop; + SetWindowPos( NULL, iLeft, iTop, size.cx, size.cy, + SWP_HIDEWINDOW); + } + else { + size.cy = 300; + SetWindowPos( NULL, 0, 0, size.cx, size.cy, + SWP_HIDEWINDOW); + + } + + MSG_SetFEData( (MSG_Pane*) m_addrBookPane, (LPVOID) (LPUNKNOWN) (LPMSGLIST) m_pIAddrList ); + MSG_SetFEData( (MSG_Pane*) m_addrContPane, (LPVOID) (LPUNKNOWN) (LPMSGLIST) m_pIAddrList ); + m_pOutliner->SetPane(m_addrBookPane); + m_pDirOutliner->SetPane(m_addrContPane); + m_pDirOutliner->SelectItem(0); + + WFE_AddNewFrameToFrameList(this); + + CFrameWnd::RecalcLayout(); + + if (m_barAddr.m_pFont) + ::SendMessage(::GetDlgItem(m_barAddr.GetSafeHwnd(), IDC_ADDRNAME), + WM_SETFONT, (WPARAM)m_barAddr.m_pFont, FALSE); + if (m_barAddr.m_bRemoveLDAPDir) + m_barAddr.GetDlgItem(IDC_DIRSEARCH)->ShowWindow(SW_HIDE); + m_barAddr.GetDlgItem(IDC_ADDRNAME)->SetFocus(); + + return res; +} + +void CAddrFrame::OnFileClose ( void ) +{ + PostMessage ( WM_CLOSE ); +} + +void CAddrFrame::OnViewCommandToolbar() +{ + GetChrome()->ShowToolbar(ID_ADDRESS_BOOK_TOOLBAR, !GetChrome()->GetToolbarVisible(ID_ADDRESS_BOOK_TOOLBAR)); +} + +void CAddrFrame::OnUpdateViewCommandToolbar(CCmdUI *pCmdUI) +{ + BOOL bShow = GetChrome()->GetToolbarVisible(ID_ADDRESS_BOOK_TOOLBAR); + pCmdUI->SetCheck(bShow); +} + +void CAddrFrame::OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI ) +{ + CGenericFrame::OnGetMinMaxInfo( lpMMI ); + + if (m_iWidth) { + lpMMI->ptMinTrackSize.x = m_iWidth; + } +} + + +void CAddrFrame::OnDestroy() +{ + // DestroyContext will call Interrupt, but if we wait until after DestroyContext + // to call MSG_SearchFree, the MWContext will be gone, and we'll be reading freed memory + if (XP_IsContextBusy (GetContext())) + XP_InterruptContext (GetContext()); + + if (m_addrBookPane) + MSG_SearchFree ((MSG_Pane*) m_addrBookPane); + + CGenericFrame::OnDestroy(); + + if(!IsDestroyed()) { + DestroyContext(); + } +} + + +void CAddrFrame::OnClose() +{ + CRect rect; + WINDOWPLACEMENT wp; + wp.length = sizeof(WINDOWPLACEMENT); + GetWindowPlacement(&wp); + + ASSERT(theApp.m_pAddressWindow == this); + + if ( !IsIconic() && !IsZoomed() ) + { + GetWindowRect ( &rect ); + PREF_SetRectPref("mail.addr_book_window_rect", + (int16) rect.left, (int16) rect.top, (int16) rect.right, (int16) rect.bottom); + } + + PREF_SetIntPref("mail.wfe.addr_book.show_value",(int)wp.showCmd); + PREF_SetIntPref("mail.addr_book.sliderwidth", m_pSplitter->GetPaneSize()); + + //I'm hardcoding because I don't want this translated + GetChrome()->SaveToolbarConfiguration(ID_ADDRESS_BOOK_TOOLBAR, CString("Address_Book_Toolbar")); + + CGenericFrame::OnClose(); +} + + + +void CAddrFrame::ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if ( pane == m_addrBookPane ) { + if ( m_pOutliner ) { + m_pOutliner->MysticStuffStarting( asynchronous, notify, + where, num ); + } + return; + } + if ( pane == m_addrContPane ) { + if ( m_pDirOutliner ) { + m_pDirOutliner->MysticStuffStarting( asynchronous, notify, + where, num ); + } + } +} + +void CAddrFrame::ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + if ( pane == m_addrBookPane ) { + if ( m_pOutliner ) { + m_pOutliner->MysticStuffFinishing( asynchronous, notify, + where, num ); + } + return; + } + if ( pane == m_addrContPane ) { + if ( m_pDirOutliner ) { + m_pDirOutliner->MysticStuffFinishing( asynchronous, notify, + where, num ); + } + } +} + + +void CAddrFrame::SetSearchResults(MSG_ViewIndex index, int32 num) +{ + + CString csStatus; + + ASSERT(m_pOutliner); + AB_LDAPSearchResultsAB2(m_addrBookPane, index, num); + if (num > 1) { + csStatus.Format( szLoadString(IDS_SEARCHHITS), num ); + } else if ( num > 0 ) { + csStatus.LoadString( IDS_SEARCHONEHIT ); + } else { + csStatus.LoadString( IDS_SEARCHNOHITS ); + } + + if (GetChrome()) { + LPNSSTATUSBAR pIStatusBar = NULL; + GetChrome()->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar ); + if ( pIStatusBar ) { + pIStatusBar->SetStatusText(csStatus); + pIStatusBar->Release(); + } + } +} + +void CAddrFrame::DoubleClick() +{ + OnItemProperties(); +} + +CWnd* CAddrFrame::GetOwnerWindow() +{ + return this; +} + +void CAddrFrame::AllConnectionsComplete( MWContext *pContext ) +{ + CStubsCX::AllConnectionsComplete( pContext ); + + if (m_bSearching) { + + OnStopSearch(); + + int32 total = m_pOutliner->GetTotalLines(); + CString csStatus; + if ( total > 1 ) { + csStatus.Format( szLoadString( IDS_SEARCHHITS ), total ); + } else if ( total > 0 ) { + csStatus.LoadString( IDS_SEARCHONEHIT ); + } else { + csStatus.LoadString( IDS_SEARCHNOHITS ); + } + + LPNSSTATUSBAR pIStatusBar = NULL; + m_pChrome->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar ); + if ( pIStatusBar ) { + pIStatusBar->SetStatusText( csStatus ); + pIStatusBar->SetProgress( 0 ); + pIStatusBar->Release(); + } + + SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, (LPARAM)0); + } +} + +void CAddrFrame::Close() +{ + if (theApp.m_pAddressWindow) { + theApp.m_pAddressWindow->PostMessage(WM_CLOSE); + } +} + +void CAddrFrame::OnImportFile() +{ + AB_ImportData(GetCurrentContainerInfo(), + NULL, /* could be a filename or NULL (if type = prompt for filename) or a block of data to be imported */ + 0, /* how big is the buffer? */ + AB_PromptForFileName); /* valid types: All */ +} + +void CAddrFrame::OnExportFile() +{ + AB_ExportData(GetCurrentContainerInfo(), + NULL, /* could be a filename or NULL (if type = prompt for filename) or a block of data to be imported */ + 0, /* how big is the buffer? */ + AB_PromptForFileName); /* valid types: All */ +} + + +void CAddrFrame::OnTypedown (char* name) +{ +#ifdef MOZ_NEWADDR + + HandleErrorReturn(AB_TypedownSearch(m_addrBookPane, name, MSG_VIEWINDEXNONE)); +#else + DIR_Server* dir = GetCurrentDirectoryServer(); + + if (dir->dirType == LDAPDirectory) { + OnDirectoryList(name); + } + else + m_pOutliner->OnTypedown(name); +#endif //MOZ_NEWADDR +} + + +void CAddrFrame::DoAddressBookCommand(MSG_Pane *pPane, AB_CommandType cmd) +{ + + if(pPane) + { + CMSelectOutliner *pOutliner = (pPane == m_addrContPane) ? (CMSelectOutliner*)m_pDirOutliner: + (CMSelectOutliner*)m_pOutliner; + if(pOutliner) + { + MSG_ViewIndex *pIndices; + int count; + + pOutliner->GetSelection(pIndices, count); + HandleErrorReturn(AB_CommandAB2 (pPane, cmd, pIndices, count), this); + } + } + + + +} + +void CAddrFrame::DoUpdateAddressBook( CCmdUI* pCmdUI, AB_CommandType cmd, BOOL bUseCheck ) +{ + if(!pCmdUI) + return; + + XP_Bool bSelectable = FALSE, bPlural = FALSE; + MSG_COMMAND_CHECK_STATE sState; + + MSG_Pane *pPane; + CMSelectOutliner *pOutliner; + + pPane = GetPaneForCommand(cmd); + + pOutliner = (pPane == m_addrContPane) ? + (CMSelectOutliner*)m_pDirOutliner : (CMSelectOutliner*)m_pOutliner; + +/* + // AB_PropertiesCmd depends on which outliner has focus. + if(cmd == AB_PropertiesCmd) + { + CWnd *pFocus = CWnd::GetFocus(); + + pPane = (pFocus == m_pDirOutliner) ? m_addrContPane : m_addrBookPane; + pOutliner = (pFocus == m_pDirOutliner) ? + (CMSelectOutliner*)m_pDirOutliner : (CMSelectOutliner*)m_pOutliner; + + } +*/ + if (pPane) { + if (pOutliner) { + MSG_ViewIndex *indices; + int count; + pOutliner->GetSelection(indices, count); + AB_CommandStatusAB2(pPane, + cmd, + indices, count, + &bSelectable, + &sState, + NULL, + &bPlural); + } else { + AB_CommandStatusAB2(pPane, + cmd, + NULL, 0, + &bSelectable, + &sState, + NULL, + &bPlural); + } + } + pCmdUI->Enable(bSelectable); + if (bUseCheck) + pCmdUI->SetCheck(sState == MSG_Checked); + else + pCmdUI->SetRadio(sState == MSG_Checked); +} + +MSG_Pane * CAddrFrame::GetPaneForCommand(AB_CommandType cmd) +{ + + switch(cmd) + { + case AB_NewMessageCmd: + case AB_LDAPSearchCmd: + case AB_SortByColumnID0: + case AB_SortByColumnID1: + case AB_SortByColumnID2: + case AB_SortByColumnID3: + case AB_SortByColumnID4: + case AB_SortByColumnID5: + case AB_SortByColumnID6: + case AB_SortDescending: + case AB_SortAscending: + case AB_CallCmd: + case AB_SaveCmd: + case AB_ImportCmd: + return m_addrBookPane; + break; + case AB_NewLDAPDirectory: + case AB_NewAddressBook: + return m_addrContPane; + break; + case AB_DeleteCmd: + case AB_DeleteAllCmd: + case AB_PropertiesCmd: + case AB_AddUserCmd: + case AB_AddMailingListCmd: + case AB_CloseCmd: + return GetFocusPane(); + break; + case AB_ImportLdapEntriesCmd: + return GetFocusPane(); + break; + default: + return GetFocusPane(); + break; + } +} + + + +MSG_Pane * CAddrFrame::GetFocusPane() +{ + MSG_Pane *pFocusPane; + + CWnd *pFocusWnd = CWnd::GetFocus(); + + pFocusPane = (pFocusWnd == m_pDirOutliner) ? m_addrContPane : m_addrBookPane; + + return pFocusPane; + + +} + +void CAddrFrame::OnExtDirectorySearch() +{ + m_barAddr.OnExtDirectorySearch(); +} + +void CAddrFrame::OnUpdateShowAddressBookWindow( CCmdUI *pCmdUI ) +{ + pCmdUI->Enable(FALSE); +} + +void CAddrFrame::OnUpdateSecureStatus(CCmdUI *pCmdUI) +{ + HG28728 + pCmdUI->Enable(FALSE); +} + +void CAddrFrame::OnUpdateSearch( CCmdUI *pCmdUI ) +{ + DoUpdateAddressBook(pCmdUI, AB_LDAPSearchCmd, TRUE); +} + +void CAddrFrame::OnUpdateImport(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_ImportCmd, TRUE); +} + +void CAddrFrame::OnUpdateExport(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_SaveCmd, TRUE); +} + +void CAddrFrame::OnUpdateSortColumn0(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_SortByColumnID0, TRUE); +} + +void CAddrFrame::OnUpdateSortColumn1(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_SortByColumnID1, TRUE); +} + +void CAddrFrame::OnUpdateSortColumn2(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_SortByColumnID2, TRUE); +} + +void CAddrFrame::OnUpdateSortColumn3(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_SortByColumnID3, TRUE); +} + +void CAddrFrame::OnUpdateSortColumn4(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_SortByColumnID4, TRUE); +} + +void CAddrFrame::OnUpdateSortColumn5(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_SortByColumnID5, TRUE); +} + +void CAddrFrame::OnUpdateSortColumn6(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_SortByColumnID6, TRUE); +} + +void CAddrFrame::OnUpdateSortAscending(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_SortAscending, TRUE); +} + +void CAddrFrame::OnUpdateSortDescending(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_SortDescending, TRUE); +} + +void CAddrFrame::OnUpdateComposeMsg(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_NewMessageCmd); +} + +void CAddrFrame::OnUpdateStopSearch(CCmdUI* pCmdUI) +{ + pCmdUI->Enable(m_bSearching); +} + +void CAddrFrame::OnUpdateAddUser(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_AddUserCmd); +} + +void CAddrFrame::OnUpdateAddList(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_AddMailingListCmd); +} + +void CAddrFrame::OnUpdateAddAB(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_NewAddressBook); +} + +void CAddrFrame::OnUpdateAddDir(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_NewLDAPDirectory); +} + +void CAddrFrame::OnUpdateItemProperties(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_PropertiesCmd); +} + +void CAddrFrame::OnUpdateCall(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_CallCmd); +} + +void CAddrFrame::OnUpdateDeleteItem(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_DeleteCmd); +} + +void CAddrFrame::OnUpdateUndo(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_UndoCmd); +} + +void CAddrFrame::OnUpdateRedo(CCmdUI* pCmdUI) +{ + DoUpdateAddressBook(pCmdUI, AB_RedoCmd); +} + +void CAddrFrame::OnAddUser ( void ) +{ + DoAddressBookCommand(GetFocusPane(), AB_AddUserCmd); +} + +void CAddrFrame::OnAddAB ( void ) +{ + DoAddressBookCommand(m_addrContPane, AB_NewAddressBook); +} + +void CAddrFrame::OnAddDir ( void ) +{ + DoAddressBookCommand(m_addrContPane, AB_NewLDAPDirectory); +} + +void CAddrFrame::OnHTMLDomains ( void ) +{ + MSG_DisplayHTMLDomainsDialog(GetContext()); +} + +void CAddrFrame::OnUpdateHTMLDomains( CCmdUI *pCmdUI ) +{ + pCmdUI->Enable( TRUE ); +} + +void CAddrFrame::OnUpdateEditCut(CCmdUI* pCmdUI) +{ + +} + +void CAddrFrame::OnUpdateEditCopy(CCmdUI* pCmdUI) +{ + +} + +void CAddrFrame::OnUpdateDeleteFromAll(CCmdUI* pCmdUI) +{ + +} + +void CAddrFrame::OnUpdateSelectAll(CCmdUI* pCmdUI) +{ + +} + +void CAddrFrame::OnUpdateDirectoryPane(CCmdUI* pCmdUI) +{ + pCmdUI->Enable( TRUE ); +} + +void CAddrFrame::OnEditCut ( ) +{ + +} + +void CAddrFrame::OnEditCopy ( ) +{ + +} + +void CAddrFrame::OnEditDeleteFromAll ( ) +{ + +} + +void CAddrFrame::OnSelectAll ( ) +{ + +} + +void CAddrFrame::OnDirectoryPane ( ) +{ + +} + +void CAddrFrame::OnCreateCard ( void ) +{ + HandleErrorReturn(AB_CommandAB2 (GetFocusPane(), AB_AddUserCmd, 0, 0), this); +} + +DIR_Server * CAddrFrame::GetCurrentDirectoryServer() +{ + return (AB_GetDirServerForContainer(AB_GetContainerForIndex(m_addrContPane, m_pDirOutliner->GetDirectoryIndex()))); +} + +AB_ContainerInfo * CAddrFrame::GetCurrentContainerInfo () +{ + return (AB_GetContainerForIndex(m_addrContPane, m_pDirOutliner->GetDirectoryIndex())); +} + +void CAddrFrame::OnAddList ( void ) +{ + DoAddressBookCommand(GetFocusPane(), AB_AddMailingListCmd); +} + + +void CAddrFrame::OnDeleteItem() +{ + MSG_ViewIndex *indices; + int count; + + HWND hwndFocus = ::GetFocus(); + + HWND hwndDirOutliner = m_pDirOutliner ? m_pDirOutliner->m_hWnd : NULL; + HWND hwndOutliner = m_pOutliner ? m_pOutliner->m_hWnd : NULL; + + SetCursor ( theApp.LoadStandardCursor ( IDC_WAIT ) ); + + if (hwndFocus == hwndDirOutliner) { + + m_pDirOutliner->GetSelection(indices, count); + + HandleErrorReturn(AB_CommandAB2 (m_addrContPane, AB_DeleteCmd, indices, count), this); + m_pDirOutliner->UpdateCount(); + if ((m_pDirOutliner->GetFocusLine() > m_pDirOutliner->GetTotalLines() - 1)) + m_pDirOutliner->SelectItem(m_pDirOutliner->GetTotalLines() - 1); + else + m_pDirOutliner->SelectItem(m_pDirOutliner->GetFocusLine()); + } + else { + m_pOutliner->GetSelection(indices, count); + + HandleErrorReturn(AB_CommandAB2 (m_addrBookPane, AB_DeleteCmd, indices, count), this); + m_pOutliner->UpdateCount(); + if ((m_pOutliner->GetFocusLine() > m_pOutliner->GetTotalLines() - 1)) + m_pOutliner->SelectItem(m_pOutliner->GetTotalLines() - 1); + else + m_pOutliner->SelectItem(m_pOutliner->GetFocusLine()); + } + + SetCursor ( theApp.LoadStandardCursor ( IDC_ARROW ) ); +} + + +void CAddrFrame::OnUndo() +{ + HWND hwndFocus = ::GetFocus(); + + HWND hwndDirOutliner = m_pDirOutliner ? m_pDirOutliner->m_hWnd : NULL; + HWND hwndOutliner = m_pOutliner ? m_pOutliner->m_hWnd : NULL; + + SetCursor ( theApp.LoadStandardCursor ( IDC_WAIT ) ); + + if (hwndFocus == hwndDirOutliner) { + HandleErrorReturn(AB_CommandAB2 (m_addrContPane, AB_UndoCmd, 0, 0), this); + m_pDirOutliner->UpdateCount(); + if ((m_pDirOutliner->GetFocusLine() > m_pDirOutliner->GetTotalLines() - 1)) + m_pDirOutliner->SelectItem(m_pDirOutliner->GetTotalLines() - 1); + else + m_pDirOutliner->SelectItem(m_pDirOutliner->GetFocusLine()); + } + else { + HandleErrorReturn(AB_CommandAB2 (m_addrBookPane, AB_UndoCmd, 0, 0), this); + m_pOutliner->UpdateCount(); + if ((m_pOutliner->GetFocusLine() > m_pOutliner->GetTotalLines() - 1)) + m_pOutliner->SelectItem(m_pOutliner->GetTotalLines() - 1); + else + m_pOutliner->SelectItem(m_pOutliner->GetFocusLine()); + + } + + SetCursor ( theApp.LoadStandardCursor ( IDC_ARROW ) ); +} + + +void CAddrFrame::OnRedo() +{ + HWND hwndFocus = ::GetFocus(); + + HWND hwndDirOutliner = m_pDirOutliner ? m_pDirOutliner->m_hWnd : NULL; + HWND hwndOutliner = m_pOutliner ? m_pOutliner->m_hWnd : NULL; + + SetCursor ( theApp.LoadStandardCursor ( IDC_WAIT ) ); + + if (hwndFocus == hwndDirOutliner) { + HandleErrorReturn(AB_CommandAB2 (m_addrContPane, AB_RedoCmd, 0, 0), this); + m_pDirOutliner->UpdateCount(); + if ((m_pDirOutliner->GetFocusLine() > m_pDirOutliner->GetTotalLines() - 1)) + m_pDirOutliner->SelectItem(m_pDirOutliner->GetTotalLines() - 1); + else + m_pDirOutliner->SelectItem(m_pDirOutliner->GetFocusLine()); + } + else { + HandleErrorReturn(AB_CommandAB2 (m_addrBookPane, AB_RedoCmd, 0, 0), this); + m_pOutliner->UpdateCount(); + if ((m_pOutliner->GetFocusLine() > m_pOutliner->GetTotalLines() - 1)) + m_pOutliner->SelectItem(m_pOutliner->GetTotalLines() - 1); + else + m_pOutliner->SelectItem(m_pOutliner->GetFocusLine()); + + } + + SetCursor ( theApp.LoadStandardCursor ( IDC_ARROW ) ); +} + +void CAddrFrame::OnComposeMsg() +{ + MSG_ViewIndex *indices; + int count; + m_pOutliner->GetSelection(indices, count); + HandleErrorReturn(AB_CommandAB2 (m_addrBookPane, AB_NewMessageCmd, indices, count), this); +} + +void CAddrFrame::OnItemProperties() +{ + MSG_ViewIndex *indices; + int count; + HWND hwndFocus = ::GetFocus(); + + + HWND hwndDirOutliner = m_pDirOutliner ? m_pDirOutliner->m_hWnd : NULL; + HWND hwndOutliner = m_pOutliner ? m_pOutliner->m_hWnd : NULL; + + if (hwndFocus == hwndOutliner) { + m_pOutliner->GetSelection(indices, count); + HandleErrorReturn(AB_CommandAB2 (m_addrBookPane, AB_PropertiesCmd, indices, count), this); + } + if (hwndFocus == hwndDirOutliner) { + m_pDirOutliner->GetSelection(indices, count); + HandleErrorReturn(AB_CommandAB2 (m_addrContPane, AB_PropertiesCmd, indices, count), this); + } +} + +void CAddrFrame::OnCall() +{ + CString ipAddress; + CString emailAddress; + short useServer = 0; + AB_AttribID attribs [5] = {AB_attribEntryType, AB_attribCoolAddress, AB_attribEmailAddress, + AB_attribUseServer, AB_attribFullName }; + AB_AttributeValue * values; + uint16 numItems = 5; + + char szCommandLine[_MAX_PATH]; + + // check the entry type and add/remove pages + AB_GetEntryAttributesForPane(m_addrBookPane, m_pOutliner->GetFocusLine(), + attribs, &values, &numItems); + + if (values[0].u.entryType != AB_Person) { + CString s; + if (s.LoadString( IDS_BOOKMARK_ADDRESSPROPERTIES )) + MessageBox(XP_GetString (MK_MSG_CANT_CALL_MAILING_LIST), s, MB_OK | MB_APPLMODAL); + return; + } + + // check that info exists for this person + ipAddress = values[1].u.string; + emailAddress = values[2].u.string; + + if ((values[3].u.shortValue == kSpecificDLS || values[3].u.shortValue == kHostOrIPAddress) + && !ipAddress.GetLength()) { + CString s; + if (s.LoadString( IDS_BOOKMARK_ADDRESSPROPERTIES )) + MessageBox(XP_GetString (MK_MSG_CALL_NEEDS_IPADDRESS), s, MB_OK | MB_APPLMODAL); + OnItemProperties(); + AB_FreeEntryAttributeValues(values, numItems); + return; + } + + if ((useServer == kSpecificDLS || useServer == kDefaultDLS) && !emailAddress.GetLength()) { + CString s; + if (s.LoadString( IDS_BOOKMARK_ADDRESSPROPERTIES )) + MessageBox(XP_GetString (MK_MSG_CALL_NEEDS_EMAILADDRESS), s, MB_OK | MB_APPLMODAL); + OnItemProperties(); + AB_FreeEntryAttributeValues(values, numItems); + return; + } + + strcpy (szCommandLine, ""); + + if (useServer == 0) + { + CString emailFlag = FEU_GetConfAppProfileString(IDS_CONFAPP_EMAIL); + + if (!emailFlag.IsEmpty()) + { + strcat(szCommandLine, emailFlag); + strcat(szCommandLine, " "); + strcat(szCommandLine, emailAddress); + } + } + else { + if (useServer == 1) + { + CString emailFlag = FEU_GetConfAppProfileString(IDS_CONFAPP_EMAIL); + if (!emailFlag.IsEmpty()) + { + strcat(szCommandLine, emailFlag); + strcat(szCommandLine, " "); + strcat(szCommandLine, emailAddress); + strcat(szCommandLine, " "); + } + + CString serverFlag = FEU_GetConfAppProfileString(IDS_CONFAPP_SERVER); + if (!serverFlag.IsEmpty()) + { + strcat(szCommandLine, serverFlag); + strcat(szCommandLine, " "); + strcat(szCommandLine, ipAddress); + } + } + else { + CString directFlag = FEU_GetConfAppProfileString(IDS_CONFAPP_DIRECTIP); + + if (!directFlag.IsEmpty()) + { + strcat(szCommandLine, directFlag); + strcat(szCommandLine, " "); + strcat(szCommandLine, ipAddress); + } + } + } + + // + // Something a bit new...this will be here for passing a users name at the + // end of a command line. + // + CString userNameFlag = FEU_GetConfAppProfileString(IDS_CONFAPP_USERNAME); + + if (!userNameFlag.IsEmpty()) + { + strcat(szCommandLine, " "); + strcat(szCommandLine, userNameFlag); + strcat(szCommandLine, " "); + strcat(szCommandLine, values[4].u.string); + } + // + //RHP - Launch conference app + // + AB_FreeEntryAttributeValues(values, numItems); + LaunchConfEndpoint(szCommandLine, GetSafeHwnd()); +} + +void CAddrFrame::OnSortColumn0() +{ + m_pOutlinerParent->ColumnCommand ( AB_ColumnFEID0 ); +} + +void CAddrFrame::OnSortColumn1() +{ + m_pOutlinerParent->ColumnCommand ( AB_ColumnFEID1 ); +} + +void CAddrFrame::OnSortColumn2() +{ + m_pOutlinerParent->ColumnCommand ( AB_ColumnFEID2 ); +} + +void CAddrFrame::OnSortColumn3() +{ + m_pOutlinerParent->ColumnCommand ( AB_ColumnFEID3 ); +} + +void CAddrFrame::OnSortColumn4() +{ + m_pOutlinerParent->ColumnCommand ( AB_ColumnFEID4 ); +} + +void CAddrFrame::OnSortColumn5() +{ + m_pOutlinerParent->ColumnCommand ( AB_ColumnFEID5 ); +} + +void CAddrFrame::OnSortColumn6() +{ + m_pOutlinerParent->ColumnCommand ( AB_ColumnFEID6 ); +} + +void CAddrFrame::OnSortAscending() +{ + m_pOutlinerParent->ColumnCommand ( m_pOutliner->GetSortBy() ); +} + +void CAddrFrame::OnSortDescending() +{ + m_pOutlinerParent->ColumnCommand ( m_pOutliner->GetSortBy() ); +} + +void CAddrFrame::HandleErrorReturn(int XPErrorId, CWnd* parent, int errorid) +{ + if (errorid) { + CString s; + HWND parentWnd = NULL; + if (parent) + parentWnd = parent->m_hWnd; + if (s.LoadString( IDS_BOOKMARK_ADDRESSPROPERTIES )) { + if (XPErrorId) + ::MessageBox(parentWnd, XP_GetString(XPErrorId), s, MB_OK | MB_APPLMODAL); + else { + CString s2; + s2.LoadString (errorid); + ::MessageBox(parentWnd, s2, s, MB_OK | MB_APPLMODAL); + } + } + } +} + + +void CAddrFrame::OnSave() +{} + + + +void CAddrFrame::OnUpdateDirectorySelection (int dirIndex, BOOL indexChanged) +{ + // the user has selected a different directory in the left pane + if (indexChanged) { + m_pOutliner->SetDirectoryIndex(dirIndex); + HandleErrorReturn(AB_ChangeABContainer(m_addrBookPane, GetCurrentContainerInfo()), this); + } + DIR_Server* dir = GetCurrentDirectoryServer(); + + m_barAddr.ChangeDirectoryName (dir->description); + m_barAddr.ClearSavedText(); +} + + +void CAddrFrame::OnStopSearch () +{ + CWnd* widget2 = m_barAddr.GetDlgItem (IDC_DIRSEARCH); + // We've hit the stop button + HandleErrorReturn(AB_FinishSearchAB2(m_addrBookPane)); + m_bSearching = FALSE; + GetChrome()->StopAnimation(); + widget2->EnableWindow(TRUE); + m_pDirOutliner->EnableWindow(TRUE); + + MSG_ViewIndex *indices = NULL; + int count = 0; + m_pOutliner->GetSelection(indices, count); + if (!count) + m_pOutliner->SelectItem (0); + return; +} + +void CAddrFrame::OnExtendedDirectorySearch () +{ + CWnd* widget2 = m_barAddr.GetDlgItem (IDC_DIRSEARCH); + + if (m_bSearching) { + OnStopSearch(); + return; + } + + + CSearchDialog searchDlg ((UINT) IDS_ADRSEARCH, + (MSG_Pane*) m_addrBookPane, + GetCurrentDirectoryServer(), + this); + int result = searchDlg.DoModal(); + + // Build Search + if (result == IDOK) + { + GetChrome()->StartAnimation(); + LPNSSTATUSBAR pIStatusBar = NULL; + m_pChrome->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar ); + if ( pIStatusBar ) { + pIStatusBar->SetStatusText(szLoadString( IDS_SEARCHING )); + pIStatusBar->Release(); + } + + m_bSearching = TRUE; + m_barAddr.GetDlgItem(IDC_ADDRNAME)->SetWindowText(CString (szLoadString(IDS_SEARCHRESULTS))); + widget2->EnableWindow(FALSE); + m_pOutliner->SetTotalLines(0); + m_pOutliner->SetFocus(); + m_pOutliner->SetFocusLine(0); + m_pDirOutliner->EnableWindow(FALSE); + + HandleErrorReturn(AB_SearchDirectoryAB2(m_addrBookPane, NULL), this); + } + +} + +void CAddrFrame::OnDirectoryList (char * name) +{ + CString cs; + CWnd* widget2 = m_barAddr.GetDlgItem(IDC_DIRSEARCH); + + // Build Search + GetChrome()->StartAnimation(); + LPNSSTATUSBAR pIStatusBar = NULL; + m_pChrome->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar ); + if ( pIStatusBar ) { + pIStatusBar->SetStatusText(szLoadString( IDS_SEARCHING )); + pIStatusBar->Release(); + } + m_bSearching = TRUE; + widget2->EnableWindow(FALSE); + m_pDirOutliner->EnableWindow(FALSE); + + HandleErrorReturn(AB_SearchDirectoryAB2(m_addrBookPane, name), this); + m_pOutliner->UpdateCount(); +} + +////////////////////////////////////////////////////////////////////////////// +// CAddrOutliner +BEGIN_MESSAGE_MAP(CAddrOutliner, CMSelectOutliner) + //{{AFX_MSG_MAP(CAddrOutliner) + ON_WM_KEYDOWN() + ON_WM_TIMER() + ON_WM_KILLFOCUS() + ON_WM_SIZE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +CAddrOutliner::CAddrOutliner ( ) +{ + int32 prefInt; + PREF_GetIntPref("mail.addr_book.sortby",&prefInt); + // MW fix this should be moved to the create where + // we know the directory and can figure out if we can + // sort by the attribute in a particular column + if (prefInt != ID_COLADDR_NAME && prefInt != ID_COLADDR_EMAIL + && prefInt != ID_COLADDR_NICKNAME) + prefInt = ID_COLADDR_NAME; + + m_attribSortBy = CASTINT(prefInt); + ApiApiPtr(api); + m_pUnkUserImage = api->CreateClassInstance(APICLASS_IMAGEMAP); + if (m_pUnkUserImage) { + m_pUnkUserImage->QueryInterface(IID_IImageMap,(LPVOID*)&m_pIUserImage); + ASSERT(m_pIUserImage); + m_pIUserImage->Initialize(IDB_ADDRESSBOOK,16,16); + } + XP_Bool prefBool; + PREF_GetBoolPref("mail.addr_book.sort_ascending",&prefBool); + m_bSortAscending = prefBool; + m_iMysticPlane = 0; + m_hFont = NULL; + m_psTypedown = ""; + m_uTypedownClock = 0; + m_pEntryValues = NULL; + m_intNumAttribs = 0; + m_pane = NULL; + m_pOutlinerOwner = NULL; +} + +CAddrOutliner::~CAddrOutliner ( ) +{ + if (m_pUnkUserImage) { + if (m_pIUserImage) + m_pUnkUserImage->Release(); + } + if (m_hFont) { + theApp.ReleaseAppFont(m_hFont); + } + +} + +void CAddrOutliner::OnKillFocus( CWnd* pNewWnd ) +{ + CMSelectOutliner::OnKillFocus (pNewWnd ); + m_psTypedown = ""; + KillTimer(m_uTypedownClock); +} + +void CAddrOutliner::OnTypedown(int32 index) +{ + + ScrollIntoView(CASTINT(index)); + SelectItem (CASTINT(index)); + +} +void CAddrOutliner::OnTypedown (char* name) +{ + int startIndex; + + if (GetFocusLine() != -1) + startIndex = GetFocusLine(); + else + startIndex = 0; + + // This will eventually cause OnTypedown(int32 index) to + // get called. + AB_TypedownSearch(m_pane, name, MSG_VIEWINDEXNONE); + // AB_GetIndexMatchingTypedown(m_pane, &index, + // (LPCTSTR) name, startIndex); + +// ScrollIntoView(CASTINT(index)); +// SelectItem (CASTINT(index)); +} + +HFONT CAddrOutliner::GetLineFont(void *pLineData) +{ + if (!m_hFont) + { + HDC hDC = ::GetDC(m_hWnd); + LOGFONT lf; + memset(&lf,0,sizeof(LOGFONT)); + + lf.lfPitchAndFamily = FF_SWISS; + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = IntlGetLfCharset(CIntlWin::GetSystemLocaleCsid()); + if (CIntlWin::GetSystemLocaleCsid() == CS_LATIN1) + _tcscpy(lf.lfFaceName, "MS Sans Serif"); + else + _tcscpy(lf.lfFaceName, IntlGetUIPropFaceName(CIntlWin::GetSystemLocaleCsid())); + lf.lfHeight = -MulDiv(9, ::GetDeviceCaps(hDC, LOGPIXELSY), 72); + m_hFont = theApp.CreateAppFont( lf ); + ::ReleaseDC(m_hWnd,hDC); + } + return m_hFont; +} + + +void CAddrOutliner::SetDirectoryIndex (int dirIndex) +{ + int numAttribs = ID_RESULTS_COLNUM; + AB_ContainerInfo *container = NULL; + if(m_pOutlinerOwner != NULL) + { + container = m_pOutlinerOwner->GetCurrentContainerInfo(); + } + + AB_GetColumnAttribIDs(container, + m_EntryAttrib, /* FE allocated array of attribs. BE fills with values */ + &numAttribs); /* FE passes in # elements allocated in array. BE returns # elements filled */ + + int iCount = GetNumColumns(); + for (int i = 0; i < iCount; i++) { + int iColumn = GetColumnAtPos(i); + AB_ColumnInfo * columnInfo = NULL; + columnInfo = AB_GetColumnInfo(container, (AB_ColumnID) (iColumn - 1)); + if (columnInfo && columnInfo->displayString) + SetColumnName(iColumn, columnInfo->displayString); + AB_FreeColumnInfo(columnInfo); + } + ClearSelection(); + GetParent()->Invalidate(); + GetParent()->UpdateWindow(); + SelectItem(0); +} + +void CAddrOutliner::UpdateCount( ) +{ + uint32 count; + + count = MSG_GetNumLines(m_pane); + m_iTotalLines = CASTINT(count); + if (!m_iTotalLines) + ClearSelection(); +} + + +BOOL CAddrOutliner::DeleteItem ( int iLine ) +{ + XP_Bool bSelectable, bPlural; + MSG_ViewIndex indices[1]; + indices[0] = (MSG_ViewIndex) iLine; + MSG_COMMAND_CHECK_STATE sState; + AB_CommandStatusAB2( m_pane, + AB_DeleteCmd, + indices, 1, + &bSelectable, + &sState, + NULL, + &bPlural); + if (bSelectable) { + AB_CommandAB2 ( m_pane, AB_DeleteCmd, indices, 1 ); + return TRUE; + } + else + MessageBeep(0); + return FALSE; +} + +BOOL CAddrOutliner::IsSelected ( int iLine ) +{ + + if(AB_UseExtendedSelection(m_pane)) + { + return AB_IsSelected(m_pane, iLine); + } + else + { + return CMSelectOutliner::IsSelected(iLine); + } +} + + +void CAddrOutliner::AddSelection( MSG_ViewIndex iSel ) +{ + if(AB_UseExtendedSelection(m_pane)) + { + AB_AddSelection(m_pane, iSel); + } + CMSelectOutliner::AddSelection(iSel); + +} + +void CAddrOutliner::RemoveSelection( MSG_ViewIndex iSel ) +{ + if(AB_UseExtendedSelection(m_pane)) + { + AB_RemoveSelection(m_pane, iSel); + } + CMSelectOutliner::RemoveSelection(iSel); + +} + +void CAddrOutliner::RemoveSelectionRange( MSG_ViewIndex iSelBegin, MSG_ViewIndex iSelEnd ) +{ + + if(AB_UseExtendedSelection(m_pane)) + { + for(MSG_ViewIndex i = iSelBegin; i <= iSelEnd; i++) + { + AB_RemoveSelection(m_pane, i); + } + } + + CMSelectOutliner::RemoveSelectionRange(iSelBegin, iSelEnd); + +} + +void CAddrOutliner::ClearSelection() +{ + if(AB_UseExtendedSelection(m_pane)) + { + + AB_RemoveAllSelections(m_pane); + } + CMSelectOutliner::ClearSelection(); + +} + +void CAddrOutliner::SetPane(MSG_Pane *pane) +{ + m_pane = pane; + uint32 count; + + if (m_pane) { + count = MSG_GetNumLines(m_pane); + SetTotalLines(CASTINT(count)); + Invalidate(); + UpdateWindow(); + AB_SetFEPageSizeForPane (m_pane, GetNumberVisibleRows ()); + } +} + +void CAddrOutliner::OnSize(UINT nType, int cx, int cy ) +{ + CMSelectOutliner::OnSize(nType, cx, cy); + if (m_pane) + AB_SetFEPageSizeForPane (m_pane, GetNumberVisibleRows ()); +} + +void CAddrOutliner::MysticStuffStarting( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num ) +{ + + if ( notify == MSG_NotifyLDAPTotalContentChanged) { + // save off what was selected + } + + if(notify == MSG_NotifyAll) + { + //keep track of current entry id + CAddrFrame::HandleErrorReturn(AB_GetABIDForIndex(m_pane,m_iSelection,&m_selectedID)); + } + ++m_iMysticPlane; +} + +void CAddrOutliner::MysticStuffFinishing( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num ) +{ + uint32 count = 0; + + switch ( notify ) { + case MSG_NotifyNone: + break; + + case MSG_NotifyInsertOrDelete: + // if its insert or delete then tell my frame to add the next chunk of values + // from the search + if (notify == MSG_NotifyInsertOrDelete + && m_pOutlinerOwner && m_pOutlinerOwner->IsSearching() && num > 0) + { + m_pOutlinerOwner->SetSearchResults(where, num); + HandleInsert(where, num); + } + else + { + if (num > 0) + HandleInsert(where, num); + else + HandleDelete(where, -num); + } + // count = MSG_GetNumLines(m_pane); + // SetTotalLines(CASTINT(count)); + break; + + case MSG_NotifyChanged: + InvalidateLines( (int) where, (int) num ); + break; + + case MSG_NotifyAll: + count = MSG_GetNumLines(m_pane); + SetTotalLines(CASTINT(count)); + ABID selectedID; + CAddrFrame::HandleErrorReturn(AB_GetABIDForIndex(m_pane,m_iSelection,&selectedID)); + //if the selection changed it's no longer valid and select 1st one + if(selectedID != m_selectedID || selectedID == 0) + { + SelectItem(0); + } + Invalidate(); + break; + + case MSG_NotifyScramble: + Invalidate(); + break; + + case MSG_NotifyLDAPTotalContentChanged: + // reselect indexes based + SetTotalLines(CASTINT(num)); + Invalidate(); + break; + + case MSG_NotifyNewTopIndex: + m_iTopLine = where; + Invalidate(); + break; + } + + if (( !--m_iMysticPlane && m_pane)) { + // Invalidate(); + UpdateWindow(); + } +} + +void CAddrOutliner::PropertyMenu ( int iSel, UINT flags ) +{ + BOOL bHasItems = FALSE; + CMenu cmPopup; + CString cs; + + SetFocus(); + if(cmPopup.CreatePopupMenu() == 0) + return; + + if (iSel < m_iTotalLines) { + cs.LoadString(ID_POPUP_MAILNEW); + cmPopup.AppendMenu(MF_ENABLED, ID_FILE_NEWMESSAGE, cs); + cmPopup.AppendMenu(MF_SEPARATOR); + cs.LoadString(IDS_AB_NEW_USER); + cmPopup.AppendMenu(MF_ENABLED, ID_ITEM_ADDUSER, cs); + cs.LoadString(IDS_AB_NEW_LIST); + cmPopup.AppendMenu(MF_ENABLED, ID_ITEM_ADDLIST, cs); + cmPopup.AppendMenu(MF_SEPARATOR); + cs.LoadString(ID_POPUP_CUT); + cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_CUT, cs); + cs.LoadString(ID_POPUP_COPY); + cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_COPY, cs); + cs.LoadString(ID_POPUP_PASTE); + cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_PASTE, cs); + cs.LoadString(IDS_COMPOSE_REMOVE); + cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_DELETE, cs); + cs.LoadString(IDS_DELETEFROMALL); + cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_DELETEALL, cs); + cmPopup.AppendMenu(MF_SEPARATOR); + cs.LoadString(IDS_POPUP_PROPERTIES); + cmPopup.AppendMenu(MF_ENABLED, ID_ITEM_PROPERTIES, cs); + bHasItems = TRUE; + } + + // Track the popup now. + POINT pt = m_ptHit; + ClientToScreen(&pt); + + cmPopup.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, + m_pOutlinerOwner->GetOwnerWindow(), NULL); + + // Cleanup + cmPopup.DestroyMenu(); +} + +void CAddrOutliner::AcceptDrop( int iLineNo, COleDataObject *pDataObject, + DROPEFFECT dropEffect ) +{ + if(!pDataObject) + return; + + // Dont allow us to drop on ourselves + if(pDataObject->IsDataAvailable(m_cfSourceTarget)) + return; + + // check if we are dropping from the left hand pane + if ( pDataObject->IsDataAvailable( m_cfDirIndexes ) ) { + + AB_ContainerInfo *pContInfo = AB_GetContainerForIndex(m_pane, iLineNo); + HGLOBAL hContent = pDataObject->GetGlobalData (m_cfDirIndexes); + AddressBookDragData *pDragData = (AddressBookDragData *) GlobalLock(hContent); + + AB_DragEffect requireEffect = AB_Default_Drag; + if (dropEffect & DROPEFFECT_MOVE) + requireEffect = AB_Require_Move; + else if (dropEffect & DROPEFFECT_COPY) + requireEffect = AB_Require_Copy; + + // call new drag drop calls that handle indexes + AB_DragEntriesIntoContainer( pDragData->m_pane, pDragData->m_indices, pDragData->m_count, + pContInfo, requireEffect); /* copy or move? */ + + return; + } + + if(!pDataObject->IsDataAvailable(m_cfAddresses) && + !pDataObject->IsDataAvailable(CF_TEXT)) + return; + + if(pDataObject->IsDataAvailable(m_cfAddresses)) { + HGLOBAL hAddresses = pDataObject->GetGlobalData(m_cfAddresses); + LPSTR pAddresses = (LPSTR)GlobalLock(hAddresses); + ASSERT(pAddresses); +#if 0 // MW fix + // Parse the vcards and add them to the address book + AB_ImportFromVcard((AddressPane*) m_pane, pAddresses); +#endif + GlobalUnlock(hAddresses); + } + else { + HGLOBAL hString = pDataObject->GetGlobalData(CF_TEXT); + char * pAddress = (char*)GlobalLock(hString); + ASSERT(pAddress); + // parse the vcard from the text + AB_ImportFromVcard((AddressPane*) m_pane, pAddress); + GlobalUnlock(hString); + } +} + +void CAddrOutliner::InitializeClipFormats(void) +{ + m_cfAddresses = (CLIPFORMAT)RegisterClipboardFormat(vCardClipboardFormat); + m_cfSourceTarget = (CLIPFORMAT)RegisterClipboardFormat(ADDRESSBOOK_SOURCETARGET_FORMAT); + m_cfAddrIndexes = (CLIPFORMAT)RegisterClipboardFormat(ADDRESSBOOK_INDEX_FORMAT); + m_cfDirIndexes = (CLIPFORMAT)RegisterClipboardFormat(DIRLIST_INDEX_FORMAT); +} + +CLIPFORMAT * CAddrOutliner::GetClipFormatList(void) +{ + static CLIPFORMAT cfFormatList[5]; + cfFormatList[0] = m_cfAddresses; // vcards + cfFormatList[1] = m_cfSourceTarget; // ids + cfFormatList[2] = m_cfAddrIndexes; // right pane indexes + cfFormatList[3] = m_cfDirIndexes; // left pane indexes + cfFormatList[3] = 0; + return cfFormatList; +} + +DROPEFFECT CAddrOutliner::DropSelect( int iLineNo, COleDataObject *pDataObject ) +{ + DROPEFFECT res = DROPEFFECT_NONE; + HGLOBAL hContent; + + if ( pDataObject->IsDataAvailable( m_cfDirIndexes )) { + + AB_ContainerInfo *pContInfo = AB_GetContainerForIndex(m_pane, iLineNo); + hContent = pDataObject->GetGlobalData (m_cfDirIndexes); + + AddressBookDragData *pDragData = (AddressBookDragData *) GlobalLock(hContent); + + AB_DragEffect requireEffect = AB_Default_Drag; + if ((GetKeyState(VK_SHIFT) & 0x8000) && (GetKeyState(VK_CONTROL) & 0x8000)) + requireEffect = AB_Default_Drag; + else if (GetKeyState(VK_SHIFT) & 0x8000) + requireEffect = AB_Require_Move; + else if (GetKeyState(VK_CONTROL) & 0x8000) + requireEffect = AB_Require_Copy; + + AB_DragEffect effect = AB_DragEntriesIntoContainerStatus ( + pDragData->m_pane, pDragData->m_indices, pDragData->m_count, + pContInfo, + requireEffect); /* do you want to do a move? a copy? default drag? */ + + if (effect == AB_Require_Copy) + res = DROPEFFECT_COPY; + else if (effect == AB_Require_Move) + res = DROPEFFECT_MOVE; + else + res = DROPEFFECT_NONE; + m_iDragSelection = iLineNo; + + GlobalUnlock (hContent); //do we have to GlobalFree it too? + } + + //dragging from right pane + //we need to see if we are over a mailing list. + if(pDataObject->IsDataAvailable(m_cfAddrIndexes)) + { + AB_ContainerInfo *pContInfo = AB_GetContainerForIndex(m_pane, iLineNo); + hContent = pDataObject->GetGlobalData (m_cfAddrIndexes); + + AddressBookDragData *pDragData = (AddressBookDragData *) GlobalLock(hContent); + + AB_DragEffect requireEffect = AB_Default_Drag; + if ((GetKeyState(VK_SHIFT) & 0x8000) && (GetKeyState(VK_CONTROL) & 0x8000)) + requireEffect = AB_Default_Drag; + else if (GetKeyState(VK_SHIFT) & 0x8000) + requireEffect = AB_Require_Move; + else if (GetKeyState(VK_CONTROL) & 0x8000) + requireEffect = AB_Require_Copy; + + + } + + return res; +} + + +COleDataSource * CAddrOutliner::GetDataSource(void) +{ + COleDataSource * pDataSource = new COleDataSource; + ABID entryID; + char* pVcard = NULL; + char* pVcards = XP_STRDUP(""); + int32 vCardSize; + char szTemp[10]; + char szEntryID[20]; + char* pEntryIDs = XP_STRDUP(""); + HANDLE hString = 0; + MSG_ViewIndex *indices; + int count; + + GetSelection(indices, count); + + // create a drag type for the indexes + HANDLE hContent = GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE,sizeof(AddressBookDragData)); + AddressBookDragData *pDragData = (AddressBookDragData *) GlobalLock (hContent); + pDragData->m_pane = m_pane; + pDragData->m_indices = indices; + pDragData->m_count = count; + GlobalUnlock(hContent); + pDataSource->CacheGlobalData(m_cfAddrIndexes, hContent); + + AB_AttributeValue *pValue; + for (int i = 0 ; i < count; i++) { + CAddrFrame::HandleErrorReturn(AB_GetEntryAttributeForPane(m_pane, + indices[i], AB_attribVCard, &pValue)); + + if (pValue) + { + + + pVcards = StrAllocCat(pVcards, pValue->u.string); + + ltoa(333, szTemp, 10); + sprintf(szEntryID, "%s-", szTemp); + pEntryIDs = StrAllocCat(pEntryIDs, szEntryID); + + AB_FreeEntryAttributeValue(pValue); + pValue = NULL; + + } + + } + + if (pVcards) { + hString = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT,strlen(pVcards)+1); + LPSTR lpszString = (LPSTR)GlobalLock(hString); + strcpy(lpszString,pVcards); + XP_FREE (pVcards); + GlobalUnlock(hString); + + HANDLE hEntryID = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT,strlen(pEntryIDs)+1); + LPSTR lpszEntryID = (LPSTR)GlobalLock(hEntryID); + strcpy(lpszEntryID,pEntryIDs); + XP_FREE (pEntryIDs); + GlobalUnlock(hEntryID); + + pDataSource->CacheGlobalData(m_cfAddresses, hString); + pDataSource->CacheGlobalData(m_cfSourceTarget, hEntryID); + pDataSource->CacheGlobalData(CF_TEXT, hString); + } + + return pDataSource; +} + + +BOOL CAddrOutliner::RenderData ( UINT iColumn, CRect &rect, CDC &dc, const char * text ) +{ + if ( iColumn != AB_ColumnFEID0 ) + return CMSelectOutliner::RenderData ( iColumn, rect, dc, text ); + int idxImage; + + if (m_pEntryValues [0].u.entryType == AB_MailingList) + idxImage = IDX_ADDRESSBOOKLIST; + else + idxImage = IDX_ADDRESSBOOKPERSON; + + m_pIUserImage->DrawImage ( idxImage, + rect.left + ( ( rect.Width ( ) - 16 ) / 2 ), rect.top, &dc, FALSE ); + return TRUE; +} + + +int CAddrOutliner::TranslateIcon ( void * pLineData ) +{ + AB_AttributeValue* pEntryValues = (AB_AttributeValue*) pLineData; + int idxImage = 0; + + if (pEntryValues [0].u.entryType == AB_MailingList) + idxImage = IDX_ADDRESSBOOKLIST; + else + idxImage = IDX_ADDRESSBOOKPERSON; + return idxImage; +} + +int CAddrOutliner::TranslateIconFolder (void * pData) +{ + // We're a flat list, so we're never a folder + return ( OUTLINER_ITEM ); +} + + +BOOL CAddrOutliner::ColumnCommand ( int iColumn, int iLine ) +{ + // We have no column commands + return FALSE; +} + +void * CAddrOutliner::AcquireLineData ( int line ) +{ + if ( line >= m_iTotalLines) { + m_pEntryValues = NULL; + return NULL; + } + + if (m_pEntryValues) { + m_intNumAttribs = ID_RESULTS_COLNUM; + AB_FreeEntryAttributeValues (m_pEntryValues, m_intNumAttribs); + m_pEntryValues = NULL; + } + + // get the values by passing in the attribute array + m_intNumAttribs = ID_RESULTS_COLNUM; + + AB_GetEntryAttributesForPane( + m_pane, + line, + m_EntryAttrib, /* FE allocated array of attribs that you want */ + &m_pEntryValues, + &m_intNumAttribs); + + return m_pEntryValues; +} + +void CAddrOutliner::GetTreeInfo ( int iLine, uint32 * pFlags, int * pDepth, OutlinerAncestorInfo ** pAncestor ) +{ + if ( pFlags ) *pFlags = 0; // Flags? + if ( pDepth ) *pDepth = 0; // We're flat, remember? +} + +void CAddrOutliner::ReleaseLineData ( void * ) +{ +} + +LPCTSTR CAddrOutliner::GetColumnText ( UINT iColumn, void * pLineData ) +{ + if (iColumn == AB_ColumnFEID0) + return (""); + + AB_AttributeValue* pEntryValues = (AB_AttributeValue*) pLineData; + + if (pEntryValues [iColumn-1].u.string && *(pEntryValues [iColumn-1].u.string)) + return pEntryValues [iColumn-1].u.string; + + return (""); +} + +void CAddrOutliner::OnSelChanged() +{ + m_pOutlinerOwner->SelectionChanged(); +} + +void CAddrOutliner::OnSelDblClk() +{ + m_pOutlinerOwner->DoubleClick(); +} + +void CAddrOutliner::OnTimer(UINT nID) +{ + CMSelectOutliner::OnTimer(nID); + if (nID == OUTLINER_TYPEDOWN_TIMER) { + KillTimer(m_uTypedownClock); + m_psTypedown = ""; + } +} + +void CAddrOutliner::OnKeyDown ( UINT nChar, UINT nRepCnt, UINT nFlags ) +{ + CMSelectOutliner::OnKeyDown ( nChar, nRepCnt, nFlags ); + KillTimer(m_uTypedownClock); + if (nChar > VK_HELP) { + KillTimer(m_uTypedownClock); + m_psTypedown += nChar; + OnTypedown (m_psTypedown.GetBuffer (0)); + m_psTypedown.ReleaseBuffer(-1); + int32 prefInt = OUTLINER_TYPEDOWN_SPEED; + PREF_GetIntPref("ldap_1.autoComplete.interval", &prefInt); + m_uTypedownClock = SetTimer(OUTLINER_TYPEDOWN_TIMER, prefInt, NULL); + } +} + +///////////////////////////////////////////////////////////////////////////// +// CAddrOutlinerParent + +BEGIN_MESSAGE_MAP(CAddrOutlinerParent, COutlinerParent) + //{{AFX_MSG_MAP(CAddrOutlinerParent) + ON_WM_DESTROY() + ON_WM_LBUTTONUP() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +CAddrOutlinerParent::CAddrOutlinerParent() +{ + +} + + +CAddrOutlinerParent::~CAddrOutlinerParent() +{ + +} + + +BOOL CAddrOutlinerParent::RenderData ( int idColumn, CRect & rect, CDC &dc, const char * text ) +{ + int cx = 3, cy = 0; + CAddrOutliner *pOutliner = (CAddrOutliner *) m_pOutliner; + + // Calculate text offset from top using font height. + TEXTMETRIC tm; + dc.GetTextMetrics ( &tm ); + cy = ( rect.bottom - rect.top - tm.tmHeight ) / 2; + + // Draw Text String + dc.TextOut (rect.left + cx, rect.top + cy, text, _tcslen(text) ); + + // Draw Sort Indicator + MSG_COMMAND_CHECK_STATE sortType = pOutliner->m_attribSortBy == idColumn ? MSG_Checked : MSG_Unchecked; + + int idxImage = pOutliner->m_bSortAscending ? IDX_SORTINDICATORDOWN : IDX_SORTINDICATORUP; + CSize cs = dc.GetTextExtent(text, _tcslen(text)); + + if (idColumn == pOutliner->m_attribSortBy && cs.cx + 22 <= rect.Width()) { + m_pIImage->DrawTransImage( idxImage, + rect.left + 8 + cs.cx, + (rect.top + rect.bottom) / 2 - 4, + &dc ); + } + + return TRUE; +} + +COutliner * CAddrOutlinerParent::GetOutliner ( void ) +{ + return new CAddrOutliner; +} + +void CAddrOutlinerParent::CreateColumns ( void ) +{ + int iCol0 = 0, + iCol1 = 0, + iCol2 = 0, + iCol3 = 0, + iCol4 = 0, + iCol5 = 0; + CString cs; + + m_pOutliner->AddColumn ("", AB_ColumnFEID0, 24, 0, ColumnFixed, 0, TRUE ); + m_pOutliner->AddColumn ("", AB_ColumnFEID1, 1500, 0, ColumnVariable, iCol0 ? iCol0 : 1500 ); + m_pOutliner->AddColumn ("", AB_ColumnFEID2, 1500, 0, ColumnVariable, iCol2 ? iCol2 : 1500 ); + m_pOutliner->AddColumn ("", AB_ColumnFEID3, 1500, 0, ColumnVariable, iCol5 ? iCol5 : 1500 ); + m_pOutliner->AddColumn ("", AB_ColumnFEID4, 1500, 0, ColumnVariable, iCol4 ? iCol4 : 1500 ); + m_pOutliner->AddColumn ("", AB_ColumnFEID5, 1500, 0, ColumnVariable, iCol4 ? iCol4 : 1500 ); + m_pOutliner->AddColumn ("", AB_ColumnFEID6, 1500, 0, ColumnVariable, iCol3 ? iCol3 : 1500 ); + m_pOutliner->SetHasPipes( FALSE ); + + m_pOutliner->SetVisibleColumns(DEF_VISIBLE_COLUMNS); + m_pOutliner->LoadXPPrefs("mailnews.abook_columns_win"); +} + +void CAddrOutlinerParent::OnDestroy() +{ + int32 prefInt = ((CAddrOutliner*)m_pOutliner)->GetSortBy(); + PREF_SetIntPref("mail.addr_book.sortby", prefInt); + PREF_SetBoolPref("mail.addr_book.sort_ascending",((CAddrOutliner*)m_pOutliner)->GetSortAscending()); + + COutlinerParent::OnDestroy(); +} + +void CAddrOutlinerParent::OnLButtonUp( UINT nFlags, CPoint point ) +{ + BOOL bSaveColumns = (m_pOutliner && + (m_bResizeColumn || m_bDraggingHeader || m_iPusherHit))? TRUE : FALSE; + COutlinerParent::OnLButtonUp(nFlags, point); + if (bSaveColumns) + m_pOutliner->SaveXPPrefs("mailnews.abook_columns_win"); +} + +BOOL CAddrOutlinerParent::ColumnCommand ( int idColumn ) +{ + ABID entryID; + int iBEColumnID = idColumn - 1; + + // check if we can sort by this column + AB_ColumnInfo * columnInfo = NULL; + CAddrBookOutlinerOwner * owner= ((CAddrOutliner*)m_pOutliner)->GetOutlinerOwner(); + + if(owner) + columnInfo = AB_GetColumnInfo(owner->GetCurrentContainerInfo(), (AB_ColumnID) (iBEColumnID)); + if (columnInfo && !columnInfo->sortable) { + AB_FreeColumnInfo(columnInfo); + return FALSE; + } + + AB_FreeColumnInfo(columnInfo); + + CAddrOutliner *pOutliner = (CAddrOutliner *) m_pOutliner; + if (pOutliner->GetFocusLine() != -1) + { + AB_GetABIDForIndex( + pOutliner->GetPane(), + pOutliner->GetFocusLine(), + &entryID); /* FE allocated. BE fills with the id you want */ + } + + SetCursor ( theApp.LoadStandardCursor ( IDC_WAIT ) ); + + if (idColumn == pOutliner->m_attribSortBy) { + pOutliner->m_bSortAscending = !pOutliner->m_bSortAscending; + } + else + pOutliner->m_bSortAscending = TRUE; + + pOutliner->m_attribSortBy = idColumn; + + switch (iBEColumnID) { + case AB_ColumnID0: + AB_CommandAB2(pOutliner->GetPane(), AB_SortByColumnID0, 0, 0); + break; + case AB_ColumnID1: + AB_CommandAB2(pOutliner->GetPane(), AB_SortByColumnID1, 0, 0); + break; + case AB_ColumnID2: + AB_CommandAB2(pOutliner->GetPane(), AB_SortByColumnID2, 0, 0); + break; + case AB_ColumnID3: + AB_CommandAB2(pOutliner->GetPane(), AB_SortByColumnID3, 0, 0); + break; + case AB_ColumnID4: + AB_CommandAB2(pOutliner->GetPane(), AB_SortByColumnID4, 0, 0); + break; + case AB_ColumnID5: + AB_CommandAB2(pOutliner->GetPane(), AB_SortByColumnID5, 0, 0); + break; + case AB_ColumnID6: + AB_CommandAB2(pOutliner->GetPane(), AB_SortByColumnID6, 0, 0); + break; + default: + AB_CommandAB2(pOutliner->GetPane(), AB_SortByColumnID1, 0, 0); + break; + } + + + if (pOutliner->GetFocusLine() != -1) { + MSG_ViewIndex index; + AB_GetEntryIndex( + pOutliner->GetPane(), + entryID, /* entry id in the database */ + &index); /* FE allocated, BE fills with index */ + + pOutliner->SelectItem (CASTINT(index)); + pOutliner->ScrollIntoView(CASTINT(index)); + } + + Invalidate(); + pOutliner->Invalidate(); + SetCursor ( theApp.LoadStandardCursor ( IDC_ARROW ) ); + return TRUE; +} + + + + +////////////////////////////////////////////////////////////////////////////// +// CAddrOutliner +BEGIN_MESSAGE_MAP(CDirOutliner, CMSelectOutliner) + //{{AFX_MSG_MAP(CDirOutliner) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +CDirOutliner::CDirOutliner ( ) +{ + ApiApiPtr(api); + m_pUnkUserImage = api->CreateClassInstance(APICLASS_IMAGEMAP); + if (m_pUnkUserImage) { + m_pUnkUserImage->QueryInterface(IID_IImageMap,(LPVOID*)&m_pIUserImage); + ASSERT(m_pIUserImage); + m_pIUserImage->Initialize(IDB_DIRLIST,16,16); + } + + m_lineindex = 0; + m_iMysticPlane = 0; + m_dirIndex = -1; + m_hFont = NULL; + m_pLineValues = NULL; + m_pAncestor = NULL; + m_numItems = sizeof (ContainerAttribs)/sizeof(AB_ContainerAttribute); + m_pSelection = NULL; + m_pFocus = NULL; + m_pOutlinerOwner = NULL; +} + +CDirOutliner::~CDirOutliner ( ) +{ + if (m_pUnkUserImage) { + if (m_pIUserImage) + m_pUnkUserImage->Release(); + } + if (m_hFont) { + theApp.ReleaseAppFont(m_hFont); + } + if (m_pSelection) { + delete [] m_pSelection; + m_pSelection = NULL; + } + if (m_pFocus) { + m_pFocus = NULL; + } +} + + +HFONT CDirOutliner::GetLineFont(void *pLineData) +{ + if (!m_hFont) + { + HDC hDC = ::GetDC(m_hWnd); + LOGFONT lf; + memset(&lf,0,sizeof(LOGFONT)); + + lf.lfPitchAndFamily = FF_SWISS; + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = IntlGetLfCharset(CIntlWin::GetSystemLocaleCsid()); + if (CIntlWin::GetSystemLocaleCsid() == CS_LATIN1) + _tcscpy(lf.lfFaceName, "MS Sans Serif"); + else + _tcscpy(lf.lfFaceName, IntlGetUIPropFaceName(CIntlWin::GetSystemLocaleCsid())); + lf.lfHeight = -MulDiv(9, ::GetDeviceCaps(hDC, LOGPIXELSY), 72); + m_hFont = theApp.CreateAppFont( lf ); + ::ReleaseDC(m_hWnd,hDC); + } + return m_hFont; +} + + +void CDirOutliner::UpdateCount( ) +{ + m_iTotalLines = MSG_GetNumLines(m_pane); + if (!m_iTotalLines) + ClearSelection(); + Invalidate(); + UpdateWindow(); +} + + +BOOL CDirOutliner::DeleteItem ( int iLine ) +{ + XP_Bool bSelectable, bPlural; + MSG_ViewIndex indices[1]; + indices[0] = (MSG_ViewIndex) iLine; + MSG_COMMAND_CHECK_STATE sState; + AB_CommandStatusAB2( m_pane, + AB_DeleteCmd, + indices, 1, + &bSelectable, + &sState, + NULL, + &bPlural); + if (bSelectable) { + AB_CommandAB2 ( m_pane, AB_DeleteCmd, indices, 1 ); + return TRUE; + } + else + MessageBeep(0); + return FALSE; +} + +void CDirOutliner::SetPane(MSG_Pane *pane) +{ + m_pane = pane; + + if (m_pane) { + SetTotalLines (MSG_GetNumLines(m_pane)); + Invalidate(); + UpdateWindow(); + } +} + +void CDirOutliner::MysticStuffStarting( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num ) +{ + ++m_iMysticPlane; +} + +void CDirOutliner::MysticStuffFinishing( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num ) +{ + switch ( notify ) { + case MSG_NotifyNone: + break; + + case MSG_NotifyInsertOrDelete: + if (num > 0) + HandleInsert(where, num); + else + { + HandleDelete(where, -num); + //if deleting current selection we need to load new directory + if(m_dirIndex == where) + { + m_dirIndex = m_iSelection; + m_pOutlinerOwner->OnUpdateDirectorySelection (m_dirIndex, TRUE); + } + } + SetTotalLines (MSG_GetNumLines(m_pane)); + Invalidate(); + break; + + case MSG_NotifyChanged: + { + InvalidateLines( (int) where, (int) num ); + // update the description in the address book bar + if (m_pOutlinerOwner) + m_pOutlinerOwner->OnUpdateDirectorySelection(m_dirIndex, FALSE); + } + break; + + case MSG_NotifyAll: + case MSG_NotifyScramble: + Invalidate(); + break; + } + + if (( !--m_iMysticPlane && m_pane)) { + UpdateWindow(); + } +} + +void CDirOutliner::PropertyMenu ( int iSel, UINT flags ) +{ + BOOL bHasItems = FALSE; + CMenu cmPopup; + CString cs; + + //need to make sure that we have focus + SetFocus(); + if(cmPopup.CreatePopupMenu() == 0) + return; + + if (iSel < m_iTotalLines) { + cs.LoadString(IDS_NEWADDRESSBOOK); + cmPopup.AppendMenu(MF_ENABLED, ID_FILE_NEWAB, cs); + cs.LoadString(IDS_NEWDIRECTORY); + cmPopup.AppendMenu(MF_ENABLED, ID_FILE_NEWDIR, cs); + cmPopup.AppendMenu(MF_SEPARATOR); + /* MSG_ViewIndex *indices; + int count; + pOutliner->GetSelection(indices, count); + AB_CommandStatusAB2(pPane, + cmd, + indices, count, + &bSelectable, + &sState, + NULL, + &bPlural); + } else { + AB_CommandStatusAB2(pPane, + cmd, + NULL, 0, + &bSelectable, + &sState, + NULL, + &bPlural); + } + } + pCmdUI->Enable(bSelectable); + if (bUseCheck) + pCmdUI->SetCheck(sState == MSG_Checked); + else + pCmdUI->SetRadio(sState == MSG_Checked); */ + + cs.LoadString(IDS_AB_NEW_USER); + cmPopup.AppendMenu(MF_ENABLED, ID_ITEM_ADDUSER, cs); + cs.LoadString(IDS_AB_NEW_LIST); + cmPopup.AppendMenu(MF_ENABLED, ID_ITEM_ADDLIST, cs); + cmPopup.AppendMenu(MF_SEPARATOR); + cs.LoadString(ID_POPUP_CUT); + cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_CUT, cs); + cs.LoadString(ID_POPUP_COPY); + cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_COPY, cs); + cs.LoadString(ID_POPUP_PASTE); + cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_PASTE, cs); + cs.LoadString(IDS_COMPOSE_REMOVE); + cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_DELETE, cs); + cs.LoadString(IDS_DELETEFROMALL); + cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_DELETEALL, cs); + cmPopup.AppendMenu(MF_SEPARATOR); + cs.LoadString(IDS_POPUP_PROPERTIES); + cmPopup.AppendMenu(MF_ENABLED, ID_ITEM_PROPERTIES, cs); + bHasItems = TRUE; + } + + + // Track the popup now. + POINT pt = m_ptHit; + ClientToScreen(&pt); + + cmPopup.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, + m_pOutlinerOwner->GetOwnerWindow(), NULL); + + // Cleanup + cmPopup.DestroyMenu(); +} + +void CDirOutliner::AcceptDrop( int iLineNo, COleDataObject *pDataObject, + DROPEFFECT dropEffect ) +{ + HGLOBAL hContent; + + if(!pDataObject) + return; + + // check if we are dropping on ourselves or from the + // right hand pane + if ( pDataObject->IsDataAvailable( m_cfDirIndexes ) || + pDataObject->IsDataAvailable( m_cfAddrIndexes) ) { + + AB_ContainerInfo *pContInfo = AB_GetContainerForIndex(m_pane, iLineNo); + if (pDataObject->IsDataAvailable( m_cfDirIndexes )) + hContent = pDataObject->GetGlobalData (m_cfDirIndexes); + else + hContent = pDataObject->GetGlobalData (m_cfAddrIndexes); + AddressBookDragData *pDragData = (AddressBookDragData *) GlobalLock(hContent); + + AB_DragEffect requireEffect = AB_Default_Drag; + if (dropEffect & DROPEFFECT_MOVE) + requireEffect = AB_Require_Move; + else if (dropEffect & DROPEFFECT_COPY) + requireEffect = AB_Require_Copy; + + // call new drag drop calls that handle indexes + AB_DragEntriesIntoContainer( pDragData->m_pane, pDragData->m_indices, pDragData->m_count, + pContInfo, requireEffect); /* copy or move? */ + + return; + } + + if(pDataObject->IsDataAvailable(m_cfAddresses)) { + HGLOBAL hAddresses = pDataObject->GetGlobalData(m_cfAddresses); + LPSTR pAddresses = (LPSTR)GlobalLock(hAddresses); + ASSERT(pAddresses); + // Parse the vcards and add them to the address book + // AB_ImportFromVcard((AddressPane*) m_pane, pAddresses); + GlobalUnlock(hAddresses); + } + else { + HGLOBAL hString = pDataObject->GetGlobalData(CF_TEXT); + char * pAddress = (char*)GlobalLock(hString); + ASSERT(pAddress); + // parse the vcard from the text + // AB_ImportFromVcard((AddressPane*) m_pane, pAddress); + GlobalUnlock(hString); + } +} + +void CDirOutliner::InitializeClipFormats(void) +{ + m_cfAddresses = (CLIPFORMAT)RegisterClipboardFormat(vCardClipboardFormat); + m_cfAddrIndexes = (CLIPFORMAT)RegisterClipboardFormat(ADDRESSBOOK_INDEX_FORMAT); + m_cfSourceTarget = (CLIPFORMAT)RegisterClipboardFormat(DIRLIST_SOURCETARGET_FORMAT); + m_cfDirIndexes = (CLIPFORMAT)RegisterClipboardFormat(DIRLIST_INDEX_FORMAT); +} + +CLIPFORMAT * CDirOutliner::GetClipFormatList(void) +{ + static CLIPFORMAT cfFormatList[5]; + cfFormatList[0] = m_cfAddresses; + cfFormatList[1] = m_cfSourceTarget; + cfFormatList[2] = m_cfDirIndexes; + cfFormatList[3] = m_cfAddrIndexes; + cfFormatList[5] = 0; + return cfFormatList; +} + +DROPEFFECT CDirOutliner::DropSelect( int iLineNo, COleDataObject *pDataObject ) +{ + DROPEFFECT res = DROPEFFECT_NONE; + HGLOBAL hContent; + + if ( pDataObject->IsDataAvailable( m_cfDirIndexes ) || + pDataObject->IsDataAvailable( m_cfAddrIndexes) ) { + + if ( m_iDragSelection != -1 ) + InvalidateLine (m_iDragSelection); + + m_iDragSelection = -1; + + AB_ContainerInfo *pContInfo = AB_GetContainerForIndex(m_pane, iLineNo); + if (pDataObject->IsDataAvailable( m_cfDirIndexes )) + hContent = pDataObject->GetGlobalData (m_cfDirIndexes); + else + hContent = pDataObject->GetGlobalData (m_cfAddrIndexes); + + AddressBookDragData *pDragData = (AddressBookDragData *) GlobalLock(hContent); + + AB_DragEffect requireEffect = AB_Require_Copy; + if ((GetKeyState(VK_SHIFT) & 0x8000) && (GetKeyState(VK_CONTROL) & 0x8000)) + requireEffect = AB_Require_Copy; + else if (GetKeyState(VK_SHIFT) & 0x8000) + requireEffect = AB_Require_Move; + else if (GetKeyState(VK_CONTROL) & 0x8000) + requireEffect = AB_Require_Copy; + + AB_DragEffect effect = AB_DragEntriesIntoContainerStatus ( + pDragData->m_pane, pDragData->m_indices, pDragData->m_count, + pContInfo, + requireEffect); /* do you want to do a move? a copy? default drag? */ + + if (effect & AB_Require_Copy) + res = DROPEFFECT_COPY; + else if (effect & AB_Require_Move) + res = DROPEFFECT_MOVE; + else + res = DROPEFFECT_NONE; + + m_iDragSelection = iLineNo; + + GlobalUnlock (hContent); //do we have to GlobalFree it too? + + } + + return res; +} + +COleDataSource * CDirOutliner::GetDataSource(void) +{ + COleDataSource * pDataSource = new COleDataSource; + ABID entryID; + char* pVcard = NULL; + char* pVcards = XP_STRDUP(""); + char szTemp[10]; + char szEntryID[20]; + char* pEntryIDs = XP_STRDUP(""); + HANDLE hString = 0; + MSG_ViewIndex *indices; + int count; + + GetSelection(indices, count); + + // create a drag type for the indexes + HANDLE hContent = GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE,sizeof(AddressBookDragData)); + AddressBookDragData *pDragData = (AddressBookDragData *) GlobalLock (hContent); + + pDragData->m_pane = m_pane; + pDragData->m_indices = indices; + pDragData->m_count = count; + + GlobalUnlock(hContent); + pDataSource->CacheGlobalData(m_cfDirIndexes, hContent); + + /* for (int i = 0 ; i < count; i++) { + if ((entryID = AB_GetEntryIDAt((AddressPane*) m_pane, indices[i])) != 0) { + AB_ExportToVCard(theApp.m_pABook, + (DIR_Server*)XP_ListGetObjectNum(theApp.m_directories, m_dirIndex + 1), entryID, &pVcard); + pVcards = StrAllocCat(pVcards, pVcard); + XP_FREE(pVcard); + pVcard = NULL; + + ltoa(entryID, szTemp, 10); + sprintf(szEntryID, "%s-", szTemp); + pEntryIDs = StrAllocCat(pEntryIDs, szEntryID); + } + } + + if (pVcards) { + hString = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT,strlen(pVcards)+1); + LPSTR lpszString = (LPSTR)GlobalLock(hString); + strcpy(lpszString,pVcards); + XP_FREE (pVcards); + GlobalUnlock(hString); + + HANDLE hEntryID = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT,strlen(pEntryIDs)+1); + LPSTR lpszEntryID = (LPSTR)GlobalLock(hEntryID); + strcpy(lpszEntryID,pEntryIDs); + XP_FREE (pEntryIDs); + GlobalUnlock(hEntryID); + pDataSource->CacheGlobalData(m_cfAddresses, hString); + pDataSource->CacheGlobalData(m_cfSourceTarget, hEntryID); + pDataSource->CacheGlobalData(CF_TEXT, hString); + } */ + + return pDataSource; +} + + +int CDirOutliner::Expand( int iLine ) +{ + if (MSG_ExpansionDelta( m_pane, iLine ) > 0) { + return ToggleExpansion( iLine ); + } + return 0; +} + +int CDirOutliner::Collapse( int iLine ) +{ + if (MSG_ExpansionDelta( m_pane, iLine ) < 0) { + return ToggleExpansion( iLine ); + } + return 0; +} + + +int CDirOutliner::ToggleExpansion( int iLine ) +{ + int32 numChanged = 0; + + MSG_ToggleExpansion( m_pane, iLine, &numChanged ); + + return (int) numChanged; +} + + +int CDirOutliner::TranslateIcon ( void * pLineData ) +{ + AB_ContainerAttribValue* line = (AB_ContainerAttribValue*) pLineData; + int idxImage = 0; + + if (m_pLineValues[0].u.containerType == AB_LDAPContainer) + idxImage = IDX_DIRLDAPAB; + else + if (m_pLineValues[0].u.containerType == AB_PABContainer) + idxImage = IDX_DIRPERSONALAB; + else // mailing list + idxImage = IDX_DIRMAILINGLIST; + return idxImage; +} + +int CDirOutliner::TranslateIconFolder (void * pLineData) +{ + ASSERT(pLineData); + + AB_ContainerAttribValue* line = (AB_ContainerAttribValue*) pLineData; + + // if the depth is 0 and children > 0 and + // expansion delta > 0 it must be closed + if ((line[2].u.number == 0) && (line[3].u.number > 0)) + { + if (MSG_ExpansionDelta(m_pane, m_lineindex) > 0) + return(OUTLINER_CLOSEDFOLDER); + else + return(OUTLINER_OPENFOLDER); + } + return (OUTLINER_ITEM); +} + + +BOOL CDirOutliner::ColumnCommand ( int iColumn, int iLine ) +{ + // We have no column commands + return FALSE; +} + +void * CDirOutliner::AcquireLineData ( int line ) +{ + if (m_pLineValues) { + AB_FreeContainerAttribValues (m_pLineValues, m_numItems); + m_pLineValues = NULL; + } + + m_lineindex = line; + if ( line >= m_iTotalLines) + return NULL; + + AB_GetContainerAttributes (AB_GetContainerForIndex(m_pane, line), + ContainerAttribs, &m_pLineValues, &m_numItems); + + // create an ancestor based on the depth + m_pAncestor = new OutlinerAncestorInfo[m_pLineValues [2].u.number+1]; + if ( m_pLineValues [2].u.number ) + { + // if it is a mailing list + AB_ContainerAttribValue* lineValue = NULL; + AB_ContainerInfo * info = NULL; + info = AB_GetContainerForIndex(m_pane, line - 1); + AB_GetContainerAttribute (AB_GetContainerForIndex(m_pane, line - 1), + attribContainerType, &lineValue); + m_pAncestor[1].has_prev = lineValue->u.containerType == AB_MListContainer; + AB_FreeContainerAttribValue (lineValue); + lineValue = NULL; + info = AB_GetContainerForIndex(m_pane, line + 1); + if (info) + { + AB_GetContainerAttribute (AB_GetContainerForIndex(m_pane, line + 1), + attribContainerType, &lineValue); + m_pAncestor[1].has_next = lineValue->u.containerType == AB_MListContainer;; + AB_FreeContainerAttribValue (lineValue); + } + else + m_pAncestor[1].has_next = FALSE; + m_pAncestor[0].has_next = FALSE; + m_pAncestor[0].has_prev = FALSE; + + } + else + { + // if it is a top level container and has children + m_pAncestor[0].has_next = (m_pLineValues [3].u.number > 0); + m_pAncestor[0].has_prev = FALSE; + } + + return m_pLineValues; +} + +void CDirOutliner::GetTreeInfo ( int iLine, uint32 * pFlags, int * pDepth, OutlinerAncestorInfo ** pAncestor ) +{ + if (pFlags) + *pFlags = 0; + if (pDepth) + *pDepth = m_pLineValues [2].u.number; + if (pAncestor) + *pAncestor = m_pAncestor; +} + +void CDirOutliner::ReleaseLineData ( void * ) +{ + delete [] m_pAncestor; + m_pAncestor = NULL; +} + +LPCTSTR CDirOutliner::GetColumnText ( UINT iColumn, void * pLineData ) +{ + AB_ContainerAttribValue* line = (AB_ContainerAttribValue*) pLineData; + + switch (iColumn) { + case ID_COLDIR_NAME: + return line[1].u.string; + break; + default: + break; + } + return (""); +} + +void CDirOutliner::OnSelChanged() +{ + MSG_ViewIndex *indices = NULL; + int count = 0; + + if (m_pOutlinerOwner && m_pOutlinerOwner->IsSearching()) + return; + + GetSelection(indices, count); + + if (count == 1 && m_pOutlinerOwner) { + if (m_dirIndex != indices[0]) { + m_dirIndex = indices[0]; + m_pOutlinerOwner->OnUpdateDirectorySelection(indices[0], TRUE); + } + } +} + +void CDirOutliner::OnSelDblClk() +{ + GetParentFrame()->SendMessage(WM_COMMAND, ID_ITEM_PROPERTIES, 0); +} + + +///////////////////////////////////////////////////////////////////////////// +// CAddrOutlinerParent + +BEGIN_MESSAGE_MAP(CDirOutlinerParent, COutlinerParent) + //{{AFX_MSG_MAP(CDirOutlinerParent) + ON_WM_DESTROY() + ON_WM_LBUTTONUP() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +CDirOutlinerParent::CDirOutlinerParent() +{ + +} + + +CDirOutlinerParent::~CDirOutlinerParent() +{ + +} + + +BOOL CDirOutlinerParent::RenderData ( int idColumn, CRect & rect, CDC &dc, const char * text ) +{ + int cx = 3, cy = 0; + CDirOutliner *pOutliner = (CDirOutliner *) m_pOutliner; + + // Calculate text offset from top using font height. + TEXTMETRIC tm; + dc.GetTextMetrics ( &tm ); + cy = ( rect.bottom - rect.top - tm.tmHeight ) / 2; + + // Draw Text String + dc.TextOut (rect.left + cx, rect.top + cy, text, _tcslen(text) ); + + return TRUE; +} + +COutliner * CDirOutlinerParent::GetOutliner ( void ) +{ + return new CDirOutliner; +} + +void CDirOutlinerParent::CreateColumns ( void ) +{ + int iCol0 = 0, + iCol1 = 0; + CString cs; + cs.LoadString(IDS_USERNAME); + m_pOutliner->AddColumn (cs, ID_COLDIR_NAME, 1500, 0, ColumnVariable, iCol0 ? iCol0 : 1500 ); + m_pOutliner->SetHasPipes( TRUE ); + m_pOutliner->SetImageColumn (ID_COLDIR_NAME); +} + +void CDirOutlinerParent::OnLButtonUp( UINT nFlags, CPoint point ) +{ + BOOL bSaveColumns = (m_pOutliner && + (m_bResizeColumn || m_bDraggingHeader || m_iPusherHit))? TRUE : FALSE; + COutlinerParent::OnLButtonUp(nFlags, point); + if (bSaveColumns) + m_pOutliner->SaveXPPrefs("mailnews.abook_dir_columns_win"); +} + +BOOL CDirOutlinerParent::ColumnCommand ( int idColumn ) +{ + // no sorting for the directories + return TRUE; +} + + +void WFE_MSGOpenAB() +{ + CAddrFrame::Open(); +} + +DIR_Server *CAddrFrame::DIRServerFromMenuID( UINT &nBase, UINT nID ) +{ + int i; + XP_List* pabList = NULL; + DIR_Server* res = NULL; + + // pabList = DIR_GetPersonalAddressBooks (theApp.m_directories); + + // Figure out which pab corrresponds to the id + res = (DIR_Server*) XP_ListGetObjectNum (pabList, (nID - nBase) + 1); + + return res; +} + +DIR_Server *CAddrFrame::DIRServerFromMenuID( UINT nID ) +{ + UINT nBase = 0; + DIR_Server* res = NULL; + + if ( nID >= FIRST_ADDSENDER_MENU_ID && nID <= LAST_ADDSENDER_MENU_ID ) + { + nBase = FIRST_ADDSENDER_MENU_ID; + } + if ( nID >= FIRST_ADDALL_MENU_ID && nID <= LAST_ADDALL_MENU_ID ) + { + nBase = FIRST_ADDALL_MENU_ID; + } + + ASSERT (nBase); + if (nBase) + res = CAddrFrame::DIRServerFromMenuID( nBase, nID ); + + return res; +} + + +void CAddrFrame::UpdateMenu(HMENU hMenu, UINT &nID) +{ + // *** If you change the way this menu is built, you also need to + // change CAddrFrame::DIRServerFromMenuID + + int i, j; + XP_List* pabList = NULL; + DIR_Server* pab = NULL; + int32 iCount = 0; + char buffer[_MAX_PATH]; + + // pabList = DIR_GetPersonalAddressBooks (theApp.m_directories); + j = 0; + iCount = XP_ListCount(pabList); + + for ( i = 0; i < iCount; i++) { + pab = (DIR_Server*) XP_ListGetObjectNum (theApp.m_directories, i + 1); + + if ( pab ) { + if (j < 10) { + sprintf( buffer, "&%d %s", j, pab->description); + } else if ( j < 36 ) { + sprintf( buffer, "&%c %s", 'a' + j - 10, pab->description); + } else { + sprintf( buffer, " %s", pab->description); + } + ::AppendMenu( hMenu, MF_STRING, nID, buffer); + nID++; + j++; + } + } +} + +void WFE_MSGBuildAddressBookPopup( HMENU hmenu, BOOL bAddSender ) +{ + UINT nID; + if (bAddSender) + nID = FIRST_ADDSENDER_MENU_ID; + else + nID = FIRST_ADDALL_MENU_ID; + HMENU hABAddMenu = CreatePopupMenu(); + HMENU hAddMenu = CreatePopupMenu(); + + ::AppendMenu( hAddMenu, MF_STRING, ID_MESSAGE_ADDSENDER, szLoadString( IDS_POPUP_ADDSENDER ) ); + ::AppendMenu( hAddMenu, MF_STRING, ID_MESSAGE_ADDALL, szLoadString( IDS_POPUP_ADDALL ) ); + ::AppendMenu( hmenu, MF_STRING|MF_POPUP, (UINT) hAddMenu, szLoadString( IDS_POPUP_ADDTOADDRESSBOOK ) ); + ::AppendMenu( hmenu, MF_SEPARATOR, 0, NULL ); + CAddrFrame::UpdateMenu( hABAddMenu, nID ); +} + +void WFE_MSGBuildAddAddressBookPopups(HMENU hMenu, int nStartPosition, + BOOL bCreateMenuItem, MWContext *pContext) +{ + + XP_List *addressBooks = AB_AcquireAddressBookContainers(pContext); + + + if(addressBooks) + { + + if(hMenu) + { + int nCount = XP_ListCount(addressBooks); + if(nCount == 1) + { + //just add menu items, don't create submenus for each address book + if(bCreateMenuItem) + { + ::InsertMenu(hMenu, nStartPosition, MF_BYPOSITION| MF_STRING, + FIRST_ADDSENDER_MENU_ID + 1, szLoadString(IDS_ADDSENDER)); + + ::InsertMenu(hMenu, nStartPosition + 1, MF_BYPOSITION| MF_STRING, + FIRST_ADDALL_MENU_ID + 1, szLoadString(IDS_ADDALL)); + } + else + { + ::ModifyMenu(hMenu, nStartPosition, MF_BYPOSITION| MF_STRING, + FIRST_ADDSENDER_MENU_ID + 1, szLoadString(IDS_ADDSENDER)); + + ::ModifyMenu(hMenu, nStartPosition + 1, MF_BYPOSITION| MF_STRING, + FIRST_ADDALL_MENU_ID + 1, szLoadString(IDS_ADDALL)); + } + } + else + { + //Need to create a submenu for each address book + HMENU senderMenu = ::CreatePopupMenu(); + HMENU allMenu = ::CreatePopupMenu(); + + if(bCreateMenuItem) + { + ::InsertMenu(hMenu, nStartPosition, MF_BYPOSITION| MF_STRING | MF_POPUP, + (UINT)senderMenu, szLoadString(IDS_ADDSENDER)); + + ::InsertMenu(hMenu, nStartPosition + 1, MF_BYPOSITION| MF_STRING | MF_POPUP, + (UINT)allMenu, szLoadString(IDS_ADDALL)); + } + else + { + ::ModifyMenu(hMenu, nStartPosition, MF_BYPOSITION| MF_STRING | MF_POPUP, + (UINT)senderMenu, szLoadString(IDS_ADDSENDER)); + + ::ModifyMenu(hMenu, nStartPosition + 1, MF_BYPOSITION| MF_STRING | MF_POPUP, + (UINT)allMenu, szLoadString(IDS_ADDALL)); + } + + for(int i = 1; i <= nCount; i++) + { + AB_ContainerInfo *info = + (AB_ContainerInfo*)XP_ListGetObjectNum (addressBooks, i); + + AB_ContainerAttribValue *value; + AB_GetContainerAttribute(info, attribName, &value); + + if(value != NULL) + { + ::AppendMenu(senderMenu, MF_BYPOSITION | MF_STRING, + FIRST_ADDSENDER_MENU_ID + i, value->u.string); + ::AppendMenu(allMenu, MF_BYPOSITION | MF_STRING, + FIRST_ADDALL_MENU_ID + i, value->u.string); + + AB_FreeContainerAttribValue(value); + + } + + } + } + } + AB_ReleaseContainersList(addressBooks); + } + +} +#else CAddrBar::CAddrBar() { @@ -221,7 +4166,11 @@ void CAddrBar::SetDirectoryIndex( int dirIndex ) { CComboBox *widget = (CComboBox*) GetDlgItem(IDC_DIRECTORIES); m_savedir = -1; - widget->SetCurSel (dirIndex); + if (widget) + { + GetDlgItem(IDC_DIRECTORIES)->ShowWindow (SW_HIDE); + widget->SetCurSel (dirIndex); + } UpdateData(TRUE); if (m_directory != m_savedir) { m_savedir = m_directory; @@ -248,22 +4197,25 @@ void CAddrBar::UpdateDirectories() DIR_Server* dir; CComboBox *widget = (CComboBox*) GetDlgItem(IDC_DIRECTORIES); - widget->ResetContent(); + if (widget) + { + widget->ResetContent(); - XP_List *pTraverse = theApp.m_directories; - while (dir = (DIR_Server*) XP_ListNextObject(pTraverse)) { - if (m_bRemoveLDAPDir){ - if (dir->dirType == PABDirectory) + XP_List *pTraverse = theApp.m_directories; + while (dir = (DIR_Server*) XP_ListNextObject(pTraverse)) { + if (m_bRemoveLDAPDir){ + if (dir->dirType == PABDirectory) + widget->AddString(dir->description); + } + else if (dir->dirType == PABDirectory || dir->dirType == LDAPDirectory) widget->AddString(dir->description); } - else if (dir->dirType == PABDirectory || dir->dirType == LDAPDirectory) - widget->AddString(dir->description); - } - if (m_directory == -1) - widget->SetCurSel(0); - else - widget->SetCurSel(m_directory); + if (m_directory == -1) + widget->SetCurSel(0); + else + widget->SetCurSel(m_directory); + } } void CAddrBar::OnTimer(UINT nID) @@ -873,10 +4825,6 @@ void CAddrFrame::PaneChanged(MSG_Pane *pane, XP_Bool asynchronous, } -#ifdef FEATURE_ADDRESS_BOOK -#include "addrfrm.i00" -#endif - ///////////////////////////////////////////////////////////////////////////// // CAddrFrame message handlers @@ -1111,12 +5059,7 @@ void CAddrFrame::OnViewCommandToolbar() void CAddrFrame::OnUpdateViewCommandToolbar(CCmdUI *pCmdUI) { BOOL bShow = GetChrome()->GetToolbarVisible(ID_ADDRESS_BOOK_TOOLBAR); - if( pCmdUI->m_pMenu ){ - pCmdUI->m_pMenu->ModifyMenu(CASTUINT(ID_VIEW_ABTOOLBAR), CASTUINT(MF_BYCOMMAND | MF_STRING), CASTUINT(ID_VIEW_ABTOOLBAR), - szLoadString(CASTUINT(bShow ? IDS_HIDE_ABTOOLBAR : IDS_SHOW_ABTOOLBAR)) ); - } else { - pCmdUI->SetCheck(bShow); - } + pCmdUI->SetCheck(bShow); } void CAddrFrame::OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI ) @@ -1241,9 +5184,6 @@ void CAddrFrame::AllConnectionsComplete( MWContext *pContext ) CStubsCX::AllConnectionsComplete( pContext ); if (m_bSearching) { - - OnStopSearch(); - int32 total = m_pOutliner->GetTotalLines(); CString csStatus; if ( total > 1 ) { @@ -1257,6 +5197,8 @@ void CAddrFrame::AllConnectionsComplete( MWContext *pContext ) MessageBox(csStatus, s, MB_OK | MB_APPLMODAL); } + OnStopSearch(); + LPNSSTATUSBAR pIStatusBar = NULL; m_pChrome->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar ); if ( pIStatusBar ) { @@ -1446,7 +5388,15 @@ void CAddrFrame::OnUpdateAddDir(CCmdUI* pCmdUI) void CAddrFrame::OnUpdateItemProperties(CCmdUI* pCmdUI) { - DoUpdateAddressBook(pCmdUI, AB_PropertiesCmd); + if (GetCurrentDirectoryServer()->dirType == LDAPDirectory) { + if(m_pDirOutliner == GetFocus()) + { + pCmdUI->Enable(TRUE); + return; + } + } + + DoUpdateAddressBook(pCmdUI, AB_PropertiesCmd); } void CAddrFrame::OnUpdateCall(CCmdUI* pCmdUI) @@ -1486,7 +5436,6 @@ void CAddrFrame::OnSwitchSortFirstLast() void CAddrFrame::OnAddUser ( void ) { -#ifdef FEATURE_ADDRPROP CAddrEditProperties* prop; prop = new CAddrEditProperties (this, GetCurrentDirectoryServer(), @@ -1495,9 +5444,11 @@ void CAddrFrame::OnAddUser ( void ) prop->SetCurrentPage(0); if (prop->Create(this, WS_SYSMENU | WS_POPUP | WS_CAPTION | WS_VISIBLE, WS_EX_DLGMODALFRAME)) { - m_userPropList.Add (prop); + //the property sheet dialog destroys itself when it closes so it's not worth + //saving + + //m_userPropList.Add (prop); } -#endif } void CAddrFrame::OnAddAB ( void ) @@ -1508,26 +5459,20 @@ void CAddrFrame::OnAddAB ( void ) void CAddrFrame::OnAddDir ( void ) { -#ifdef FEATURE_ADDRPROP CString label; label.LoadString(IDS_ADD_LDAP_SERVER); CAddrLDAPProperties serverProperties(this, GetContext(), NULL, label); if (IDOK == serverProperties.DoModal()) { - DIR_Server* pServer = &serverProperties.m_serverInfo; - DIR_Server *pNewServer = (DIR_Server *) XP_ALLOC(sizeof(DIR_Server)); - if (pNewServer) + DIR_Server* pServer = &serverProperties.m_serverInfo, *pNewServer; + DIR_CopyServer(pServer, &pNewServer); + if (pNewServer && pNewServer->dirType == LDAPDirectory) { - DIR_InitServer(pNewServer); - DIR_CopyServer(pServer, &pNewServer); - if (pNewServer->dirType == LDAPDirectory) { - DIR_SetServerFileName(pNewServer, pNewServer->serverName); - } + DIR_SetServerFileName(pNewServer, pNewServer->serverName); } XP_ListAddObjectToEnd(theApp.m_directories, pNewServer); DIR_SaveServerPreferences (theApp.m_directories); } -#endif } @@ -1543,7 +5488,6 @@ void CAddrFrame::OnUpdateHTMLDomains( CCmdUI *pCmdUI ) void CAddrFrame::OnCreateCard ( void ) { -#ifdef FEATURE_ADDRPROP CAddrEditProperties* prop; char* email = NULL; char* name = NULL; @@ -1592,7 +5536,9 @@ void CAddrFrame::OnCreateCard ( void ) prop->SetCurrentPage(0); if (prop->Create(this, WS_SYSMENU | WS_POPUP | WS_CAPTION | WS_VISIBLE, WS_EX_DLGMODALFRAME)) { - m_userPropList.Add (prop); + //the property sheet dialog destroys itself when it closes so it's not worth + //saving + // m_userPropList.Add (prop); } } else { @@ -1601,9 +5547,11 @@ void CAddrFrame::OnCreateCard ( void ) prop = new CAddrEditProperties (this, pab, formattedString, this, 0, &person, GetContext()); prop->SetCurrentPage(0); - if (prop->Create(this, WS_SYSMENU | WS_POPUP | WS_CAPTION | WS_VISIBLE, + if (prop->Create(this,WS_SYSMENU | WS_POPUP | WS_CAPTION | WS_VISIBLE, WS_EX_DLGMODALFRAME)) { - m_userPropList.Add (prop); + //the property sheet dialog destroys itself when it closes so it's not worth + //saving + // m_userPropList.Add (prop); } } } @@ -1611,7 +5559,6 @@ void CAddrFrame::OnCreateCard ( void ) XP_FREE (email); if (name) XP_FREE (name); -#endif } @@ -1635,7 +5582,6 @@ void CAddrFrame::OnAddList ( void ) void CAddrFrame::OnDeleteItem() { -#ifdef FEATURE_ADDRPROP MSG_ViewIndex *indices; int count; m_pOutliner->GetSelection(indices, count); @@ -1675,7 +5621,6 @@ void CAddrFrame::OnDeleteItem() else m_pOutliner->SelectItem(m_pOutliner->GetFocusLine()); SetCursor ( theApp.LoadStandardCursor ( IDC_ARROW ) ); -#endif } @@ -1715,7 +5660,6 @@ void CAddrFrame::OnComposeMsg() void CAddrFrame::CloseUserProperties (CAddrEditProperties* wnd, ABID entryID) { -#ifdef FEATURE_ADDRPROP CAddrEditProperties* prop; for (int i = 0; i < m_userPropList.GetSize(); i++) { prop = (CAddrEditProperties*) (m_userPropList.GetAt(i)); @@ -1724,7 +5668,6 @@ void CAddrFrame::CloseUserProperties (CAddrEditProperties* wnd, ABID entryID) break; } } -#endif } @@ -1743,12 +5686,26 @@ void CAddrFrame::CloseListProperties (CABMLDialog* wnd, ABID entryID) void CAddrFrame::OnItemProperties() { -#ifdef FEATURE_ADDRPROP if (GetCurrentDirectoryServer()->dirType == LDAPDirectory) { - MSG_ViewIndex *indices; - int count; - m_pOutliner->GetSelection(indices, count); - HandleErrorReturn(AB_Command (m_addrBookPane, AB_PropertiesCmd, indices, count), this); + + if(m_pDirOutliner == GetFocus()) + { + CString label; + label.LoadString(IDS_ADD_LDAP_SERVER); + CAddrLDAPProperties serverProperties(this, GetContext(), + GetCurrentDirectoryServer(), label); + if (IDOK == serverProperties.DoModal()) + { + DIR_SaveServerPreferences (theApp.m_directories); + } + } + else + { + MSG_ViewIndex *indices; + int count; + m_pOutliner->GetSelection(indices, count); + HandleErrorReturn(AB_Command (m_addrBookPane, AB_PropertiesCmd, indices, count), this); + } } else { MSG_ViewIndex *indices; @@ -1795,7 +5752,9 @@ void CAddrFrame::OnItemProperties() prop->SetCurrentPage(0); if (prop->Create(this, WS_SYSMENU | WS_POPUP | WS_CAPTION | WS_VISIBLE, WS_EX_DLGMODALFRAME)) { - m_userPropList.Add (prop); + //the property sheet dialog destroys itself when it closes so it's not worth + //saving + // m_userPropList.Add (prop); } } else { @@ -1809,7 +5768,6 @@ void CAddrFrame::OnItemProperties() } } } -#endif } @@ -2050,17 +6008,10 @@ void CAddrFrame::OnExtendedDirectorySearch () return; } - CUIntArray buttonLabels; - buttonLabels.SetSize (4, 1); - buttonLabels [0] = IDS_ADRSEARCH; - buttonLabels [1] = IDS_CANCEL_BUTTON; - buttonLabels [2] = IDS_HELP_BUTTON; - buttonLabels [3] = IDS_ADVSEARCH; - CSearchDialog searchDlg ((UINT) IDS_ADRSEARCH, (MSG_Pane*) m_addrBookPane, GetCurrentDirectoryServer(), - this, 4, BUTTON_RIGHT, &buttonLabels); + this); int result = searchDlg.DoModal(); // Build Search @@ -3053,48 +7004,8 @@ COleDataSource * CDirOutliner::GetDataSource(void) MSG_ViewIndex *indices; int count; - /* - ABID entryID; - char* pVcard = NULL; - char* pVcards = XP_STRDUP(""); - char szTemp[10]; - char szEntryID[20]; - char* pEntryIDs = XP_STRDUP(""); - HANDLE hString = 0; - */ - GetSelection(indices, count); - /* for (int i = 0 ; i < count; i++) { - if ((entryID = AB_GetEntryIDAt((AddressPane*) m_pane, indices[i])) != 0) { - AB_ExportToVCard(theApp.m_pABook, - (DIR_Server*)XP_ListGetObjectNum(theApp.m_directories, m_dirIndex + 1), entryID, &pVcard); - pVcards = StrAllocCat(pVcards, pVcard); - XP_FREE(pVcard); - pVcard = NULL; - - ltoa(entryID, szTemp, 10); - sprintf(szEntryID, "%s-", szTemp); - pEntryIDs = StrAllocCat(pEntryIDs, szEntryID); - } - } - - if (pVcards) { - hString = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT,strlen(pVcards)+1); - LPSTR lpszString = (LPSTR)GlobalLock(hString); - strcpy(lpszString,pVcards); - XP_FREE (pVcards); - GlobalUnlock(hString); - - HANDLE hEntryID = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT,strlen(pEntryIDs)+1); - LPSTR lpszEntryID = (LPSTR)GlobalLock(hEntryID); - strcpy(lpszEntryID,pEntryIDs); - XP_FREE (pEntryIDs); - GlobalUnlock(hEntryID); - pDataSource->CacheGlobalData(m_cfAddresses, hString); - pDataSource->CacheGlobalData(m_cfSourceTarget, hEntryID); - pDataSource->CacheGlobalData(CF_TEXT, hString); - } */ return pDataSource; } @@ -3108,7 +7019,7 @@ BOOL CDirOutliner::RenderData ( UINT iColumn, CRect &rect, CDC &dc, const char if (m_pDirLine->dirType == LDAPDirectory) idxImage = IDX_DIRLDAPAB; - else + else idxImage = IDX_DIRPERSONALAB; m_pIUserImage->DrawImage ( idxImage, @@ -3338,42 +7249,72 @@ void WFE_MSGOpenAB() CAddrFrame::Open(); } +DIR_Server *CAddrFrame::DIRServerFromMenuID( UINT &nBase, UINT nID ) +{ + int i; + XP_List* pabList = NULL; + DIR_Server* res = NULL; + + // pabList = DIR_GetPersonalAddressBooks (theApp.m_directories); + + // Figure out which pab corrresponds to the id + res = (DIR_Server*) XP_ListGetObjectNum (pabList, (nID - nBase) + 1); + + return res; +} + +DIR_Server *CAddrFrame::DIRServerFromMenuID( UINT nID ) +{ + UINT nBase = 0; + DIR_Server* res = NULL; + + if ( nID >= FIRST_ADDSENDER_MENU_ID && nID <= LAST_ADDSENDER_MENU_ID ) + { + nBase = FIRST_ADDSENDER_MENU_ID; + } + if ( nID >= FIRST_ADDALL_MENU_ID && nID <= LAST_ADDALL_MENU_ID ) + { + nBase = FIRST_ADDALL_MENU_ID; + } + + ASSERT (nBase); + if (nBase) + res = CAddrFrame::DIRServerFromMenuID( nBase, nID ); + + return res; +} + void CAddrFrame::UpdateMenu(HMENU hMenu, UINT &nID) { // *** If you change the way this menu is built, you also need to - // change CAddrFrame::FolderInfoFromMenuID + // change CAddrFrame::DIRServerFromMenuID - MSG_Master *pMaster = WFE_MSGGetMaster(); int i, j; - MSG_FolderInfo **folderInfos; - int32 iCount; - MSG_FolderLine folderLine; + XP_List* pabList = NULL; + DIR_Server* pab = NULL; + int32 iCount = 0; char buffer[_MAX_PATH]; + // pabList = DIR_GetPersonalAddressBooks (theApp.m_directories); j = 0; + iCount = XP_ListCount(pabList); - iCount = MSG_GetFolderChildren( pMaster, NULL, NULL, NULL ); + for ( i = 0; i < iCount; i++) { + pab = (DIR_Server*) XP_ListGetObjectNum (theApp.m_directories, i + 1); - folderInfos = new MSG_FolderInfo*[iCount]; - if (folderInfos) { - MSG_GetFolderChildren( pMaster, NULL, folderInfos, iCount ); - - for ( i = 0; i < iCount; i++) { - if ( MSG_GetFolderLineById( pMaster, folderInfos[ i ], &folderLine ) ) { - if (j < 10) { - sprintf( buffer, "&%d %s", j, folderLine.name); - } else if ( j < 36 ) { - sprintf( buffer, "&%c %s", 'a' + j - 10, folderLine.name); - } else { - sprintf( buffer, " %s", folderLine.name); - } - ::AppendMenu( hMenu, MF_STRING, nID, buffer); - nID++; - j++; + if ( pab ) { + if (j < 10) { + sprintf( buffer, "&%d %s", j, pab->description); + } else if ( j < 36 ) { + sprintf( buffer, "&%c %s", 'a' + j - 10, pab->description); + } else { + sprintf( buffer, " %s", pab->description); } + ::AppendMenu( hMenu, MF_STRING, nID, buffer); + nID++; + j++; } - delete [] folderInfos; } } @@ -3394,3 +7335,7 @@ void WFE_MSGBuildAddressBookPopup( HMENU hmenu, BOOL bAddSender ) ::AppendMenu( hmenu, MF_SEPARATOR, 0, NULL ); CAddrFrame::UpdateMenu( hABAddMenu, nID ); } + + +#endif + diff --git a/mozilla/cmd/winfe/addrfrm.h b/mozilla/cmd/winfe/addrfrm.h index c886ccfd5b8..9f06e2c9832 100755 --- a/mozilla/cmd/winfe/addrfrm.h +++ b/mozilla/cmd/winfe/addrfrm.h @@ -29,7 +29,12 @@ #include "outliner.h" #include "apimsg.h" #include "xp_core.h" +#define MOZ_NEWADDR 1 +#ifdef MOZ_NEWADDR +#include "abcom.h" +#else #include "addrbook.h" +#endif #include "abmldlg.h" #include "mailfrm.h" #include "mnrccln.h" @@ -39,8 +44,17 @@ // sent to parent when illegal character hit // return 0 if you want parsed edit to beep -#define NETSCAPE_ADDRESS_FORMAT "Netscape Address Book Format" -#define ADDRESSBOOK_SOURCETARGET_FORMAT "Netscape Address Book source-target" +#define NETSCAPE_ADDRESS_FORMAT "Netscape Address Book Format" +#define ADDRESSBOOK_SOURCETARGET_FORMAT "Netscape Address Book source-target" +#define ADDRESSBOOK_INDEX_FORMAT "Netscape Address Book Index Format" +#define DIRLIST_SOURCETARGET_FORMAT "Directory List source-target" +#define DIRLIST_INDEX_FORMAT "Directory List Index Format" + +typedef struct { + MSG_Pane *m_pane; + int m_count; + MSG_ViewIndex *m_indices; +} AddressBookDragData; #define IDW_ADDRESS_SLIDER AFX_IDW_PANE_FIRST #define IDW_DIRECTORY_PANE (AFX_IDW_PANE_FIRST+1) @@ -56,10 +70,12 @@ #define ID_COLADDR_PHONE 5 #define ID_COLADDR_LOCALITY 6 #define ID_COLADDR_NICKNAME 7 +#define ID_RESULTS_COLNUM 7 #define DEF_DIRVISIBLE_COLUMNS 2 #define ID_COLDIR_TYPE 1 #define ID_COLDIR_NAME 2 +#define ID_CONT_COLNUM 2 // array of indexes for IDB_ADDRESSBOOK bitmap #define IDX_ADDRESSBOOKPERSON 0 @@ -69,10 +85,12 @@ // array of indexes for IDB_DIRLIST bitmap #define IDX_DIRLDAPAB 0 #define IDX_DIRPERSONALAB 1 +#define IDX_DIRMAILINGLIST 2 // call to build a menu of PABs void WFE_MSGBuildAddressBookPopup( HMENU hmenu, BOOL bInHeaders = FALSE ); + class CAddrCX: public CStubsCX { public: @@ -80,6 +98,578 @@ public: void DestroyContext(); }; +#ifdef MOZ_NEWADDR +class CAddrBookOutlinerOwner { + +public: + virtual BOOL IsSearching() = 0; + virtual AB_ContainerInfo * GetCurrentContainerInfo() =0; + virtual void SetSearchResults(MSG_ViewIndex where, int32 num) = 0; + virtual void OnUpdateDirectorySelection (int dirIndex, BOOL indexChanged) = 0; + virtual void SelectionChanged()=0; + virtual void DoubleClick() = 0; + virtual CWnd* GetOwnerWindow() = 0; +}; + +class CAddrBar; + +class CAddrBarEditWndOwner +{ +public: + virtual void SearchText(BOOL bImmediately) = 0; + +}; + +class CAddrBarEditWnd : public CEdit +{ +protected: + CAddrBarEditWndOwner *m_pOwner; + +public: + CAddrBarEditWnd(); + ~CAddrBarEditWnd(); + void SetOwner(CAddrBarEditWndOwner *pOwner) { m_pOwner = pOwner; } + virtual BOOL PreTranslateMessage ( MSG * msg ); + DECLARE_MESSAGE_MAP(); +}; + +/**************************************************************************** +* +* Class: CAddrBar +* +* DESCRIPTION: +* This class is used to process the dialog bar at the top of the address +* book. Mainly used for typedown. +* +****************************************************************************/ +class CAddrBar : public CDialogBar, public CAddrBarEditWndOwner +{ +public: + CAddrBar ( ); + virtual ~CAddrBar ( ); + void UpdateDirectories(); + +// Attributes +public: + int m_iWidth; + UINT m_uTypedownClock; + CString m_save; + HFONT m_pFont; + XP_Bool m_bRemoveLDAPDir; + CAddrBarEditWnd m_EditWnd; + +#ifdef XP_WIN16 + CSize m_sizeDefault; +#endif + +protected: + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAddrBar) +public: + void ChangeDirectoryName (char * directoryName); +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + //{{AFX_DATA(CAddrBar) + CString m_name; + //}}AFX_DATA + +public: + BOOL Create( CWnd*, UINT, UINT, UINT ); + void ClearSavedText(); + void SearchText(BOOL bImmediately); + // Generated message map functions + //{{AFX_MSG(CAddrBar) + afx_msg int OnCreate( LPCREATESTRUCT ); + afx_msg void OnSize( UINT, int, int); + afx_msg void OnTimer( UINT ); + afx_msg void OnChangeName(); + afx_msg void OnSetFocusName(); + afx_msg void OnExtDirectorySearch(); + afx_msg void OnKillFocus( CWnd* pNewWnd ); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +/**************************************************************************** +* +* Class: CAddrFrame +* +* DESCRIPTION: +* This class is used to as the main frame window for the address book. +* +****************************************************************************/ +class COutlinerView; +class CAddrOutliner; +class CAddrOutlinerParent; +class CDirOutliner; +class CDirOutlinerParent; +class CAddrEditProperties; +class CAddrEntryList; + + +class CAddrFrame : public CGenericFrame, public CStubsCX, public IMailFrame, + public CAddrBookOutlinerOwner { + DECLARE_DYNCREATE(CAddrFrame) + +// Attributes +protected: + + friend class CAddrEntryList; + + CAddrBar m_barAddr; + int m_iWidth; + + CMailNewsSplitter *m_pSplitter; + CAddrOutliner *m_pOutliner; + CAddrOutlinerParent *m_pOutlinerParent; + CDirOutliner *m_pDirOutliner; + CDirOutlinerParent *m_pDirOutlinerParent; + + LPMSGLIST m_pIAddrList; + MSG_Pane *m_addrBookPane; + MSG_Pane *m_addrContPane; + int32 m_iProgress; + BOOL m_bSearching; + +// CAddrFrame(); // protected constructor used by dynamic creation + virtual ~CAddrFrame(); + + // IUnknown Interface + STDMETHODIMP QueryInterface(REFIID,LPVOID *); + STDMETHODIMP_(ULONG) AddRef(void); + STDMETHODIMP_(ULONG) Release(void); + + // From CStubsCX + virtual void Progress(MWContext *pContext, const char *pMessage); + virtual void SetProgressBarPercent(MWContext *pContext, int32 lPercent); + virtual void AllConnectionsComplete(MWContext *pContext); + virtual CWnd *GetDialogOwner() const { return (CWnd *) this; } + + // Support for IMsgList Interface (Called by CAddrEntryList) + virtual void ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + +// Operations +public: + CAddrFrame(); + static CAddrFrame *Open(); + static DIR_Server *DIRServerFromMenuID( UINT nID ); + static DIR_Server *DIRServerFromMenuID( UINT &nBase, UINT nID ); + static void UpdateMenu(HMENU hMenu, UINT &nID); + + // Support for IMailFrame + virtual CMailNewsFrame *GetMailNewsFrame(); + virtual MSG_Pane *GetPane(); + virtual void PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, + MSG_PANE_CHANGED_NOTIFY_CODE, int32 value); + virtual void AttachmentCount(MSG_Pane *messagepane, void* closure, + int32 numattachments, XP_Bool finishedloading) {}; + virtual void UserWantsToSeeAttachments(MSG_Pane *messagepane, void *closure) {}; + + virtual MSG_Pane *GetResultsPane(); + virtual MSG_Pane *GetContainerPane(); + virtual MSG_Pane * GetFocusPane(); + virtual MSG_Pane * GetPaneForCommand(AB_CommandType cmd); + + + + enum { ToolInvalid = -1, ToolText = 0, ToolPictures = 1, ToolBoth = 2 }; + + // Callback from LDAP search + void SetSearchResults(MSG_ViewIndex index, int32 num); + XP_Bool IsSearching () { return m_bSearching; } + + void SelectionChanged() {}; + void DoubleClick(); + CWnd* GetOwnerWindow(); + + + void OnTypedown (char* name); + void OnUpdateDirectorySelection (int dirIndex, BOOL indexChanged = TRUE); + void OnExtendedDirectorySearch(); + void OnDirectoryList(char* searchString); + static void HandleErrorReturn(int XPErrorID, CWnd* parent = NULL, int errorID = 0); + static void Close(); + void UpdateDirectories(); + DIR_Server * GetCurrentDirectoryServer (); + AB_ContainerInfo * GetCurrentContainerInfo (); + + void DoUpdateAddressBook( CCmdUI* pCmdUI, AB_CommandType cmd, BOOL bUseCheck = TRUE ); + void DoAddressBookCommand(MSG_Pane *pPane, AB_CommandType cmd); + +protected: + void StartSearching(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAddrFrame) + public: + protected: + virtual BOOL PreTranslateMessage( MSG* pMsg ); + virtual void RecalcLayout( BOOL bNotify = TRUE ) { CFrameWnd::RecalcLayout( bNotify ); } + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual BOOL LoadFrame( UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, + CWnd* pParentWnd = NULL, CCreateContext* pContext = NULL ); + virtual BOOL OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext ); + virtual void PostNcDestroy( ) {}; // Overridden to prevent auto-delete on destroy + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CAddrFrame) + afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI ); + afx_msg int OnCreate(LPCREATESTRUCT); + afx_msg void OnUpdateSecureStatus(CCmdUI *pCmdUI); + afx_msg void OnClose(); + afx_msg void OnFileClose(); + afx_msg void OnSize(UINT, int, int); + afx_msg void OnExtDirectorySearch(); + afx_msg void OnUpdateSearch( CCmdUI *pCmdUI ); + afx_msg void OnImportFile(); + afx_msg void OnUpdateImport( CCmdUI *pCmdUI ); + afx_msg void OnExportFile(); + afx_msg void OnUpdateExport ( CCmdUI *pCmdUI ); + afx_msg void OnStopSearch(); + afx_msg void OnUpdateStopSearch ( CCmdUI *pCmdUI ); + afx_msg void OnViewCommandToolbar(); + afx_msg void OnUpdateViewCommandToolbar(CCmdUI* pCmdUI); + afx_msg void OnLDAPSearch(); + afx_msg void OnComposeMsg(void); + afx_msg void OnUpdateComposeMsg(CCmdUI*); + afx_msg void OnCall(void); + afx_msg void OnUpdateCall(CCmdUI*); + afx_msg void OnAddUser(void); + afx_msg void OnUpdateAddUser(CCmdUI*); + afx_msg void OnAddAB(void); + afx_msg void OnUpdateAddAB(CCmdUI*); + afx_msg void OnAddDir(void); + afx_msg void OnUpdateAddDir(CCmdUI*); + afx_msg void OnHTMLDomains(void); + afx_msg void OnUpdateHTMLDomains(CCmdUI*); + afx_msg void OnAddList(void); + afx_msg void OnUpdateAddList(CCmdUI*); + afx_msg void OnDeleteItem(void); + afx_msg void OnUpdateDeleteItem(CCmdUI*); + afx_msg void OnUndo(void); + afx_msg void OnUpdateUndo(CCmdUI*); + afx_msg void OnRedo(void); + afx_msg void OnUpdateRedo(CCmdUI*); + afx_msg void OnItemProperties(void); + afx_msg void OnUpdateItemProperties(CCmdUI*); + afx_msg void OnSortColumn0(void); + afx_msg void OnUpdateSortColumn0(CCmdUI*); + afx_msg void OnSortColumn1(void); + afx_msg void OnUpdateSortColumn1(CCmdUI*); + afx_msg void OnSortColumn2(void); + afx_msg void OnUpdateSortColumn2(CCmdUI*); + afx_msg void OnSortColumn3(void); + afx_msg void OnUpdateSortColumn3(CCmdUI*); + afx_msg void OnSortColumn4(void); + afx_msg void OnUpdateSortColumn4(CCmdUI*); + afx_msg void OnSortColumn5(void); + afx_msg void OnUpdateSortColumn5(CCmdUI*); + afx_msg void OnSortColumn6(void); + afx_msg void OnUpdateSortColumn6(CCmdUI*); + afx_msg void OnSortAscending(void); + afx_msg void OnUpdateSortAscending(CCmdUI*); + afx_msg void OnSortDescending(void); + afx_msg void OnUpdateSortDescending(CCmdUI*); + afx_msg void OnSave(); + afx_msg void OnDestroy(); + afx_msg void OnHelpMenu(); + afx_msg void OnUpdateShowAddressBookWindow(CCmdUI*); + afx_msg void OnCreateCard(); + afx_msg void OnUpdateEditCut(CCmdUI*); + afx_msg void OnEditCut(); + afx_msg void OnUpdateEditCopy(CCmdUI*); + afx_msg void OnEditCopy(); + afx_msg void OnUpdateDeleteFromAll(CCmdUI*); + afx_msg void OnEditDeleteFromAll(); + afx_msg void OnUpdateSelectAll(CCmdUI*); + afx_msg void OnSelectAll(); + afx_msg void OnUpdateDirectoryPane(CCmdUI*); + afx_msg void OnDirectoryPane(); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; // END OF CLASS CAddrFrame() + +extern int ShowPropertySheetForEntry (MSG_Pane * pane, MWContext * context); +extern int ShowPropertySheetForDir(DIR_Server *server, MWContext *context, MSG_Pane *pane, + XP_Bool newDirectory); + +/**************************************************************************** +* +* Class: CAddrOutliner +* +* DESCRIPTION: +* This class is the column/list object in the address book +* +****************************************************************************/ +class CAddrOutliner : public CMSelectOutliner +{ +friend class CAddrOutlinerParent; + +protected: + int m_attribSortBy; + char* m_pszExtraText; + CLIPFORMAT m_cfAddresses; + CLIPFORMAT m_cfSourceTarget; + CLIPFORMAT m_cfAddrIndexes; + CLIPFORMAT m_cfDirIndexes; + MSG_Pane* m_pane; + int m_iMysticPlane; + BOOL m_bSortAscending; + MWContext* m_pContext; + AB_AttribID m_EntryAttrib [ID_RESULTS_COLNUM]; + AB_AttributeValue* m_pEntryValues; + uint16 m_intNumAttribs; + HFONT m_hFont; + CString m_psTypedown; + UINT m_uTypedownClock; + CAddrBookOutlinerOwner * m_pOutlinerOwner; + ABID m_selectedID; + +public: + CAddrOutliner ( ); + virtual ~CAddrOutliner ( ); + + void UpdateCount(); + void OnTypedown(int32 index); + void OnTypedown (char* name); + + int GetSortBy() { return m_attribSortBy; } + void SetDirectoryIndex (int dirIndex); + BOOL GetSortAscending() { return m_bSortAscending; } + + virtual void OnSelChanged(); + virtual void OnSelDblClk(); + + virtual HFONT GetLineFont( void *pLineData ); + virtual LPCTSTR GetColumnText ( UINT iColumn, void * pLineData ); + virtual void * AcquireLineData ( int iLine ); + virtual void ReleaseLineData ( void * pLineData ); + virtual void GetTreeInfo ( int iLine, uint32 * pFlags, int * iDepth, + OutlinerAncestorInfo ** pAncestor ); + virtual int TranslateIcon ( void *); + virtual int TranslateIconFolder ( void *); + + void SetPane( MSG_Pane *pane ); + MSG_Pane* GetPane() { return m_pane; } + + void SetOutlinerOwner(CAddrBookOutlinerOwner *pOwner) { m_pOutlinerOwner = pOwner;} + CAddrBookOutlinerOwner *GetOutlinerOwner() { return m_pOutlinerOwner;} + + MWContext *GetContext() { return m_pContext; } + void SetContext( MWContext *pContext ) { m_pContext = pContext; } + + virtual void MysticStuffStarting( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num); + virtual void MysticStuffFinishing( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num); + + virtual BOOL RenderData ( UINT iColumn, CRect & rect, CDC & pdc, const char * ); + virtual BOOL DeleteItem ( int iLine ); + + virtual BOOL ColumnCommand ( int iColumn, int iLine ); + + virtual void InitializeClipFormats(void); + virtual CLIPFORMAT * GetClipFormatList(void); + virtual void AcceptDrop(int iLineNo, COleDataObject *object, DROPEFFECT effect); + virtual DROPEFFECT DropSelect(int iLineNo, COleDataObject *pObject); + virtual COleDataSource * GetDataSource(void); + virtual void PropertyMenu ( int iSel, UINT flags ); + + + virtual BOOL IsSelected ( int iLine ); + + +protected: + virtual void AddSelection( MSG_ViewIndex iSel ); + virtual void RemoveSelection( MSG_ViewIndex iSel ); + virtual void RemoveSelectionRange( MSG_ViewIndex iSelBegin, MSG_ViewIndex iSelEnd ); + virtual void ClearSelection(); + + + // Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CAddrOutliner) + afx_msg void OnTimer( UINT ); + afx_msg void OnKeyDown ( UINT nChar, UINT nRepCnt, UINT nFlags ); + afx_msg void OnKillFocus( CWnd* pNewWnd ); + afx_msg void OnSize( UINT, int, int); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() + +}; // END OF CLASS CAddrOutliner() + + +/**************************************************************************** +* +* Class: CAddrOutlinerParent +* +* DESCRIPTION: +* This class is the window around the column/list object in the address +* book. It is mainly purpose is to draw the column headings. +* +****************************************************************************/ +class CAddrOutlinerParent : public COutlinerParent +{ +public: + CAddrOutlinerParent(); + virtual ~CAddrOutlinerParent(); + virtual COutliner * GetOutliner ( ); + virtual void CreateColumns ( ); + virtual BOOL RenderData ( int idColumn, CRect & rect, CDC & dc, const char *); + virtual BOOL ColumnCommand ( int idColumn ); + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CAddrOutlinerParent) + afx_msg void OnDestroy(); + afx_msg void OnLButtonUp ( UINT nFlags, CPoint point ); + + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + + +/**************************************************************************** +* +* Class: CDirOutliner +* +* DESCRIPTION: +* This class is the column/list object in the address book for directory +* and mailing list information +* +****************************************************************************/ +class CDirOutliner : public CMSelectOutliner +{ +friend class CDirOutlinerParent; + +protected: + int m_lineindex; + char* m_pszExtraText; + CLIPFORMAT m_cfAddresses; + CLIPFORMAT m_cfSourceTarget; + CLIPFORMAT m_cfAddrIndexes; + CLIPFORMAT m_cfDirIndexes; + MSG_Pane* m_pane; + int m_iMysticPlane; + AB_ContainerAttribValue* m_pLineValues; + uint16 m_numItems; + int m_dirIndex; + HFONT m_hFont; + OutlinerAncestorInfo * m_pAncestor; + AB_ContainerInfo** m_pSelection; + AB_ContainerInfo* m_pFocus; + CAddrBookOutlinerOwner *m_pOutlinerOwner; +public: + CDirOutliner ( ); + virtual ~CDirOutliner ( ); + + void UpdateCount(); + void OnChangeDirectory(int dirIndex); + int GetDirectoryIndex () { return m_dirIndex; } + + virtual void OnSelChanged(); + virtual void OnSelDblClk(); + + virtual HFONT GetLineFont( void *pLineData ); + virtual LPCTSTR GetColumnText ( UINT iColumn, void * pLineData ); + virtual void * AcquireLineData ( int iLine ); + virtual void ReleaseLineData ( void * pLineData ); + virtual void GetTreeInfo ( int iLine, uint32 * pFlags, int * iDepth, + OutlinerAncestorInfo ** pAncestor ); + virtual int TranslateIcon ( void *); + virtual int TranslateIconFolder ( void *); + virtual int ToggleExpansion ( int iLine ); + virtual int Expand ( int iLine ); + virtual int Collapse ( int iLine ); + + void SetOutlinerOwner(CAddrBookOutlinerOwner *pOwner) { m_pOutlinerOwner = pOwner;} + CAddrBookOutlinerOwner *GetOutlinerOwner() { return m_pOutlinerOwner;} + void SetPane( MSG_Pane *pane ); + MSG_Pane* GetPane() { return m_pane; } + + virtual void MysticStuffStarting( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num); + virtual void MysticStuffFinishing( XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num); + +// virtual BOOL RenderData ( UINT iColumn, CRect & rect, CDC & pdc, const char * ); + virtual BOOL DeleteItem ( int iLine ); + + virtual BOOL ColumnCommand ( int iColumn, int iLine ); + + virtual void InitializeClipFormats(void); + virtual CLIPFORMAT * GetClipFormatList(void); + virtual void AcceptDrop(int iLineNo, COleDataObject *object, DROPEFFECT effect); + virtual DROPEFFECT DropSelect(int iLineNo, COleDataObject *pObject); + virtual COleDataSource * GetDataSource(void); + virtual void PropertyMenu ( int iSel, UINT flags ); + + // Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CDirOutliner) + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() + +}; // END OF CLASS CDirOutliner() + + +/**************************************************************************** +* +* Class: CDirOutlinerParent +* +* DESCRIPTION: +* This class is the window around the list of directories in the address +* book. It is mainly purpose is to draw the column headings. +* +****************************************************************************/ +class CDirOutlinerParent : public COutlinerParent +{ +public: + CDirOutlinerParent(); + virtual ~CDirOutlinerParent(); + virtual COutliner * GetOutliner ( ); + virtual void CreateColumns ( ); + virtual BOOL RenderData ( int idColumn, CRect & rect, CDC & dc, const char *); + virtual BOOL ColumnCommand ( int idColumn ); + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CDirOutlinerParent) + afx_msg void OnLButtonUp ( UINT nFlags, CPoint point ); + + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +#else /**************************************************************************** * * Class: CAddrBar @@ -205,6 +795,8 @@ protected: public: CAddrFrame(); static CAddrFrame *Open(); + static DIR_Server *DIRServerFromMenuID( UINT nID ); + static DIR_Server *DIRServerFromMenuID( UINT &nBase, UINT nID ); static void UpdateMenu(HMENU hMenu, UINT &nID); // Support for IMailFrame @@ -234,16 +826,13 @@ public: void UpdateDirectories(); DIR_Server * GetCurrentDirectoryServer (); -#ifndef _WIN32 - CWnd *CreateView(CCreateContext* pContext, UINT nID = AFX_IDW_PANE_FIRST); -#endif - void DoUpdateAddressBook( CCmdUI* pCmdUI, AB_CommandType cmd, BOOL bUseCheck = TRUE ); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAddrFrame) public: + protected: virtual BOOL PreTranslateMessage( MSG* pMsg ); virtual void RecalcLayout( BOOL bNotify = TRUE ) { CFrameWnd::RecalcLayout( bNotify ); } @@ -254,6 +843,7 @@ public: virtual void PostNcDestroy( ) {}; // Overridden to prevent auto-delete on destroy //}}AFX_VIRTUAL + // Implementation protected: // Generated message map functions @@ -569,5 +1159,7 @@ protected: DECLARE_MESSAGE_MAP() }; +#endif + #endif diff --git a/mozilla/cmd/winfe/animecho.cpp b/mozilla/cmd/winfe/animecho.cpp index d00a406f5fa..f09d13daabb 100644 --- a/mozilla/cmd/winfe/animecho.cpp +++ b/mozilla/cmd/winfe/animecho.cpp @@ -1,3 +1,23 @@ +/* -*- 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 "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 Communicator client 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. + */ + + #include "stdafx.h" #include "animecho.h" diff --git a/mozilla/cmd/winfe/animecho.h b/mozilla/cmd/winfe/animecho.h index 3d825070520..2ed7c41416f 100644 --- a/mozilla/cmd/winfe/animecho.h +++ b/mozilla/cmd/winfe/animecho.h @@ -1,3 +1,23 @@ +/* -*- 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 "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 Communicator client 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. + */ + + #ifndef __ANIMECHO_H // Avoid include redundancy // diff --git a/mozilla/cmd/winfe/apiaddr.h b/mozilla/cmd/winfe/apiaddr.h index f238ae11159..4bd0e31d615 100644 --- a/mozilla/cmd/winfe/apiaddr.h +++ b/mozilla/cmd/winfe/apiaddr.h @@ -25,6 +25,11 @@ #include "nsguids.h" #endif +#include "abcom.h" + + +typedef enum {NC_NameComplete, NC_Expand, NC_RFC822, NC_None} NameCompletionEnum; + class IAddressParent { public: @@ -52,6 +57,27 @@ public: virtual char * NameCompletion ( char * pString ) = 0; + + virtual void StartNameCompletionSearch( + void + )=0; + + virtual void StopNameCompletionSearch( + void + )=0; + + virtual void SetProgressBarPercent( + int32 lPercent + )=0; + + virtual void SetStatusText( + const char* pMessage + )=0; + + virtual CWnd *GetOwnerWindow( + void + )=0; + }; typedef IAddressParent * LPADDRESSPARENT; @@ -202,6 +228,14 @@ public: BOOL bSelected ) = 0; + virtual void SetContext( + MWContext *pContext + ) = 0; + + virtual MWContext *GetContext( + void + ) = 0; + #define ADDRESS_TYPE_FLAG UINT #define ADDRESS_TYPE_FLAG_VALUE 0x1 #define ADDRESS_TYPE_FLAG_HIDDEN 0x2 @@ -219,9 +253,49 @@ public: BOOL bParse = TRUE ) = 0; + virtual BOOL GetEnableParsing( + void + )=0; + + virtual void EnableExpansion( + BOOL bExpand = TRUE + )=0; + + virtual BOOL GetEnableExpansion( + void + )=0; virtual void SetCSID ( int16 csid = 0 ) = 0; + virtual void ShowNameCompletionPicker( + CWnd *pParent = NULL + )=0; + + virtual void StartNameCompletion( + int nIndex = -1 + )=0; + + virtual void StopNameCompletion( + int nIndex = -1, + BOOL bEraseCookie = TRUE + )=0; + virtual void SetEntryHasNameCompletion( + BOOL bHasNameCompletion = TRUE, + int nIndex = -1 + )=0; + virtual BOOL GetEntryHasNameCompletion( + int nIndex = -1 + )=0; + virtual void SetNameCompletionCookieInfo( + AB_NameCompletionCookie *pCookie, + int nNumResults, + NameCompletionEnum ncEnum, + int nIndex = -1)=0; + virtual void GetNameCompletionCookieInfo( + AB_NameCompletionCookie **pCookie, + int *pNumResults, + int nIndex = -1)=0; + }; typedef IAddressControl * LPADDRESSCONTROL; diff --git a/mozilla/cmd/winfe/apichrom.h b/mozilla/cmd/winfe/apichrom.h index 802dccb3c5e..39d86644fff 100755 --- a/mozilla/cmd/winfe/apichrom.h +++ b/mozilla/cmd/winfe/apichrom.h @@ -54,6 +54,8 @@ public: virtual void RemoveAllButtons() = 0; virtual CToolbarButton *RemoveButton( int index ) = 0; + virtual CToolbarButton *GetButtonByIndex(int index) = 0; + virtual CToolbarButton *GetButtonByID(int nCmd) = 0; virtual BOOL LoadBitmap( LPCSTR lpszResourceName ) = 0; @@ -77,7 +79,7 @@ public: virtual int Create( CWnd* pParentWnd, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, UINT nID = AFX_IDW_STATUS_BAR, - BOOL bSecurity = TRUE, BOOL bTaskbar = TRUE ) = 0; + BOOL bxxx = TRUE, BOOL bTaskbar = TRUE ) = 0; virtual void Attach( CNetscapeStatusBar *pBar ) = 0; diff --git a/mozilla/cmd/winfe/askmedlg.cpp b/mozilla/cmd/winfe/askmedlg.cpp index 3291d1a658e..64004d6b800 100644 --- a/mozilla/cmd/winfe/askmedlg.cpp +++ b/mozilla/cmd/winfe/askmedlg.cpp @@ -29,15 +29,21 @@ static char THIS_FILE[] = __FILE__; #endif + void AskMeDlg(void) { int32 nPromptAskMe = FALSE; - PREF_GetIntPref("offline.startup_mode", &nPromptAskMe); - if (nPromptAskMe==0) //online - PREF_SetBoolPref("network.online", TRUE); - else if (nPromptAskMe==1) //offline - PREF_SetBoolPref("network.online", FALSE); - else if (nPromptAskMe==2) //ask me + PREF_GetIntPref("offline.startup_state", &nPromptAskMe); + if(nPromptAskMe == 0) //old setting (note, network.online gets initialized before + //user prefs read in so we have to reset this now + { + XP_Bool boolPref = FALSE; + PREF_GetBoolPref("network.online", &boolPref); + PREF_SetBoolPref("network.online", !boolPref); + PREF_SetBoolPref("network.online", boolPref); + + } + else if (nPromptAskMe==1) //askme { CAskMeDlg rAskMeDlg(nPromptAskMe); rAskMeDlg.DoModal(); @@ -88,25 +94,14 @@ void CAskMeDlg::OnOK() UpdateData(); if (IsDlgButtonChecked(IDC_CHECK_ASKME_DEFAULT)) { - if (IsDlgButtonChecked(IDC_RADIO_ONLINE)) - { - PREF_SetBoolPref("network.online", TRUE); - PREF_SetIntPref("offline.startup_mode",0); - } - else - { - PREF_SetBoolPref("network.online", FALSE); - PREF_SetIntPref("offline.startup_mode",1); - } - } - else - { - if (IsDlgButtonChecked(IDC_RADIO_ONLINE)) - PREF_SetBoolPref("network.online", TRUE); - else - PREF_SetBoolPref("network.online", FALSE); + //remember previous setting the next time we exit. + PREF_SetIntPref("offline.startup_state",0); } + if (IsDlgButtonChecked(IDC_RADIO_ONLINE)) + PREF_SetBoolPref("network.online", TRUE); + else + PREF_SetBoolPref("network.online", FALSE); } void CAskMeDlg::OnCheckAskMeDefault() diff --git a/mozilla/cmd/winfe/compbar.cpp b/mozilla/cmd/winfe/compbar.cpp index e65429cd89d..e2cc2e85c57 100644 --- a/mozilla/cmd/winfe/compbar.cpp +++ b/mozilla/cmd/winfe/compbar.cpp @@ -23,12 +23,15 @@ */ #include "stdafx.h" + +#include "rosetta.h" #include "resource.h" #include "compstd.h" #include "compbar.h" #include "compfrm.h" #include "compfile.h" #include "apiaddr.h" +#include "addrfrm.h" //For MOZ_NEWADDR #include "msg_srch.h" @@ -62,8 +65,7 @@ BEGIN_MESSAGE_MAP(CComposeBar, CDialogBar) ON_WM_LBUTTONUP() ON_WM_ERASEBKGND() ON_WM_DROPFILES() - ON_BN_CLICKED(ID_ENCRYPTED,OnUpdateOptions) - ON_BN_CLICKED(ID_SIGNED,OnUpdateOptions) + HG38729 ON_MESSAGE(WM_LEAVINGLASTFIELD,OnLeavingLastField) END_MESSAGE_MAP() @@ -71,7 +73,7 @@ END_MESSAGE_MAP() extern "C" char * wfe_ExpandForNameCompletion(char * pString); extern "C" char * wfe_ExpandName(char * pString); -CComposeBar::CComposeBar () : +CComposeBar::CComposeBar (MWContext *pContext) : CDialogBar () { m_iBoxHeight = 0; @@ -115,6 +117,7 @@ CComposeBar::CComposeBar () : ASSERT(m_pIImage); if (!m_pIImage->GetResourceID()) m_pIImage->Initialize(IDB_COMPOSETABS,16,16); + m_pContext = pContext; } CComposeBar::~CComposeBar ( ) @@ -822,8 +825,9 @@ int CComposeBar::OnCreate( LPCREATESTRUCT lpCreateStruct ) m_pUnkAddressControl = api->CreateClassInstance( APICLASS_ADDRESSCONTROL, NULL, (APISIGNATURE)pCompose); m_pUnkAddressControl->QueryInterface(IID_IAddressControl,(LPVOID*)&m_pIAddressList); - m_pIAddressList->SetControlParent(this); + m_pIAddressList->SetControlParent(this); + m_pIAddressList->SetContext(m_pContext); // Static text is translated to many languages // That's why we choose font name based on resource definition. CClientDC dc(this); @@ -983,6 +987,20 @@ void CComposeBar::UpdateHeaderInfo ( void ) char * szName, * szType; if(m_pIAddressList->GetEntry(i,&szType, &szName)) { +#ifdef MOZ_NEWADDR + AB_NameCompletionCookie *pCookie = NULL; + int nNumResults; + m_pIAddressList->GetNameCompletionCookieInfo(&pCookie, &nNumResults, i); + + if(pCookie && nNumResults == 1) + { + entry[iRealCount].header_value = + AB_GetExpandedHeaderString(pCookie); + + } + else + +#endif entry[iRealCount].header_value = XP_STRDUP(szName); if (!strcmp(szType,szLoadString(IDS_ADDRESSTO))) entry[iRealCount].header_type = MSG_TO_HEADER_MASK; @@ -1033,8 +1051,7 @@ void CComposeBar::UpdateHeaderInfo ( void ) untranslatedPriority, 32); MSG_SetCompHeader(pComposePane, MSG_PRIORITY_HEADER_MASK, untranslatedPriority); MSG_SetCompBoolHeader(pComposePane, MSG_RETURN_RECEIPT_BOOL_HEADER_MASK, m_bReceipt); - MSG_SetCompBoolHeader(pComposePane, MSG_ENCRYPTED_BOOL_HEADER_MASK, m_bEncrypted); - MSG_SetCompBoolHeader(pComposePane, MSG_SIGNED_BOOL_HEADER_MASK, m_bSigned); + HG87211 MSG_SetCompBoolHeader(pComposePane, MSG_UUENCODE_BINARY_BOOL_HEADER_MASK, m_bUseUUENCODE); MSG_SetCompBoolHeader(pComposePane, MSG_ATTACH_VCARD_BOOL_HEADER_MASK, m_bAttachVCard); @@ -1102,19 +1119,7 @@ void CComposeBar::CreateOptionsPage() CString cs; // create the options on the left - m_pEncrypted = new CButton; - m_pEncrypted->Create( - szLoadString(IDS_ENCRYPTED),WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX, - CRect(0,0,0,0),this,ID_ENCRYPTED); - ::SendMessage(m_pEncrypted->GetSafeHwnd(), WM_SETFONT, (WPARAM)m_cfStaticFont, FALSE); - m_pEncrypted->SetCheck(m_bEncrypted); - - m_pSigned = new CButton; - m_pSigned->Create( - szLoadString(IDS_SIGNED),WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX, - CRect(0,0,0,0),this,ID_SIGNED); - ::SendMessage(m_pSigned->GetSafeHwnd(), WM_SETFONT, (WPARAM)m_cfStaticFont, FALSE); - m_pSigned->SetCheck(m_bSigned); + HG81325 m_pUseUUENCODE = new CButton; m_pUseUUENCODE->Create( @@ -1139,7 +1144,7 @@ void CComposeBar::CreateOptionsPage() m_pPriority->Create( CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, CRect(0,0,0,0), this, 1501); - ::SendMessage(m_pPriority->GetSafeHwnd(), WM_SETFONT, (WPARAM)m_cfTextFont, FALSE); + ::SendMessage(m_pPriority->GetSafeHwnd(), WM_SETFONT, (WPARAM)m_cfStaticFont, FALSE); char priStr[32]; MSG_GetPriorityName(MSG_LowestPriority, priStr, 32); @@ -1163,7 +1168,7 @@ void CComposeBar::CreateOptionsPage() m_pMessageFormat->Create( CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, CRect(0,0,0,0), this, 1505); - ::SendMessage(m_pMessageFormat->GetSafeHwnd(), WM_SETFONT, (WPARAM)m_cfTextFont, FALSE); + ::SendMessage(m_pMessageFormat->GetSafeHwnd(), WM_SETFONT, (WPARAM)m_cfStaticFont, FALSE); m_pMessageFormat->AddString(szLoadString(IDS_FORMAT_ASKME)); m_pMessageFormat->AddString(szLoadString(IDS_FORMAT_PLAIN)); m_pMessageFormat->AddString(szLoadString(IDS_FORMAT_HTML)); @@ -1198,10 +1203,7 @@ void CComposeBar::UpdateOptionsInfo() free(m_pszMessageFormat); m_pszMessageFormat = strdup(cs); } - if (m_pSigned && ::IsWindow(m_pSigned->m_hWnd)) - m_bSigned = m_pSigned->GetCheck(); - if (m_pEncrypted && ::IsWindow(m_pEncrypted->m_hWnd)) - m_bEncrypted = m_pEncrypted->GetCheck(); + HG87322 if (m_pUseUUENCODE && ::IsWindow(m_pUseUUENCODE->m_hWnd)) m_bUseUUENCODE = m_pUseUUENCODE->GetCheck(); } @@ -1227,24 +1229,13 @@ void CComposeBar::DestroyOptionsPage() delete m_pReturnReceipt; m_pReturnReceipt = NULL; } - if (m_pEncrypted && ::IsWindow(m_pEncrypted->m_hWnd)) - { - m_pEncrypted->DestroyWindow(); - delete m_pEncrypted; - m_pEncrypted = NULL; - } + if (m_pUseUUENCODE && ::IsWindow(m_pUseUUENCODE->m_hWnd)) { m_pUseUUENCODE->DestroyWindow(); delete m_pUseUUENCODE; m_pUseUUENCODE = NULL; } - if (m_pSigned && ::IsWindow(m_pSigned->m_hWnd)) - { - m_pSigned->DestroyWindow(); - delete m_pSigned; - m_pSigned = NULL; - } if (m_pMessageFormat && ::IsWindow(m_pMessageFormat->m_hWnd)) { m_pMessageFormat->DestroyWindow(); @@ -1322,6 +1313,7 @@ void CComposeBar::CreateAddressingBlock(void) void CComposeBar::AddedItem (HWND hwnd, LONG id,int index) { +#ifndef MOZ_NEWADDR char * szName = NULL; BOOL bRetVal = m_pIAddressList->GetEntry(index, NULL, &szName); if (bRetVal) @@ -1334,11 +1326,14 @@ void CComposeBar::AddedItem (HWND hwnd, LONG id,int index) free(pszFullName); } } +#endif } int CComposeBar::ChangedItem(char * pString, int, HWND, char** ppszFullName, unsigned long* entryID, UINT* bitmapID) { +#ifndef MOZ_NEWADDR (*ppszFullName) = wfe_ExpandName(pString); +#endif return TRUE; } @@ -1351,6 +1346,45 @@ char * CComposeBar::NameCompletion(char * pString) return wfe_ExpandForNameCompletion(pString); } +void CComposeBar::StartNameCompletionSearch() +{ + if(IsWindow(m_hWnd)) + { + CComposeFrame *pComposeFrame = (CComposeFrame*)GetParent(); + if(pComposeFrame) + pComposeFrame->GetChrome()->StartAnimation(); + } + +} + +void CComposeBar::StopNameCompletionSearch() +{ + if(IsWindow(m_hWnd)) + { + CComposeFrame *pComposeFrame = (CComposeFrame*)GetParent(); + + if(pComposeFrame) + pComposeFrame->GetChrome()->StopAnimation(); + } + +} + +void CComposeBar::SetProgressBarPercent(int32 lPercent) +{ + +} + +void CComposeBar::SetStatusText(const char* pMessage) +{ + +} + +CWnd *CComposeBar::GetOwnerWindow() +{ + + return GetParent(); +} + void CComposeBar::CreateStandardFields(void) { // create subject edit field @@ -1452,11 +1486,7 @@ void CComposeBar::CalcFieldLayout(void) rect.bottom = rect.top + m_iBoxHeight; rect.left = x + m_cxChar * 3; rect.right = (WinRect.Width()/2) + 24; - m_pEncrypted->MoveWindow(rect); - - rect.top = rect.bottom + 1; - rect.bottom = rect.top + m_iBoxHeight; - m_pSigned->MoveWindow(rect); + HG76528 rect.top = rect.bottom + 1; rect.bottom = rect.top + m_iBoxHeight; @@ -1666,6 +1696,82 @@ void CComposeBar::OnDropFiles( HDROP hDropInfo ) } } +BOOL CComposeBar::ProcessAddressBookIndexFormat(COleDataObject *pDataObject, + DROPEFFECT effect,CPoint &point) +{ + HGLOBAL hContent; + BOOL retVal = FALSE; + if(!pDataObject) + return FALSE; + + if (pDataObject->IsDataAvailable( ::RegisterClipboardFormat(ADDRESSBOOK_INDEX_FORMAT) )) + { + hContent = pDataObject->GetGlobalData (::RegisterClipboardFormat(ADDRESSBOOK_INDEX_FORMAT)); + AddressBookDragData *pDragData = (AddressBookDragData *) GlobalLock(hContent); + + BOOL retVal; + CWnd * pWnd = GetFocus(); + + XP_List * pEntries; + int32 iEntries; + CComposeFrame *pCompose = (CComposeFrame *)GetParentFrame(); + ApiApiPtr(api); + LPUNKNOWN pUnk = api->CreateClassInstance( + APICLASS_ADDRESSCONTROL, NULL, (APISIGNATURE)pCompose); + LPADDRESSCONTROL pIAddressControl = NULL; + if (pUnk) + { + HRESULT hRes = pUnk->QueryInterface(IID_IAddressControl,(LPVOID*)&pIAddressControl); + ASSERT(hRes==NOERROR); + } + if (pIAddressControl) + { + int itemNum = pIAddressControl->GetItemFromPoint(&point); + char * szType = NULL; + char * szName = NULL; + CListBox * pListBox = pIAddressControl->GetListBox(); + if (itemNum <= pListBox->GetCount()) + pIAddressControl->GetEntry (itemNum, &szType, &szName); + char * pszType = strdup(szType); + if (pListBox->GetCount() == 1 && (!szName || !strlen(szName))) + pListBox->ResetContent(); + else + if (!szName || !strlen(szName)) + pIAddressControl->DeleteEntry(itemNum); + // this is where we get all of the info + for (int32 i = 0; i < pDragData->m_count; i++) + { + AB_NameCompletionCookie *pCookie = AB_GetNameCompletionCookieForIndex( + pDragData->m_pane, pDragData->m_indices[i]); + char * pString = AB_GetHeaderString(pCookie); + AB_EntryType type = AB_GetEntryTypeForNCCookie(pCookie); + + if (pString != NULL) + pIAddressControl->AppendEntry(FALSE, pszType,pString, + (type == AB_Person) ? + IDB_PERSON :IDB_MAILINGLIST); + int count = pListBox->GetCount(); + pIAddressControl->SetNameCompletionCookieInfo(pCookie, 1, + NC_NameComplete, count - 1); + + + + } + if (pUnk) + pUnk->Release(); + if (pszType) + free(pszType); + retVal = TRUE; + } + GlobalUnlock(hContent); + if (pWnd && ::IsWindow(pWnd->m_hWnd)) + pWnd->SetFocus(); + } + return retVal; + +} + + BOOL CComposeBar::ProcessVCardData(COleDataObject * pDataObject, CPoint &point) { UINT clipFormat; @@ -1730,7 +1836,56 @@ BOOL CComposeBar::ProcessVCardData(COleDataObject * pDataObject, CPoint &point) return retVal; } +BOOL CComposeBar::AddURLToAddressPane(COleDataObject * pDataObject, CPoint &point, LPSTR szURL) +{ + if(!pDataObject->IsDataAvailable(RegisterClipboardFormat(NETSCAPE_BOOKMARK_FORMAT))) + return FALSE; + CWnd * pWnd = GetFocus(); + CComposeFrame *pCompose = (CComposeFrame *)GetParentFrame(); + ApiApiPtr(api); + LPUNKNOWN pUnk = api->CreateClassInstance( + APICLASS_ADDRESSCONTROL, NULL, (APISIGNATURE)pCompose); + LPADDRESSCONTROL pIAddressControl = NULL; + + if(pUnk == NULL) + return FALSE; + + HRESULT hRes = pUnk->QueryInterface(IID_IAddressControl,(LPVOID*)&pIAddressControl); + ASSERT(hRes==NOERROR); + + if(pIAddressControl == NULL) + return FALSE; + + CListBox * pListBox = pIAddressControl->GetListBox(); + char * szName = NULL; + char * szType = NULL; + BOOL bOutside = FALSE; + int iPlace = pListBox->ItemFromPoint(point, bOutside); + + pIAddressControl->GetEntry(iPlace, &szType, &szName); + + if(iPlace == pListBox->GetCount() - 1) + { + if(!szName || !strlen(szName)) + if(pListBox->GetCount() == 1) + pListBox->ResetContent(); + else + pIAddressControl->DeleteEntry(iPlace); + } + + CString type; + type.LoadString(IDS_ADDRESSNEWSGROUP); + + pIAddressControl->AppendEntry(FALSE, type, szURL, IDB_NEWSART); + + pUnk->Release(); + + if(pWnd && ::IsWindow(pWnd->m_hWnd)) + pWnd->SetFocus(); + + return TRUE; +} ////////////////////////////////////////////////////////////////////////////// // CNSCollapser @@ -1906,12 +2061,5 @@ void CComposeBar::OnUpdateOptions(void) void CComposeBar::UpdateSecurityOptions(void) { - if (m_iSelectedTab == IDX_COMPOSEOPTIONS) - { - if (m_pEncrypted && ::IsWindow(m_pEncrypted->m_hWnd)) - m_pEncrypted->SetCheck(m_bEncrypted); - if (m_pSigned && ::IsWindow(m_pSigned->m_hWnd)) - m_pSigned->SetCheck(m_bSigned); - } - + HG26723 } diff --git a/mozilla/cmd/winfe/compbar.h b/mozilla/cmd/winfe/compbar.h index 5e0de4d6120..5feb8bd6fa5 100644 --- a/mozilla/cmd/winfe/compbar.h +++ b/mozilla/cmd/winfe/compbar.h @@ -20,6 +20,7 @@ #include #include +#include "rosetta.h" #include "compstd.h" #include "msgcom.h" #include "addrbook.h" @@ -106,6 +107,8 @@ public: CComboBox * m_pMessageFormat; CNSAttachDropTarget * m_pDropTarget; + MWContext *m_pContext; + virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz ); void Enable3d(BOOL bEnable); @@ -118,7 +121,7 @@ public: BOOL m_bCanSize; int m_iY; - CComposeBar ( ); + CComposeBar (MWContext *pContext ); ~CComposeBar ( ); LPADDRESSCONTROL GetAddressWidgetInterface(); @@ -138,13 +141,10 @@ public: return m_pComposeEdit; } void SetCSID(int m_iCSID); - void SetSigned(BOOL bSigned) { m_bSigned = bSigned; } - void SetEncrypted(BOOL bEncrypted) { m_bEncrypted = bEncrypted; } + HG29792 void SetReturnReceipt(BOOL bReceipt) { m_bReceipt = bReceipt; } void SetUse8Bit(BOOL bUse8Bit) { m_bUse8Bit = bUse8Bit; } void SetUseUUENCODE(BOOL bUseUUENCODE) {m_bUseUUENCODE = bUseUUENCODE; } - BOOL GetEncrypted(void) { return m_bEncrypted; } - BOOL GetSigned(void) { return m_bSigned; } BOOL GetReturnReceipt(void) { return m_bReceipt; } BOOL GetUse8Bit(void) { return m_bUse8Bit; } BOOL GetUseUUENCODE(void) { return m_bUseUUENCODE; } @@ -181,8 +181,17 @@ public: virtual int ChangedItem (char * pString, int index, HWND hwnd, char ** ppszFullName, unsigned long* entryID = NULL, UINT* bitmapID = NULL); virtual void DeletedItem (HWND hwnd, LONG id,int index); virtual char * NameCompletion (char *); + virtual void StartNameCompletionSearch(); + virtual void StopNameCompletionSearch(); + virtual void SetProgressBarPercent(int32 lPercent); + virtual void SetStatusText(const char* pMessage ); + virtual CWnd *GetOwnerWindow(); + virtual int OnToolHitTest( CPoint point, TOOLINFO* pTI ) const; BOOL ProcessVCardData(COleDataObject * pDataObject,CPoint &point); + BOOL ProcessAddressBookIndexFormat(COleDataObject *pDataObject, DROPEFFECT effect, + CPoint &point); + BOOL AddURLToAddressPane(COleDataObject * pDataObject, CPoint &point, LPSTR szURL); void OnAttachTab(void); void OnAddressTab(void); diff --git a/mozilla/cmd/winfe/compfe.cpp b/mozilla/cmd/winfe/compfe.cpp index 9effbe6bc8a..84980915d4e 100644 --- a/mozilla/cmd/winfe/compfe.cpp +++ b/mozilla/cmd/winfe/compfe.cpp @@ -185,6 +185,8 @@ extern "C" MSG_Pane *FE_CreateCompositionPane(MWContext *pOldContext, XP_Bool htmlCompose; PREF_GetBoolPref("mail.html_compose",&htmlCompose); + if (theApp.m_bReverseSenseOfHtmlCompose) + htmlCompose = !htmlCompose; if (editorType == MSG_HTML_EDITOR) htmlCompose = TRUE; @@ -292,6 +294,7 @@ extern "C" MSG_Pane *FE_CreateCompositionPane(MWContext *pOldContext, if (pUrl != NULL) { // pUrl->pre_exit_fn = wfe_GoldDoneLoading; + pUrl->internal_url = TRUE; pContext->GetUrl(pUrl, FO_CACHE_AND_PRESENT); pContext->GetContext()->bIsComposeWindow = TRUE; } diff --git a/mozilla/cmd/winfe/compfile.cpp b/mozilla/cmd/winfe/compfile.cpp index b2d140e2552..7eeae6ec2f9 100644 --- a/mozilla/cmd/winfe/compfile.cpp +++ b/mozilla/cmd/winfe/compfile.cpp @@ -27,6 +27,7 @@ #include "wfemsg.h" #include "mailmisc.h" #include "nsadrlst.h" +#include "addrfrm.h" extern char* wfe_ConstructFilterString(int type); extern char* XP_NetToDosFileName(const char * NetName); @@ -714,21 +715,57 @@ void CNSAttachDropTarget::OnDragLeave(CWnd *) { } -BOOL CNSAttachDropTarget::OnDrop(CWnd * pWnd, COleDataObject * pDataObject, DROPEFFECT, CPoint point) +static LPSTR getDataObjectNewsURL(COleDataObject * pDataObject) { - CComposeFrame * pFrame = (CComposeFrame*)pWnd->GetParentFrame(); - CComposeBar * pComposeBar = pFrame->GetComposeBar(); - if(pDataObject->IsDataAvailable(::RegisterClipboardFormat(vCardClipboardFormat)) ) - { + if (!pDataObject->IsDataAvailable(::RegisterClipboardFormat(NETSCAPE_BOOKMARK_FORMAT))) + return FALSE; + + char * szURL = NULL; + char * szTitle = NULL; + wfe_GetBookmarkData(pDataObject, &szURL, &szTitle); + if((strnicmp(szURL, "news", 4) == 0) || (strnicmp(szURL, "snews", 5) == 0)) + return szURL; + else + return NULL; +} + +BOOL CNSAttachDropTarget::OnDrop(CWnd * pWnd, COleDataObject * pDataObject, DROPEFFECT effect, CPoint point) +{ + CComposeFrame * pFrame = (CComposeFrame*)pWnd->GetParentFrame(); + CComposeBar * pComposeBar = pFrame->GetComposeBar(); +#ifdef MOZ_NEWADDR + if(pDataObject->IsDataAvailable(::RegisterClipboardFormat(ADDRESSBOOK_INDEX_FORMAT))) + { + pComposeBar->OnAddressTab(); + pComposeBar->UpdateWindow(); + pComposeBar->ProcessAddressBookIndexFormat(pDataObject,effect, point); + + return TRUE; + } + else +#endif + if(pDataObject->IsDataAvailable(::RegisterClipboardFormat(vCardClipboardFormat)) ) + { + pComposeBar->OnAddressTab(); + pComposeBar->UpdateWindow(); + return pComposeBar->ProcessVCardData(pDataObject,point); + } + else + { + // do not put news URLs to attachment + char * szURL = getDataObjectNewsURL(pDataObject); + if(szURL != NULL) + { pComposeBar->OnAddressTab(); pComposeBar->UpdateWindow(); - return pComposeBar->ProcessVCardData(pDataObject,point); - } - else - { + return pComposeBar->AddURLToAddressPane(pDataObject, point, szURL); + } + else + { pComposeBar->OnAttachTab(); pComposeBar->UpdateWindow(); return pComposeBar->m_pAttachmentList->ProcessDropTarget(pDataObject); - } + } + } } diff --git a/mozilla/cmd/winfe/compfrm.cpp b/mozilla/cmd/winfe/compfrm.cpp index f843fed8880..2978ccee246 100755 --- a/mozilla/cmd/winfe/compfrm.cpp +++ b/mozilla/cmd/winfe/compfrm.cpp @@ -22,11 +22,19 @@ */ #include "stdafx.h" + +#include "rosetta.h" #include "edt.h" #include "compbar.h" #include "compfrm.h" #include "prefapi.h" +#include "addrdlg.h" #include "intl_csi.h" +#include "apiaddr.h" +#include "namcomp.h" +#include "addrfrm.h" //for MOZ_NEWADDR + +#include "nscpmapi.h" // rhp: for MAPI check extern "C" { #include "xpgetstr.h" @@ -39,6 +47,7 @@ extern int MK_MSG_MISSING_SUBJECT; #include "postal.h" #endif + #define COMPOSE_WINDOW_WIDTH 73 // default to 73 characters wide ///////////////////////////////////////////////////////////////////////////// @@ -51,12 +60,14 @@ static UINT ComposeCodes[] = { IDM_ADDRESSPICKER, ID_CHECK_SPELLING, IDM_SAVEASDRAFT, - ID_SECURITY, + HG26722 ID_NAVIGATE_INTERRUPT }; static BOOL bSendDeferred = FALSE; +const UINT NEAR MAPI_CUST_MSG = RegisterWindowMessage(MAPI_CUSTOM_COMPOSE_MSG); // rhp - for MAPI + BEGIN_MESSAGE_MAP(CComposeFrame, CGenericFrame) ON_WM_CREATE() ON_WM_CLOSE() @@ -130,6 +141,16 @@ BEGIN_MESSAGE_MAP(CComposeFrame, CGenericFrame) ON_UPDATE_COMMAND_UI(IDS_SECURITY_STATUS, OnUpdateSecureStatus) ON_UPDATE_COMMAND_UI(IDS_SIGNED_STATUS, OnUpdateSecureStatus) + // Name completion + ON_UPDATE_COMMAND_UI(ID_TOGGLENAMECOMPLETION, OnUpdateToggleNameCompletion) + ON_COMMAND(ID_TOGGLENAMECOMPLETION, OnToggleNameCompletion) + ON_UPDATE_COMMAND_UI(ID_SHOW_NAME_PICKER, OnUpdateShowNamePicker) + ON_COMMAND(ID_SHOW_NAME_PICKER, OnShowNamePicker) + +// rhp - for custom message +#ifndef MOZ_LITE + ON_REGISTERED_MESSAGE(MAPI_CUST_MSG, OnProcessMAPIMessage) // rhp - for MAPI +#endif END_MESSAGE_MAP() @@ -318,10 +339,10 @@ void CComposeFrame::CreatePlainTextEditor() // status bar format static const UINT BASED_CODE indicators[] = { - IDS_SECURITY_STATUS, - IDS_SIGNED_STATUS, + HG27811 IDS_TRANSFER_STATUS, ID_SEPARATOR, + IDS_ONLINE_STATUS, IDS_TASKBAR }; @@ -384,7 +405,7 @@ int CComposeFrame::OnCreate( LPCREATESTRUCT lpCreateStruct ) } // create the address/attachment widget dialog bar - m_pComposeBar = new CComposeBar; + m_pComposeBar = new CComposeBar(GetMainContext()->GetContext()); ASSERT(m_pComposeBar); m_pComposeBar->Create ( this, (UINT) IDD_COMPOSEBAR, (UINT) WS_CLIPCHILDREN|CBRS_TOP, @@ -502,11 +523,12 @@ BOOL CComposeFrame::PreCreateWindow ( CREATESTRUCT &cs ) cs.x = iLeft; cs.y = iTop; cs.cy = iBottom-iTop; - if (m_bUseHtml) - { - cs.cx = iRight - iLeft; - return rv; - } + + //if (m_bUseHtml) + //{ + cs.cx = iRight - iLeft; + return rv; + //} } CWnd *pCwnd = AfxGetMainWnd(); @@ -1128,6 +1150,7 @@ void CComposeFrame::OnSaveDraft ( void ) if (!m_bUseHtml) m_EditorParent.m_bModified = FALSE; + } @@ -1187,7 +1210,6 @@ void CComposeFrame::OnUpdateSaveTemplate(CCmdUI *pCmdUI) } - LRESULT CComposeFrame::OnButtonMenuOpen(WPARAM wParam, LPARAM lParam) { HMENU hMenu = (HMENU) lParam; @@ -1626,8 +1648,7 @@ void CComposeFrame::CompleteComposeInitialization(void) void CComposeFrame::UpdateSecurityOptions(void) { - m_pComposeBar->SetSigned(MSG_GetCompBoolHeader(GetMsgPane(),MSG_SIGNED_BOOL_HEADER_MASK)); - m_pComposeBar->SetEncrypted(MSG_GetCompBoolHeader(GetMsgPane(),MSG_ENCRYPTED_BOOL_HEADER_MASK)); + HG27625 } void CComposeFrame::GoldDoneLoading () @@ -1705,11 +1726,7 @@ void CComposeFrame::OnToggleMessageToolbar() void CComposeFrame::OnUpdateToggleMessageToolbar(CCmdUI* pCmdUI) { - if( pCmdUI->m_pMenu ){ - pCmdUI->m_pMenu->ModifyMenu(IDM_OPT_MESSAGEBAR_TOGGLE, MF_BYCOMMAND | MF_STRING, CASTUINT(IDM_OPT_MESSAGEBAR_TOGGLE), - szLoadString(GetChrome()->GetToolbarVisible(ID_COMPOSE_MESSAGE_TOOLBAR) ? - IDS_HIDE_MESSAGE_TOOLBAR : IDS_SHOW_MESSAGE_TOOLBAR ) ); - } + pCmdUI->SetCheck(GetChrome()->GetToolbarVisible(ID_COMPOSE_MESSAGE_TOOLBAR)); pCmdUI->Enable(TRUE); } @@ -1720,12 +1737,7 @@ void CComposeFrame::OnToggleAddressArea() void CComposeFrame::OnUpdateToggleAddressArea(CCmdUI * pCmdUI) { - //CLM: Change to a Show|Hide pair of strings - if( pCmdUI->m_pMenu ){ - pCmdUI->m_pMenu->ModifyMenu(IDM_MESSAGEBODYONLY, MF_BYCOMMAND | MF_STRING, CASTUINT(IDM_MESSAGEBODYONLY), - szLoadString(CASTUINT(m_pComposeBar->IsVisible() ? - IDS_HIDE_ADDRESS_AREA : IDS_SHOW_ADDRESS_AREA)) ); - } + pCmdUI->SetCheck(m_pComposeBar->IsVisible()); pCmdUI->Enable(TRUE); } @@ -1736,34 +1748,92 @@ void CComposeFrame::OnUpdateToggleAddressArea(CCmdUI * pCmdUI) void CComposeFrame::OnUpdateSecurity(CCmdUI * pCmdUI) { - XP_Bool bSigned = m_pComposeBar->GetSigned(); - XP_Bool bEncrypted = m_pComposeBar->GetEncrypted(); - LPNSTOOLBAR pIToolBar; - m_pChrome->QueryInterface( IID_INSToolBar, (LPVOID *) &pIToolBar ); - if ( pIToolBar ) { - CCommandToolbar *pToolBar = (CCommandToolbar *) CWnd::FromHandlePermanent( pIToolBar->GetHWnd() ); - - int index = bEncrypted ? - (bSigned ? SEC_SIGNED_INDEX : SECURE_INDEX) : - (bSigned ? UNSEC_SIGNED_INDEX : UNSECURE_INDEX); - - pToolBar->ReplaceButtonBitmapIndex(ID_SECURITY, index); - pIToolBar->Release(); - } + HG72521 OnUpdateButtonGeneral(pCmdUI); } void CComposeFrame::OnUpdateSecureStatus(CCmdUI *pCmdUI) { - XP_Bool bSigned = m_pComposeBar->GetSigned(); - XP_Bool bEncrypted = m_pComposeBar->GetEncrypted(); - - if (pCmdUI->m_nID == IDS_SECURITY_STATUS) - pCmdUI->Enable(bEncrypted); - else - pCmdUI->Enable(bSigned); + HG87282 } +void CComposeFrame::OnUpdateShowNamePicker(CCmdUI *pCmdUI) +{ +#ifdef MOZ_NEWADDR + pCmdUI->Enable(FALSE); + + LPADDRESSCONTROL pIAddress = GetAddressWidgetInterface(); + if (pIAddress) + { + CEdit *pEdit = pIAddress->GetAddressNameField(); + + if(GetFocus() == pEdit) + { + pCmdUI->Enable(TRUE); + } + } + +#else + pCmdUI->Enable(FALSE); +#endif +} + +void CComposeFrame::OnShowNamePicker() +{ +#ifdef MOZ_NEWADDR + + //need to get text of current selection + LPADDRESSCONTROL pIAddress = GetAddressWidgetInterface(); + if (pIAddress) + { + pIAddress->ShowNameCompletionPicker(this); + } + + +#endif +} + +void CComposeFrame::OnUpdateToggleNameCompletion(CCmdUI *pCmdUI) +{ + pCmdUI->Enable(FALSE); + +#ifdef MOZ_NEWADDR + + LPADDRESSCONTROL pIAddress = GetAddressWidgetInterface(); + if(pIAddress) + { + pCmdUI->Enable(TRUE); + BOOL bHasNameCompletion = pIAddress->GetEntryHasNameCompletion(); + + if(bHasNameCompletion) + { + pCmdUI->SetText(::szLoadString(IDS_NAMECOMPLETIONOFF)); + + } + else + { + pCmdUI->SetText(::szLoadString(IDS_NAMECOMPLETIONON)); + } + + } +#endif + +} + +void CComposeFrame::OnToggleNameCompletion() +{ +#ifdef MOZ_NEWADDR + LPADDRESSCONTROL pIAddress = GetAddressWidgetInterface(); + if(pIAddress) + { + BOOL bHasNameCompletion = pIAddress->GetEntryHasNameCompletion(); + + pIAddress->SetEntryHasNameCompletion(!bHasNameCompletion); + } +#endif +} + + char * CComposeFrame::PromptMessageSubject() { CWnd * pWnd = GetFocus(); @@ -1829,14 +1899,28 @@ LRESULT CComposeFrame::OnSetMessageString(WPARAM wParam, LPARAM lParam) // This is to wait until attachments are loaded for MAPI Operations void CComposeFrame::UpdateComposeWindowForMAPI(void) { + TRACE("UPDATE WINDOW FOR MAPI\n"); if (GetMAPISendMode() == MAPI_SEND) { + TRACE("SEND WINDOW FOR MAPI\n"); PostMessage(WM_COMMAND, IDM_SEND); SetMAPISendMode(MAPI_IGNORE); } else if (GetMAPISendMode() == MAPI_SAVE) { + TRACE("SAVE WINDOW FOR MAPI\n"); PostMessage(WM_COMMAND, IDM_SAVEASDRAFT); + SetMAPISendMode(MAPI_QUITWHENDONE); + } + else if (GetMAPISendMode() == MAPI_QUITWHENDONE) + { + PostMessage(WM_CLOSE); SetMAPISendMode(MAPI_IGNORE); } } + +// rhp - This is to respond to a custom message to identify compose windows +LONG CComposeFrame::OnProcessMAPIMessage(WPARAM wParam, LPARAM lParam) +{ + return(MAPI_CUSTOM_RET_CODE); +} diff --git a/mozilla/cmd/winfe/compfrm.h b/mozilla/cmd/winfe/compfrm.h index b07d8a07326..22fa328ecec 100755 --- a/mozilla/cmd/winfe/compfrm.h +++ b/mozilla/cmd/winfe/compfrm.h @@ -40,6 +40,7 @@ #define MAPI_IGNORE 0 #define MAPI_SEND 1 #define MAPI_SAVE 2 +#define MAPI_QUITWHENDONE 3 // Forward declarations @@ -228,11 +229,18 @@ protected: afx_msg void OnUpdateSecurity(CCmdUI *pCmdUI); afx_msg void OnUpdateSecureStatus(CCmdUI *pCmdUI); + afx_msg void OnUpdateToggleNameCompletion(CCmdUI *pCmdUI); + afx_msg void OnToggleNameCompletion(); + afx_msg void OnUpdateShowNamePicker(CCmdUI *pCmdUI); + afx_msg void OnShowNamePicker(); afx_msg LONG OnSetInitialFocus(WPARAM wParam, LPARAM lParam); LRESULT OnButtonMenuOpen(WPARAM wParam, LPARAM lParam); + afx_msg void OnUpdateEncoding(CCmdUI* pCmdUI); + afx_msg LRESULT OnFindReplace(WPARAM wParam, LPARAM lParam) ; - afx_msg LRESULT OnSetMessageString(WPARAM wParam, LPARAM lParam); + afx_msg LRESULT OnSetMessageString(WPARAM wParam, LPARAM lParam); + afx_msg LONG OnProcessMAPIMessage(WPARAM wParam, LPARAM lParam); // rhp: for MAPI DECLARE_MESSAGE_MAP() diff --git a/mozilla/cmd/winfe/cxabstra.cpp b/mozilla/cmd/winfe/cxabstra.cpp index 54be00b02f5..6a56a5dcfe8 100755 --- a/mozilla/cmd/winfe/cxabstra.cpp +++ b/mozilla/cmd/winfe/cxabstra.cpp @@ -241,14 +241,6 @@ void fe_finish_exit(void *pClosure) } } -#ifdef MOZ_LOC_INDEP - /* li_stuff - time to do last synch */ - if (theApp.LIStuffEnd() == FALSE) { - // synching files. - bCanExit = FALSE; - } -#endif // MOZ_LOC_INDEP - if(AfxOleCanExitApp() == FALSE) { // Outstanding com lock. bCanExit = FALSE; @@ -262,7 +254,7 @@ void fe_finish_exit(void *pClosure) if(theApp.m_pMainWnd != NULL) { if(bCanExit) { TRACE("Posting WM_CLOSE to %p hidden frame to exit app.\n", theApp.m_pMainWnd); - theApp.m_pMainWnd->PostMessage(WM_CLOSE); + theApp.m_pMainWnd->PostMessage(WM_CLOSE); } else { // Have to retry in a little while. @@ -584,7 +576,7 @@ int CAbstractCX::GetUrl(URL_Struct *pUrl, FO_Present_Types iFormatOut, BOOL bRea #ifdef MOZ_MAIL_NEWS if ((((iFormatOut & 0x1f ) == FO_PRESENT) && (GetContext()->type != MWContextMetaFile) - && MSG_NewWindowRequired(GetContext(), pUrl->address)) + && MSG_NewWindowRequiredForURL(GetContext(), pUrl)) || bForceNew) { @@ -603,7 +595,7 @@ int CAbstractCX::GetUrl(URL_Struct *pUrl, FO_Present_Types iFormatOut, BOOL bRea { case MSG_THREADPANE: { - MSG_FolderInfo *folder = MSG_GetFolderInfoFromURL(WFE_MSGGetMaster(), pUrl->address); + MSG_FolderInfo *folder = MSG_GetFolderInfoFromURL(WFE_MSGGetMaster(), pUrl->address, TRUE); BOOL bContinue = FALSE; if (folder){ C3PaneMailFrame::Open(folder, MSG_MESSAGEKEYNONE, &bContinue); @@ -1270,8 +1262,8 @@ void CAbstractCX::CopySelection() { INTL_StrToUnicode(datacsid, (unsigned char*)text, (INTL_Unicode*)string, len); GlobalUnlock(hData); + h = ::SetClipboardData(CF_UNICODETEXT, hData); } - h = ::SetClipboardData(CF_UNICODETEXT, hData); #endif diff --git a/mozilla/cmd/winfe/cxsave.cpp b/mozilla/cmd/winfe/cxsave.cpp index a8e8188c2c9..935a917cf4f 100644 --- a/mozilla/cmd/winfe/cxsave.cpp +++ b/mozilla/cmd/winfe/cxsave.cpp @@ -481,6 +481,35 @@ BOOL CSaveCX::Creator() return(bRetval); } +#ifdef MOZ_MAIL_NEWS +void CSaveCX::AddFileExtension (char *& pFileName) +{ + char *ext = FE_FindFileExt(pFileName); + + if (!ext) { + // get the mime content type + char * pSuggestedType = MimeGetURLContentType(GetContext(),m_csAnchor); + + if (pSuggestedType && *pSuggestedType) { + // Look up an extension + char aExt[_MAX_EXT]; + DWORD dwFlags = 0; + size_t stExt = 0; + + aExt[0] = '\0'; +#ifdef XP_WIN16 + dwFlags |= EXT_DOT_THREE; +#endif + stExt = EXT_Invent(aExt, sizeof(aExt), dwFlags, pFileName, pSuggestedType); + XP_FREE(pSuggestedType); + + if (stExt) + StrAllocCat (pFileName, aExt); + } + } +} +#endif // MOZ_MAIL_NEWS + // Determine if it's OK to create the dialog for the transfer. BOOL CSaveCX::CanCreate(URL_Struct* pUrl) { @@ -503,6 +532,11 @@ BOOL CSaveCX::CanCreate(URL_Struct* pUrl) #ifdef MOZ_MAIL_NEWS char * pSuggested = MimeGuessURLContentName(GetContext(),m_csAnchor); + // get the mime content type + if (pSuggested && *pSuggested) { + // check if the file doesn't have an extension + AddFileExtension(pSuggested); + } if (!pSuggested) #else char * @@ -646,13 +680,18 @@ BOOL CSaveCX::CanCreate(URL_Struct* pUrl) int type = NET_URL_Type(pUrl->address); // bug 63751 for Mail/News attachment if ((type == MAILBOX_TYPE_URL) || (type == NEWS_TYPE_URL) || (type == IMAP_TYPE_URL)) + { #ifdef XP_WIN16 pLocalName = GetMailNewsTempFileName(pLocalName, dosName); #else pLocalName = GetMailNewsTempFileName(pLocalName); #endif +#ifdef MOZ_MAIL_NEWS + AddFileExtension( pLocalName ); +#endif + } else { - // Retain the extension. + // Retain the extension. char aExt[_MAX_EXT]; DWORD dwFlags = 0; size_t stExt = 0; @@ -737,39 +776,42 @@ char* CSaveCX::GetMailNewsTempFileName(char* pTempPath, char *pFileName) #ifdef XP_WIN16 if (pFileName) { pExt = FE_FindFileExt(pFileName); - *pExt = '\0'; + if (pExt) *pExt = '\0'; } #endif pExt = FE_FindFileExt(tempName); - strcpy(extension, pExt); - *pExt = '\0'; - - // Get a name, If this file exists, then we attempt another temp file. - do { - char number[3]; - int numLen; - - nUniqueNo += 1; - numLen = sprintf(number, "%d", nUniqueNo); - -#ifdef XP_WIN16 + if (pExt) + { + strcpy(extension, pExt); *pExt = '\0'; - if (strlen(pFileName) < (8 - numLen)) { - strcat(pExt, number); //append if we can - *(pExt + numLen) = '\0'; - } - else { - strncpy((pExt - numLen), number, numLen); - *pExt = '\0'; - } -#else - strncpy(pExt, number, numLen); - *(pExt + numLen) = '\0'; -#endif - strcat(tempName, extension); - } while (-1 != _access(tempName, 0)); + // Get a name, If this file exists, then we attempt another temp file. + do { + char number[3]; + int numLen; + + nUniqueNo += 1; + numLen = sprintf(number, "%d", nUniqueNo); + + #ifdef XP_WIN16 + *pExt = '\0'; + if (strlen(pFileName) < (8 - numLen)) { + strcat(pExt, number); //append if we can + *(pExt + numLen) = '\0'; + } + else { + strncpy((pExt - numLen), number, numLen); + *pExt = '\0'; + } + #else + strncpy(pExt, number, numLen); + *(pExt + numLen) = '\0'; + #endif + strcat(tempName, extension); + + } while (-1 != _access(tempName, 0)); + } if(pTempPath != NULL) { XP_FREE(pTempPath); @@ -1237,6 +1279,7 @@ CString CSaveCX::GetViewer() const class CSaveAttachmentStream { protected: HGLOBAL m_hGlobal; + CFile *m_pFile; int32 m_nPosition; int32 m_nFileSize; int32 m_nBufferSize; @@ -1251,6 +1294,7 @@ protected: public: CSaveAttachmentStream(MWContext *pContext, HGLOBAL hGlobal, LPCTSTR lpszUrl, LPCTSTR lpszTitle, BOOL *pbStatus); + CSaveAttachmentStream(MWContext *pContext, CFile *pFile, LPCTSTR lpszUrl, LPCTSTR lpszTitle, BOOL *pbStatus); ~CSaveAttachmentStream(); NET_StreamClass *GetStream() const { return m_pStream; } @@ -1302,6 +1346,34 @@ CSaveAttachmentStream::CSaveAttachmentStream(MWContext *pContext, HGLOBAL hGloba m_nBufferSize = ::GlobalSize(m_hGlobal); m_nPosition = 0; m_nFileSize = 0; + m_pFile = 0; + + m_pStream = NET_NewStream("SaveAttachment", + AttachmentSaveWrite, + AttachmentSaveComplete, + AttachmentSaveAbort, + AttachmentSaveReady, + this, + pContext); + + m_pbStatus = pbStatus; + + if (m_pbStatus) + *m_pbStatus = TRUE; + + m_mail_csid = 0; + m_win_csid = 0; + m_converter = NULL; + m_doConvert = FALSE; +} + +CSaveAttachmentStream::CSaveAttachmentStream(MWContext *pContext, CFile *pFile, LPCTSTR lpszUrl, LPCTSTR lpszTitle, BOOL *pbStatus) +{ + m_hGlobal = 0; + m_nBufferSize = 0; + m_nPosition = 0; + m_nFileSize = 0; + m_pFile = pFile; m_pStream = NET_NewStream("SaveAttachment", AttachmentSaveWrite, @@ -1380,21 +1452,28 @@ int CSaveAttachmentStream::Write(const char *lpBuf, int32 nCount) } } - if (m_nPosition + nCount > m_nBufferSize) - Grow(m_nPosition + nCount); - - ASSERT(m_nPosition + nCount <= m_nBufferSize); - - // Safety net - if (m_nPosition + nCount > m_nBufferSize) + if (m_pFile) { - XP_FREEIF(newStr); - return 0; + m_pFile->Write(lpBuf, nCount); } + else + { + if (m_nPosition + nCount > m_nBufferSize) + Grow(m_nPosition + nCount); + + ASSERT(m_nPosition + nCount <= m_nBufferSize); + + // Safety net + if (m_nPosition + nCount > m_nBufferSize) + { + XP_FREEIF(newStr); + return 0; + } - BYTE *lpBuffer = (BYTE *)::GlobalLock(m_hGlobal); - memcpy((BYTE*)lpBuffer + m_nPosition, (BYTE*)lpBuf, nCount); - ::GlobalUnlock(m_hGlobal); + BYTE *lpBuffer = (BYTE *)::GlobalLock(m_hGlobal); + memcpy((BYTE*)lpBuffer + m_nPosition, (BYTE*)lpBuf, nCount); + ::GlobalUnlock(m_hGlobal); + } m_nPosition += nCount; if (m_nPosition > m_nFileSize) @@ -1406,10 +1485,18 @@ int CSaveAttachmentStream::Write(const char *lpBuf, int32 nCount) void CSaveAttachmentStream::Complete() { - BOOL res = SetSize(m_nFileSize); + if (m_pFile) + { + m_pFile->SetLength(m_nFileSize); + m_pFile->SeekToBegin(); + } + else + { + BOOL res = SetSize(m_nFileSize); - if (m_pbStatus) - *m_pbStatus = res; + if (m_pbStatus) + *m_pbStatus = res; + } } void CSaveAttachmentStream::Abort(int iStatus) @@ -1426,7 +1513,7 @@ BOOL CSaveAttachmentStream::Grow(int32 newLen) int32 newBufferSize = m_nBufferSize; // determine new buffer size - while (newBufferSize < newLen) + while ((int32)newBufferSize < newLen) newBufferSize += 4096; // allocate new buffer @@ -1489,3 +1576,38 @@ BOOL CSaveCX::SaveToGlobal(HGLOBAL *phGlobal, LPCSTR lpszUrl, LPCSTR lpszTitle) return bRes; } +#ifdef MOZ_MAIL_NEWS +BOOL CSaveCX::SaveToFile(CFile *pFile, LPCSTR lpszUrl, LPCSTR lpszTitle) +{ + // Indirect constructor for serializing object. + BOOL bRes = TRUE; + + if (!pFile) return FALSE; + + // Allocate the dialog. + CSaveCX *pSaveCX = new CSaveCX(lpszUrl, NULL, NULL); + + pSaveCX->m_bSavingToGlobal = TRUE; + pSaveCX->m_csFileName = lpszTitle; + + CSaveAttachmentStream *pStream = + new CSaveAttachmentStream(pSaveCX->GetContext(), pFile, lpszUrl, lpszTitle, &bRes); + + pSaveCX->SetSecondaryStream(pStream->GetStream()); + + if (pSaveCX->CanCreate()) { + pSaveCX->DoCreate(); + } else { + return FALSE; + } + + // XXX Note from gab: Should use XP_IsContextInList and not block + // here since pSaveCX could already be invalid. + FEU_BlockUntilDestroyed(pSaveCX->GetContextID()); + + delete pStream; + + return bRes; +} +#endif + diff --git a/mozilla/cmd/winfe/cxsave.h b/mozilla/cmd/winfe/cxsave.h index 247d6ad0cbb..66cdb761780 100644 --- a/mozilla/cmd/winfe/cxsave.h +++ b/mozilla/cmd/winfe/cxsave.h @@ -43,6 +43,10 @@ private: MapDialogRect(m_crBounds); m_crBounds.InflateRect(-1, -1); // Shrink for border. } + // Helper function to figure out correct file extension +#ifdef MOZ_MAIL_NEWS + void AddFileExtension(char *& pFileName); +#endif public: static BOOL SaveAnchorObject(const char *pAnchor, History_entry *pHist, int16 iCSID = 0, CWnd *pParent = NULL, char * pFileName = NULL); static BOOL SaveAnchorAsText(const char *pAnchor, History_entry *pHist, CWnd *pParent, char *pFileName); @@ -50,6 +54,9 @@ public: static NET_StreamClass *ViewUrlObject(URL_Struct *pUrl, const char *pViewer, CWnd *pParent = NULL); static NET_StreamClass *OleStreamObject(NET_StreamClass *pOleStream, URL_Struct *pUrl, const char *pViewer, CWnd *pParent = NULL); static BOOL SaveToGlobal(HGLOBAL *phGlobal, LPCSTR lpszUrl, LPCSTR lpszTitle); // Returns context id +#ifdef MOZ_MAIL_NEWS + static BOOL SaveToFile(CFile *pFile, LPCSTR lpszUrl, LPCSTR lpszTitle); +#endif // What we're saving private: diff --git a/mozilla/cmd/winfe/cxwin.cpp b/mozilla/cmd/winfe/cxwin.cpp index 1be36b31321..246e5364ff6 100644 --- a/mozilla/cmd/winfe/cxwin.cpp +++ b/mozilla/cmd/winfe/cxwin.cpp @@ -19,7 +19,7 @@ #include "stdafx.h" #include "cxwin.h" - +#include "rosetta.h" #include "cntritem.h" #include "medit.h" #include "button.h" @@ -4510,10 +4510,7 @@ void CWinCX::LayoutNewDocument(MWContext *pContext, URL_Struct *pURL, int32 *pWi // Call the base. CPaneCX::LayoutNewDocument(pContext, pURL, pWidth, pHeight, pmWidth, pmHeight); - // Set our security indicators. - if(GetFrame()->GetMainContext() != NULL) { - GetFrame()->SetSecurityStatus(XP_GetSecurityStatus(GetFrame()->GetMainContext()->GetContext())); - } + // We're beginning to layout. m_bIsLayingOut = TRUE; diff --git a/mozilla/cmd/winfe/display.cpp b/mozilla/cmd/winfe/display.cpp index 1365f90cd01..53c269d70ab 100755 --- a/mozilla/cmd/winfe/display.cpp +++ b/mozilla/cmd/winfe/display.cpp @@ -205,6 +205,28 @@ ExternalFileSave(int iFormatOut, URL_Struct *pUrl, MWContext *pContext) // Make a copy of the name, because that's what fe_URLtoLocalName() does // and the code below is going to XP_FREE pSuggested pSuggested = XP_STRDUP(pUrl->content_name); + if (pSuggested && *pSuggested) { + // check if the file doesn't have an extension + char *ext = FE_FindFileExt(pSuggested); + + if (!ext) { + if (pUrl->content_type && *pUrl->content_type) { + // Look up an extension + char aExt[_MAX_EXT]; + DWORD dwFlags = 0; + size_t stExt = 0; + + aExt[0] = '\0'; +#ifdef XP_WIN16 + dwFlags |= EXT_DOT_THREE; +#endif + stExt = EXT_Invent(aExt, sizeof(aExt), dwFlags, pSuggested, pUrl->content_type); + + if (stExt) + StrAllocCat (pSuggested, aExt); + } + } + } } if (!pSuggested) pSuggested = fe_URLtoLocalName(pUrl->address, pUrl->content_type); diff --git a/mozilla/cmd/winfe/edhdrdlg.cpp b/mozilla/cmd/winfe/edhdrdlg.cpp index 512cc54d2a0..5e303f7dd48 100644 --- a/mozilla/cmd/winfe/edhdrdlg.cpp +++ b/mozilla/cmd/winfe/edhdrdlg.cpp @@ -20,7 +20,7 @@ // #include "stdafx.h" -#include "netscape.h" +#include "mozilla.h" #include "edhdrdlg.h" #include "wfemsg.h" #include "prefapi.h" @@ -69,7 +69,12 @@ BOOL CEditHeadersDlg::OnInitDialog() // EXCEPTION: OCX Property Pages should return FALSE } - +int CEditHeadersDlg::DoModal () +{ + if (!m_MNResourceSwitcher.Initialize()) + return -1; + return CDialog::DoModal(); +} void CEditHeadersDlg::OnChangeEditHeader() { @@ -337,12 +342,6 @@ void CCustomHeadersDlg::OnOK() void CCustomHeadersDlg::PostNcDestroy() { CDialog::PostNcDestroy(); - if( m_pParent && ::IsWindow(m_pParent->m_hWnd) ){ - m_pParent->EnableWindow(TRUE); - // Return focus to parent window - m_pParent->SetActiveWindow(); - m_pParent->SetFocus(); - } delete this; } @@ -350,5 +349,6 @@ void CCustomHeadersDlg::PostNcDestroy() void CCustomHeadersDlg::OnClose() { GetParent()->PostMessage(WM_EDIT_CUSTOM_DONE,0,m_nReturnCode); + m_pParent->EnableWindow(TRUE); DestroyWindow(); } diff --git a/mozilla/cmd/winfe/edhdrdlg.h b/mozilla/cmd/winfe/edhdrdlg.h index 81f7797091c..1aa74545e2d 100644 --- a/mozilla/cmd/winfe/edhdrdlg.h +++ b/mozilla/cmd/winfe/edhdrdlg.h @@ -56,6 +56,8 @@ public: //{{AFX_VIRTUAL(CEditHeadersDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + public: + virtual int DoModal(); //}}AFX_VIRTUAL void GetHeader(CString &strHeader); diff --git a/mozilla/cmd/winfe/editor.rc b/mozilla/cmd/winfe/editor.rc index 859873636f9..3a28d548db9 100644 --- a/mozilla/cmd/winfe/editor.rc +++ b/mozilla/cmd/winfe/editor.rc @@ -139,6 +139,7 @@ BEGIN "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT "C", ID_GET_COLOR, VIRTKEY, SHIFT, CONTROL, NOINVERT + "D", ID_TOGGLENAMECOMPLETION, VIRTKEY, CONTROL, NOINVERT "E", ID_ALIGN_CENTER, VIRTKEY, CONTROL, NOINVERT "F", ID_EDIT_FINDINCURRENT, VIRTKEY, CONTROL, NOINVERT "F", ID_HOTLIST_FISHCAM, VIRTKEY, CONTROL, ALT, NOINVERT @@ -151,6 +152,7 @@ BEGIN NOINVERT "I", ID_SECURITY, VIRTKEY, SHIFT, CONTROL, NOINVERT + "J", ID_SHOW_NAME_PICKER, VIRTKEY, CONTROL, NOINVERT "K", ID_FORMAT_CHAR_NONE, VIRTKEY, CONTROL, NOINVERT "L", ID_ALIGN_LEFT, VIRTKEY, CONTROL, NOINVERT "L", ID_MAKE_LINK, VIRTKEY, SHIFT, CONTROL, diff --git a/mozilla/cmd/winfe/edtclass.cpp b/mozilla/cmd/winfe/edtclass.cpp index 1aa79e39116..b5fed3a691c 100644 --- a/mozilla/cmd/winfe/edtclass.cpp +++ b/mozilla/cmd/winfe/edtclass.cpp @@ -22,6 +22,7 @@ #include "edtclass.h" #include "edprops.h"//for wfe call #include "edt.h" +//#include "edtable.h" #include "xp_help.h" #include "nethelp.h" diff --git a/mozilla/cmd/winfe/fegrid.cpp b/mozilla/cmd/winfe/fegrid.cpp index 429433fa8ea..53d8dc2226f 100644 --- a/mozilla/cmd/winfe/fegrid.cpp +++ b/mozilla/cmd/winfe/fegrid.cpp @@ -18,6 +18,7 @@ #include "stdafx.h" +#include "rosetta.h" #include "gridedge.h" #include "netsvw.h" #include "template.h" @@ -926,9 +927,7 @@ void FE_QueryChrome(MWContext *pContext, Chrome *pChrome) pChrome->show_url_bar = pIChrome->GetToolbarVisible(ID_LOCATION_TOOLBAR); pChrome->show_directory_buttons = pIChrome->GetToolbarVisible(ID_PERSONAL_TOOLBAR); - // The security bar? - // TODO: Fix me! - pChrome->show_security_bar = TRUE; + HG28762 // Status bar! LPNSSTATUSBAR pIStatusBar = NULL; diff --git a/mozilla/cmd/winfe/fegui.cpp b/mozilla/cmd/winfe/fegui.cpp index e8bf30e3390..2f90f36c8d8 100755 --- a/mozilla/cmd/winfe/fegui.cpp +++ b/mozilla/cmd/winfe/fegui.cpp @@ -18,6 +18,7 @@ #include "stdafx.h" +#include "rosetta.h" #include "res\appicon.h" #include "dialog.h" #include "mainfrm.h" @@ -1462,6 +1463,7 @@ xp_FileName(const char * name, XP_FileType type, char* *myName) break; +#ifdef MOZ_LOC_INDEP case xpLIClientDB: newName = (char *) XP_ALLOC(_MAX_PATH); sprintf(newName, "%s\\locindep.dat", (const char *)theApp.m_UserDirectory); @@ -1471,6 +1473,7 @@ xp_FileName(const char * name, XP_FileType type, char* *myName) newName = (char *) XP_ALLOC(_MAX_PATH); sprintf(newName, "%s\\liprefs.js", (const char *)theApp.m_UserDirectory); break; +#endif /* MOZ_LOC_INDEP */ default: ASSERT(0); /* all types should be covered */ @@ -2373,15 +2376,7 @@ PUBLIC void *FE_AboutData (const char *which, char **data_ret, int32 *length_ret char *pSSLVersion = NULL; char *pSSLString = NULL; - char *pSSLCapability = SECNAV_SSLCapabilities(); - pSSLVersion = strdup(SECNAV_SecurityVersion(PR_TRUE)); - /* NULL pointer check. strlen fires a page fault if passed a NULL pointer */ - if (pSSLVersion && pSSLCapability) - { - pSSLString = (char *)malloc(strlen(pSSLVersion) + strlen(pSSLCapability) + 48*2); - sprintf(pSSLString, szLoadString(IDS_ABOUT_SECURITY), pSSLVersion, pSSLCapability); - } - if (pSSLCapability) free(pSSLCapability); + HG83722 char *pSp = szLoadString(IDS_ABOUT_0); /* Null pointer check */ diff --git a/mozilla/cmd/winfe/femess.cpp b/mozilla/cmd/winfe/femess.cpp index 6dbb6ed0ac9..3566bd60048 100644 --- a/mozilla/cmd/winfe/femess.cpp +++ b/mozilla/cmd/winfe/femess.cpp @@ -630,9 +630,11 @@ extern "C" void FE_RememberPopPassword(MWContext * context, const char * passwor #ifdef MOZ_MAIL_NEWS // if we aren't supposed to remember clear anything in the registry XP_Bool prefBool; + XP_Bool passwordProtectLocalCache; PREF_GetBoolPref("mail.remember_password",&prefBool); + PREF_GetBoolPref("mail.password_protect_local_cache", &passwordProtectLocalCache); - if(prefBool) + if(prefBool || passwordProtectLocalCache) PREF_SetCharPref("mail.pop_password",(char *)password); else PREF_SetCharPref("mail.pop_password",""); @@ -784,7 +786,6 @@ extern "C" void FE_PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, if (pUnk) { LPMAILFRAME pInterface = NULL; pUnk->QueryInterface( IID_IMailFrame, (LPVOID *) &pInterface ); - ASSERT( pInterface ); if ( pInterface ) { pInterface->PaneChanged( pane, asynchronous, notify, value ); pInterface->Release(); diff --git a/mozilla/cmd/winfe/feorphan.cpp b/mozilla/cmd/winfe/feorphan.cpp index 0d7d875cbf7..936b6967099 100644 --- a/mozilla/cmd/winfe/feorphan.cpp +++ b/mozilla/cmd/winfe/feorphan.cpp @@ -127,9 +127,7 @@ void OpenDraftExit (URL_Struct *url_struct, int/*status*/,MWContext *pContext) int PR_CALLBACK DirServerListChanged(const char *pref, void *data) { - CString msg = "abook.nab"; - - DIR_GetServerPreferences(&theApp.m_directories, msg); + theApp.m_directories = DIR_GetDirServers(); return TRUE; } #endif // MOZ_LDAP diff --git a/mozilla/cmd/winfe/filter.cpp b/mozilla/cmd/winfe/filter.cpp index 6e8e6b2527b..c58c318b4cd 100755 --- a/mozilla/cmd/winfe/filter.cpp +++ b/mozilla/cmd/winfe/filter.cpp @@ -22,6 +22,11 @@ #include "stdafx.h" #include "filter.h" + +// +// filter.cpp : implementation file +// + #include "mailmisc.h" #include "xp_time.h" #include "xplocale.h" @@ -29,10 +34,11 @@ #include "dateedit.h" #include "nethelp.h" #include "xp_help.h" -#include "edhdrdlg.h" #include "prefapi.h" #include "numedit.h" #include "mailpriv.h" +#include "mailfrm.h" +#include "advprosh.h" #ifdef _DEBUG #undef THIS_FILE @@ -45,6 +51,242 @@ extern MSG_SearchError MSG_GetValuesForAttribute( MSG_ScopeAttribute scope, uint16 *maxItems); +extern "C" void HelperInitFonts( HDC hdc , HFONT *phFont, HFONT *phBoldFont); + +#define NAV_BUTTONWIDTH 24 +#define NAV_BUTTONHEIGHT 16 + +#define BITMAP_MARGIN 5 + +CFilterScopeCombo::CFilterScopeCombo() : CMiscFolderCombo() +{ + m_bFirst = TRUE; + m_hFont = NULL; + m_hBigFont = NULL; +} + +CFilterScopeCombo::~CFilterScopeCombo() +{ +} + +void CFilterScopeCombo::SetFont( CFont *pFont, CFont *pBigFont ) +{ + m_hFont = (HFONT) pFont->m_hObject; + m_hBigFont = (HFONT) pBigFont->m_hObject; + + CMailFolderCombo::SetFont(pFont); +} + +void CFilterScopeCombo::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct ) +{ + HDC hDC = lpDrawItemStruct->hDC; + RECT rcItem = lpDrawItemStruct->rcItem; + RECT rcTemp = rcItem; + RECT rcText; + DWORD dwItemData = lpDrawItemStruct->itemData; + HBRUSH hBrushWindow = ::CreateSolidBrush( GetSysColor( COLOR_WINDOW ) ); + HBRUSH hBrushHigh = ::CreateSolidBrush( GetSysColor( COLOR_HIGHLIGHT ) ); + HBRUSH hBrushFill = NULL; + + if ( !m_hFont ) { + HelperInitFonts( hDC, &m_hFont, &m_hBoldFont); + } + + HFONT hOldFont = NULL; + if ( m_hFont ) { + hOldFont = (HFONT) ::SelectObject( hDC,(HFONT)&m_hFont ); + } + + if ( lpDrawItemStruct->itemState & ODS_SELECTED ) { + hBrushFill = hBrushHigh; + ::SetBkColor( hDC, GetSysColor( COLOR_HIGHLIGHT ) ); + ::SetTextColor( hDC, GetSysColor( COLOR_HIGHLIGHTTEXT ) ); + } else { + hBrushFill = hBrushWindow; + ::SetBkColor( hDC, GetSysColor( COLOR_WINDOW ) ); + ::SetTextColor( hDC, GetSysColor( COLOR_WINDOWTEXT ) ); + } + + if ( lpDrawItemStruct->itemID != -1 && dwItemData) + { + MSG_FolderInfo *itemData = (MSG_FolderInfo *) lpDrawItemStruct->itemData; + MSG_FolderLine folderLine; + MSG_GetFolderLineById( m_pMaster, itemData , &folderLine); + int idxImage = WFE_MSGTranslateFolderIcon( folderLine.level, + folderLine.flags, + folderLine.numChildren ); + + if ( m_hBoldFont && folderLine.unseen > 0 ) + { + ::SelectObject( hDC, (HFONT)&m_hBoldFont ); + } + int iIndent = 0; + + BOOL bStatic = FALSE; +#ifdef _WIN32 + if ( sysInfo.m_bWin4 ) + bStatic = ( lpDrawItemStruct->itemState & ODS_COMBOBOXEDIT ) ? TRUE : FALSE; + else +#endif + bStatic = m_bStaticCtl; + + if (!bStatic) + iIndent += (folderLine.level - m_iInitialDepth) * 8; + +//Draw the news bitmap + m_pIImageMap->DrawImage( idxImage, iIndent + BITMAP_MARGIN , rcItem.top, hDC, FALSE ); + LPCTSTR name = (LPCTSTR) folderLine.prettyName; + if ( !name || !name[0] ) + name = folderLine.name; +//Draw the text + ::DrawText( hDC, name, -1, &rcTemp, DT_SINGLELINE|DT_CALCRECT|DT_NOPREFIX ); + int iWidth = rcTemp.right - rcTemp.left; + + rcTemp = rcItem; + rcText = rcItem; + rcTemp.left = iIndent + BITMAP_MARGIN + 20; + rcTemp.right = rcTemp.left + iWidth + 4; + + VERIFY(::FillRect( hDC, &rcTemp, hBrushFill )); + rcText.left = rcTemp.left + 2; + rcText.right = rcTemp.right - 2; + ::DrawText( hDC, name, -1, &rcText, DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX ); + } + + if ( hBrushHigh ) + VERIFY( ::DeleteObject( hBrushHigh )); + if ( hBrushWindow ) + VERIFY( ::DeleteObject( hBrushWindow )); + + if ( hOldFont ) + ::SelectObject( hDC, hOldFont ); +} + + +BEGIN_MESSAGE_MAP( CFilterScopeCombo, CMiscFolderCombo ) + ON_WM_CTLCOLOR() + ON_WM_PAINT() +END_MESSAGE_MAP() + +void CFilterScopeCombo::OnPaint() +{ + m_bStaticCtl = TRUE; + CMailFolderCombo::OnPaint(); + m_bFirst = TRUE; +} + +HBRUSH CFilterScopeCombo::OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor ) +{ + if (nCtlColor == CTLCOLOR_LISTBOX) { + if (m_bFirst) { + RECT rcParent; + GetWindowRect( &rcParent ); + pWnd->GetWindowRect(&m_rcList); + m_bFirst = FALSE; + int height = m_rcList.bottom - m_rcList.top; + if ( (rcParent.bottom + height) > GetSystemMetrics( SM_CYFULLSCREEN ) ) { + height = GetSystemMetrics( SM_CYFULLSCREEN ) - rcParent.bottom; + } + pWnd->MoveWindow( m_rcList.left, rcParent.bottom, + m_rcList.right - m_rcList.left, height ); + } + } + + m_bStaticCtl = (nCtlColor == CTLCOLOR_EDIT); + + return CMailFolderCombo::OnCtlColor( pDC, pWnd, nCtlColor ); +} + + +int CFilterScopeCombo::PopulateNews(MSG_Master *pMaster, BOOL bRoots) +{ + m_pMaster = pMaster; + int index = 0; + int nCount=0; + m_iInitialDepth = 1; + + ::SendMessage( m_hWnd, m_nResetContent, (WPARAM) 0, (LPARAM) 0 ); + + int32 iLines = MSG_GetFolderChildren (m_pMaster, NULL, NULL, 0); + MSG_FolderInfo **ppFolderInfo = new MSG_FolderInfo *[iLines]; + + ASSERT(ppFolderInfo); + if (ppFolderInfo) + { + MSG_GetFolderChildren (m_pMaster, NULL, ppFolderInfo, iLines); + for (int i = 0; i < iLines; i++) + { + MSG_FolderLine folderLine; + if (MSG_GetFolderLineById (m_pMaster, ppFolderInfo[i], &folderLine)) + { + if ( folderLine.flags & MSG_FOLDER_FLAG_NEWSGROUP || + folderLine.flags & MSG_FOLDER_FLAG_NEWS_HOST || + folderLine.flags & MSG_FOLDER_FLAG_IMAP_PUBLIC || + folderLine.flags & MSG_FOLDER_FLAG_INBOX || + folderLine.flags & MSG_FOLDER_FLAG_MAIL || + folderLine.flags & MSG_FOLDER_FLAG_IMAP_SERVER || + folderLine.flags & MSG_FOLDER_FLAG_CAT_CONTAINER) + { + if ( bRoots ) + { + if ( folderLine.flags & MSG_FOLDER_FLAG_IMAP_PUBLIC || + folderLine.flags & MSG_FOLDER_FLAG_INBOX) + { + + ::SendMessage( m_hWnd, m_nAddString, (WPARAM) 0, (LPARAM) folderLine.name ); + ::SendMessage( m_hWnd, m_nSetItemData, (WPARAM) index,(DWORD)(folderLine.id) ); + index++; + } + + if ( folderLine.numChildren > 0 ) + { + SubPopulate(index, folderLine.id ); + } + } + } + } + } + delete [] ppFolderInfo; + } + + return 1; +} + + +void CFilterScopeCombo::SubPopulate(int &index, MSG_FolderInfo *folder ) +{ + int32 iLines = MSG_GetFolderChildren (m_pMaster, folder, NULL, 0); + MSG_FolderInfo **ppFolderInfo = new MSG_FolderInfo *[iLines]; + + ASSERT(ppFolderInfo); + if (ppFolderInfo) + { + MSG_GetFolderChildren (m_pMaster, folder, ppFolderInfo, iLines); + for (int i = 0; i < iLines; i++) + { + MSG_FolderLine folderLine; + if (MSG_GetFolderLineById (m_pMaster, ppFolderInfo[i], &folderLine)) + { + if ( folderLine.flags & MSG_FOLDER_FLAG_NEWSGROUP || + folderLine.flags & MSG_FOLDER_FLAG_NEWS_HOST || + folderLine.flags & MSG_FOLDER_FLAG_IMAP_PUBLIC || + folderLine.flags & MSG_FOLDER_FLAG_INBOX) + { + + ::SendMessage( m_hWnd, m_nAddString, (WPARAM) 0, (LPARAM) folderLine.name ); + ::SendMessage( m_hWnd, m_nSetItemData, (WPARAM) index,(DWORD)(folderLine.id) ); + index++; + } + if ( folderLine.numChildren > 0 ) { + SubPopulate(index, folderLine.id); + } + } + } + delete [] ppFolderInfo; + } +} + + ///////////////////////////////////////////////////////////////////////////// // CFilterList @@ -233,8 +475,27 @@ CFilterPickerDialog::CFilterPickerDialog(MSG_Pane *pPane, CWnd* pParent /*=NULL* : CDialog(CFilterPickerDialog::IDD, pParent) { m_pPane = pPane; + m_pParent = pParent; + m_FolderInfoScope = NULL; + m_pDWordArray = new CDWordArray; //list of Filter Lists + //each each filter list represents a change in scope } +CFilterPickerDialog::~CFilterPickerDialog() +{ + MSG_FilterList *pListData = NULL; + + while (-1 != m_pDWordArray->GetUpperBound()) + { + m_pDWordArray->RemoveAt(m_pDWordArray->GetUpperBound()); + m_pDWordArray->FreeExtra(); + //we don't need to free what was in the array because the backend ownes the memory. + } + if (m_pDWordArray) + delete m_pDWordArray; +} + + void CFilterPickerDialog::DoDataExchange(CDataExchange* pDX) { @@ -247,13 +508,42 @@ int CFilterPickerDialog::OnInitDialog() m_FilterList.SubclassDlgItem( IDC_LIST_FILTERS, this ); + m_ScopeCombo.SubclassDlgItem(IDC_COMBO_SERVER_SCOPE, this); + m_ScopeCombo.PopulateNews(WFE_MSGGetMaster(),TRUE); + m_ScopeCombo.SetCurSel(0); + + CRect comboRect; + m_ScopeCombo.GetWindowRect(comboRect); + + m_ScopeCombo.SetWindowPos(NULL, 0, 0, comboRect.Width(), comboRect.Height() * 5, SWP_NOMOVE | SWP_NOZORDER); + + DWORD dwData = m_ScopeCombo.GetItemData(0); + + if(dwData != -1) + m_FolderInfoScope = (MSG_FolderInfo*)dwData; + else + m_FolderInfoScope = NULL; + + ASSERT(m_FolderInfoScope != NULL); + m_UpButton.AutoLoad( IDC_UP, this ); m_DownButton.AutoLoad( IDC_DOWN, this ); - MSG_OpenFolderFilterList(m_pPane, NULL, filterInbox, &m_pFilterList); - MSG_GetFilterCount(m_pFilterList, &m_iFilterCount); - m_bLoggingEnabled = MSG_IsLoggingEnabled(m_pFilterList); - m_iIndex = 0; + if(m_FolderInfoScope != NULL) + { + MSG_OpenFolderFilterList(m_pPane, + m_FolderInfoScope, + GetFilterType(m_FolderInfoScope), + &m_pFilterList); + m_pDWordArray->Add((DWORD)m_pFilterList); //put the list on the array + MSG_GetFilterCount(m_pFilterList, &m_iFilterCount); + m_bLoggingEnabled = MSG_IsLoggingEnabled(m_pFilterList); + m_iIndex = 0; + } + else + { + m_pFilterList = NULL; + } CWnd *widget; widget = GetDlgItem(IDC_CHECK_LOG); @@ -293,23 +583,26 @@ int CFilterPickerDialog::OnInitDialog() void CFilterPickerDialog::UpdateList() { - MSG_GetFilterCount(m_pFilterList, &m_iFilterCount); + if(m_pFilterList != NULL) + { + MSG_GetFilterCount(m_pFilterList, &m_iFilterCount); - const char *lpszName; - CListBox *pListBox = (CListBox *) GetDlgItem( IDC_LIST_FILTERS ); - pListBox->ResetContent(); + const char *lpszName; + CListBox *pListBox = (CListBox *) GetDlgItem( IDC_LIST_FILTERS ); + pListBox->ResetContent(); - for ( int i = 0; i < m_iFilterCount; i++ ) { - if (FilterError_Success == MSG_GetFilterAt(m_pFilterList, (MSG_FilterIndex) i, &m_pFilter) && m_pFilter) - { - MSG_GetFilterName( m_pFilter, (char **) &lpszName ); - pListBox->AddString( lpszName ); - pListBox->SetItemData( i, (ULONG) m_pFilter ); + for ( int i = 0; i < m_iFilterCount; i++ ) { + if (FilterError_Success == MSG_GetFilterAt(m_pFilterList, (MSG_FilterIndex) i, &m_pFilter) && m_pFilter) + { + MSG_GetFilterName( m_pFilter, (char **) &lpszName ); + pListBox->AddString( lpszName ); + pListBox->SetItemData( i, (ULONG) m_pFilter ); + } } - } - pListBox->SetCurSel(m_iIndex); + pListBox->SetCurSel(m_iIndex); - OnSelchangeListFilter(); + OnSelchangeListFilter(); + } } BEGIN_MESSAGE_MAP(CFilterPickerDialog, CDialog) @@ -317,7 +610,9 @@ BEGIN_MESSAGE_MAP(CFilterPickerDialog, CDialog) ON_BN_CLICKED( IDCANCEL, OnCancel) ON_BN_CLICKED( IDC_NEW, OnNew) ON_BN_CLICKED( IDC_EDIT, OnEdit) + ON_BN_CLICKED( IDC_BUTTON_SERVER_FILTERS, OnServerFilters) ON_UPDATE_COMMAND_UI( IDC_EDIT, OnUpdateEdit ) + ON_UPDATE_COMMAND_UI(IDC_BUTTON_SERVER_FILTERS, OnUpdateServerFilters) ON_BN_CLICKED( IDC_DELETE, OnDelete) ON_UPDATE_COMMAND_UI( IDC_DELETE, OnUpdateEdit ) ON_BN_CLICKED( IDC_UP, OnUp) @@ -328,10 +623,116 @@ BEGIN_MESSAGE_MAP(CFilterPickerDialog, CDialog) ON_UPDATE_COMMAND_UI( IDC_DOWN, OnUpdateDown ) ON_LBN_DBLCLK( IDC_LIST_FILTERS, OnDblclkListFilter ) ON_LBN_SELCHANGE( IDC_LIST_FILTERS, OnSelchangeListFilter ) + ON_CBN_SELCHANGE(IDC_COMBO_SERVER_SCOPE, OnScope) ON_BN_CLICKED( IDC_FILTER_HELP, OnHelp) ON_BN_CLICKED( IDC_VIEW, OnView) END_MESSAGE_MAP() + + +void CFilterPickerDialog::OnServerFilters() +{ + if(m_FolderInfoScope != NULL) + { + CMailNewsFrame *pFrame = (CMailNewsFrame *)m_pParent; + MWContext *context = pFrame->GetContext()->GetContext(); + MSG_GetAdminUrlForFolder(context, m_FolderInfoScope,MSG_AdminServerSideFilters); + } +} + +void CFilterPickerDialog::OnUpdateServerFilters(CCmdUI *pCmdUI) +{ + if(m_FolderInfoScope != NULL) + { + BOOL bOKToEnable = MSG_HaveAdminUrlForFolder(m_FolderInfoScope,MSG_AdminServerSideFilters); + pCmdUI->Enable(bOKToEnable); + } + else + { + pCmdUI->Enable(FALSE); + } +} + +void CFilterPickerDialog::OnScope() +{ + int iCurSel = m_ScopeCombo.GetCurSel(); + MSG_FolderInfo *pfolderInfo = NULL; + DWORD dwData = m_ScopeCombo.GetItemData(iCurSel); + + if(dwData != -1) + { + pfolderInfo = (MSG_FolderInfo*)dwData; + } + else + { + pfolderInfo = NULL; + } + + if ( m_FolderInfoScope != pfolderInfo) + { //set the new scope + m_FolderInfoScope = pfolderInfo; + if(m_FolderInfoScope != NULL) + { + //Check the filter arrary to see if we already opened this scope's filter list + if ( !FilterListAlreadyOpen(m_FolderInfoScope,m_pFilterList) ) + { + //Get a new list of filters for this scope + MSG_OpenFolderFilterList(m_pPane, + m_FolderInfoScope, + GetFilterType(m_FolderInfoScope), + &m_pFilterList); + //put the list on the array + m_pDWordArray->Add((DWORD)m_pFilterList); + } + + MSG_GetFilterCount(m_pFilterList, &m_iFilterCount); + m_bLoggingEnabled = MSG_IsLoggingEnabled(m_pFilterList); + m_iIndex = 0; + } + else + { + m_pFilterList = NULL; + } + CWnd *widget; + widget = GetDlgItem(IDC_CHECK_LOG); + ((CButton *) widget)->SetCheck(m_bLoggingEnabled); + UpdateList(); + } + //nothing change so don't do anything +} + +MSG_FilterType CFilterPickerDialog::GetFilterType(MSG_FolderInfo *pFolderInfo) +{ + if (!(MSG_GetFolderFlags(pFolderInfo) & MSG_FOLDER_FLAG_NEWSGROUP) && + !(MSG_GetFolderFlags(pFolderInfo) & MSG_FOLDER_FLAG_NEWS_HOST)) + { + return filterInbox; + } + else + { + return filterNews; + } +} + +//Searches the filter list array to see if we arleady have an open filter list for this folder scope +BOOL CFilterPickerDialog::FilterListAlreadyOpen(MSG_FolderInfo *pFolder, MSG_FilterList *&pReturnList) +{ + for (int i=0; i <= m_pDWordArray->GetUpperBound(); i++) + { + MSG_FilterList *pFilterList = NULL; + pFilterList = (MSG_FilterList*)m_pDWordArray->GetAt(i); + if (pFilterList) + { + if (MSG_GetFolderInfoForFilterList(pFilterList) == pFolder) + { + pReturnList = pFilterList; + return TRUE; + } + } + } + return FALSE; +} + void CFilterPickerDialog::OnDblclkListFilter() { if (m_iIndex < m_iFilterCount) { @@ -368,27 +769,32 @@ void CFilterPickerDialog::OnSelcancelListFilter() void CFilterPickerDialog::OnNew() { - m_pFilter = NULL; - CFilterDialog dialog( m_pPane, &m_pFilter, this ); + if(m_FolderInfoScope != NULL ) + { + m_pFilter = NULL; + CFilterDialog dialog( m_pPane, m_FolderInfoScope, &m_pFilter, this ); - if (dialog.DoModal() == IDOK ) { - m_iIndex += 1; - MSG_InsertFilterAt( m_pFilterList, (MSG_FilterIndex) m_iIndex, m_pFilter ); + if (dialog.DoModal() == IDOK ) { + m_iIndex += 1; + MSG_InsertFilterAt( m_pFilterList, (MSG_FilterIndex) m_iIndex, m_pFilter ); + } + + UpdateList(); } - - UpdateList(); } void CFilterPickerDialog::OnEdit() { - MSG_GetFilterAt(m_pFilterList, (MSG_FilterIndex) m_iIndex, &m_pFilter); - CFilterDialog dialog( m_pPane, &m_pFilter, this ); + if(m_FolderInfoScope != NULL) + { + MSG_GetFilterAt(m_pFilterList, (MSG_FilterIndex) m_iIndex, &m_pFilter); + CFilterDialog dialog( m_pPane, m_FolderInfoScope, &m_pFilter, this ); - if ( dialog.DoModal() == IDOK ) { - MSG_SetFilterAt( m_pFilterList, (MSG_FilterIndex) m_iIndex, m_pFilter ); + if ( dialog.DoModal() == IDOK ) + MSG_SetFilterAt( m_pFilterList, (MSG_FilterIndex) m_iIndex, m_pFilter ); + + UpdateList(); } - - UpdateList(); } void CFilterPickerDialog::OnUpdateEdit( CCmdUI *pCmdUI ) @@ -407,14 +813,17 @@ void CFilterPickerDialog::OnUpdateEdit( CCmdUI *pCmdUI ) void CFilterPickerDialog::OnDelete() { - if (m_iIndex < m_iFilterCount && m_iIndex >= 0) { - MSG_GetFilterAt( m_pFilterList, (MSG_FilterIndex) m_iIndex, &m_pFilter ); - MSG_RemoveFilterAt( m_pFilterList, (MSG_FilterIndex) m_iIndex ); - MSG_DestroyFilter( m_pFilter ); - if (m_iIndex) { - m_iIndex--; + if(m_FolderInfoScope != NULL) + { + if (m_iIndex < m_iFilterCount && m_iIndex >= 0) { + MSG_GetFilterAt( m_pFilterList, (MSG_FilterIndex) m_iIndex, &m_pFilter ); + MSG_RemoveFilterAt( m_pFilterList, (MSG_FilterIndex) m_iIndex ); + MSG_DestroyFilter( m_pFilter ); + if (m_iIndex) { + m_iIndex--; + } + UpdateList(); } - UpdateList(); } } @@ -445,15 +854,30 @@ void CFilterPickerDialog::OnUpdateDown( CCmdUI *pCmdUI ) void CFilterPickerDialog::OnOK() { CDialog::OnOK(); + //Set logging for the currently displayed filter scope MSG_EnableLogging(m_pFilterList, IsDlgButtonChecked(IDC_CHECK_LOG)); - MSG_CloseFilterList(m_pFilterList); + for (int i=0; i <= m_pDWordArray->GetUpperBound(); i++) + { + MSG_FilterList *pFilterList = (MSG_FilterList*)m_pDWordArray->GetAt(i); + if (pFilterList) + { + MSG_CloseFilterList(pFilterList); + } + } } void CFilterPickerDialog::OnCancel() { CDialog::OnCancel(); - MSG_CancelFilterList( m_pFilterList ); + for (int i=0; i <= m_pDWordArray->GetUpperBound(); i++) + { + MSG_FilterList *pFilterList = (MSG_FilterList*)m_pDWordArray->GetAt(i); + if (pFilterList) + { + MSG_CancelFilterList( pFilterList ); + } + } } void CFilterPickerDialog::OnHelp() @@ -469,16 +893,16 @@ void CFilterPickerDialog::OnView() // CFilterDialog dialog -CFilterDialog::CFilterDialog(MSG_Pane *pPane, MSG_Filter **filter, - CWnd* pParent /*=NULL*/) +CFilterDialog::CFilterDialog(MSG_Pane *pPane, MSG_FolderInfo *pFolderInfoScope, + MSG_Filter **filter, CWnd* pParent /*=NULL*/) : CDialog(CFilterDialog::IDD, pParent) { m_pPane = pPane; + m_pFolderInfoScope = pFolderInfoScope; m_hFilter = filter; m_bLogicType = 0; m_iRowIndex = 0; - m_pCustomHeadersDlg = NULL; //{{AFX_DATA_INIT(CFilterDialog) m_iActive = 1; @@ -497,12 +921,49 @@ void CFilterDialog::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CFilterDialog) - DDX_Radio(pDX, IDC_RADIO_OFF, m_iActive); DDX_Text(pDX, IDC_EDIT_NAME, m_lpszFilterName); DDX_Text(pDX, IDC_EDIT_DESC, m_lpszFilterDesc); //}}AFX_DATA_MAP } +MSG_ScopeAttribute CFilterDialog::GetFolderScopeAttribute() +{ + + uint32 flags = MSG_GetFolderFlags(m_pFolderInfoScope); + + MSG_ScopeAttribute scopeAttrib; + + if (flags & MSG_FOLDER_FLAG_NEWSGROUP || flags & MSG_FOLDER_FLAG_NEWS_HOST) + { + scopeAttrib = scopeNewsgroup; + } + else + { + scopeAttrib = scopeMailFolder; + } + + return scopeAttrib; +} + +MSG_FilterType CFilterDialog::GetFolderFilterType() +{ + + MSG_FilterType filterType; + + uint32 flags = MSG_GetFolderFlags(m_pFolderInfoScope); + + if(flags & MSG_FOLDER_FLAG_NEWSGROUP || flags & MSG_FOLDER_FLAG_NEWS_HOST) + { + filterType = filterNewsRule; + } + else + { + filterType = filterInboxRule; + } + + return filterType; +} + int CFilterDialog::OnInitDialog() { CDialog::OnInitDialog(); @@ -514,42 +975,39 @@ int CFilterDialog::OnInitDialog() CComboBox *combo; +#if defined (B3_SEARCH_API) MSG_FolderInfo *pInbox = NULL; MSG_GetFoldersWithFlag (WFE_MSGGetMaster(), MSG_FOLDER_FLAG_INBOX, &pInbox, 1); +#endif uint16 numItems; - MSG_GetNumAttributesForFilterScopes (WFE_MSGGetMaster(), scopeMailFolder, (void**)&pInbox, 1, &numItems); - MSG_SearchMenuItem * HeaderItems = new MSG_SearchMenuItem [numItems+1]; + + MSG_ScopeAttribute scopeAttrib = GetFolderScopeAttribute(); + + MSG_GetNumAttributesForFilterScopes (WFE_MSGGetMaster(), scopeAttrib, (void**)&m_pFolderInfoScope, 1, &numItems); + MSG_SearchMenuItem * HeaderItems = new MSG_SearchMenuItem [numItems]; if (!HeaderItems) return FALSE; //something bad happened here!! - MSG_GetAttributesForFilterScopes (WFE_MSGGetMaster(), scopeMailFolder, (void**)&pInbox, 1, HeaderItems, &numItems); - CString strEditCustom; - strEditCustom.LoadString(IDS_EDIT_CUSTOM); - strcpy( HeaderItems[numItems].name, strEditCustom); - HeaderItems[numItems].attrib = -1; //identifies a command to launch the Edit headers dialog - HeaderItems[numItems].isEnabled = FALSE; - BOOL bUsesCustomHeaders = MSG_ScopeUsesCustomHeaders(WFE_MSGGetMaster(), scopeMailFolder, pInbox, TRUE); - - - for (i = 0; i < 5; i++) { +#if defined (B3_SEARCH_API) + MSG_GetAttributesForFilterScopes (WFE_MSGGetMaster(), scopeAttrib, (void**)&m_pFolderInfoScope, 1, HeaderItems, &numItems); +#else + MSG_GetAttributesForScope(scopeAttrib, HeaderItems, &numItems); +#endif + for (i = 0; i < 5; i++) { combo = (CComboBox *) GetDlgItem( RuleMatrix[i][COL_ATTRIB] ); combo->ResetContent(); for (j = 0; j < numItems; j++) { combo->AddString(HeaderItems[j].name); combo->SetItemData(j, HeaderItems[j].attrib); } - if (j == numItems && bUsesCustomHeaders) - { //place the edit text in the last position of the combo box - combo->AddString(HeaderItems[j].name); - combo->SetItemData(j, HeaderItems[j].attrib); - } if (i > 0) { for (j = 0; j < COL_COUNT; j++) { widget = GetDlgItem(RuleMatrix[i][j]); - widget->ShowWindow(SW_HIDE); + if(widget != NULL) + widget->ShowWindow(SW_HIDE); } } combo->SetCurSel(0); @@ -561,12 +1019,7 @@ int CFilterDialog::OnInitDialog() //Above we are getting the list of Headers and updating controls in column 1 - CComboBox *comboAndOr = (CComboBox*) GetDlgItem(IDC_COMBO_AND_OR); - if (comboAndOr) - { //Default to AND logic for display in the combobox - comboAndOr->SetCurSel(0); - } - + CheckRadioButton(IDC_RADIO_ANY, IDC_RADIO_ALL, IDC_RADIO_ANY); MSG_RuleActionType type; combo = (CComboBox *) GetDlgItem( IDC_COMBO_ACTION ); @@ -575,7 +1028,9 @@ int CFilterDialog::OnInitDialog() MSG_RuleMenuItem items[16]; uint16 maxItems = 16; - MSG_GetRuleActionMenuItems(filterInbox, items, &maxItems); + MSG_FilterType filterType = GetFolderFilterType(); + + MSG_GetRuleActionMenuItems(filterType, items, &maxItems); for (j = 0; j < maxItems; j++) { combo->AddString(items[j].name); combo->SetItemData(j, items[j].attrib); @@ -599,7 +1054,6 @@ int CFilterDialog::OnInitDialog() if ( *m_hFilter ) { const char *lpszTemp; CWnd *widget; - CButton *button; // Name MSG_GetFilterName( *m_hFilter, (char **) &lpszTemp); @@ -617,10 +1071,6 @@ int CFilterDialog::OnInitDialog() XP_Bool bEnabled; MSG_IsFilterEnabled( *m_hFilter, &bEnabled ); m_iActive = bEnabled ? 1 : 0; - button = (CButton *) GetDlgItem( IDC_RADIO_OFF ); - button->SetCheck(m_iActive ? 0 : 1 ); - button = (CButton *) GetDlgItem( IDC_RADIO_ON ); - button->SetCheck(m_iActive); // Terms long iNumTerms; @@ -635,29 +1085,38 @@ int CFilterDialog::OnInitDialog() MSG_RuleGetNumTerms( rule, &iNumTerms ); ASSERT(iNumTerms > 0 && iNumTerms < 6); - for ( i = 0; i < (uint16)iNumTerms; i++) { - if (i > 0) { + if (i > 0) OnMore(); - } + +#ifndef FE_IMPLEMENTS_BOOLEAN_OR + MSG_RuleGetTerm(rule, i, &attrib, &op, &value); + SetTerm(i, attrib, op, value); +#else MSG_RuleGetTerm(rule, i, &attrib, &op, &value, &m_bLogicType, (char **)&arbitraryHeaders); SetTerm(i, attrib, op, value, (char*)arbitraryHeaders); +#endif } - m_bLogicType = !m_bLogicType; //we have to switch it since the combo box has these values reversed by index - //the backend stores AND = 1 and OR = 0. - CComboBox *comboAndOr = (CComboBox*) GetDlgItem(IDC_COMBO_AND_OR); - if (comboAndOr) - { - comboAndOr->SetCurSel(m_bLogicType); - } + CheckRadioButton(IDC_RADIO_ANY, IDC_RADIO_ALL, m_bLogicType ? IDC_RADIO_ALL : IDC_RADIO_ANY); ChangeLogicText(); void *value2; MSG_RuleGetAction( rule, &type, &value2); SetAction( type, value2 ); + + if(iNumTerms > 1) + { + GetDlgItem(IDC_RADIO_ANY)->EnableWindow(TRUE); + GetDlgItem(IDC_RADIO_ALL)->EnableWindow(TRUE); + } + else + { + GetDlgItem(IDC_RADIO_ANY)->EnableWindow(FALSE); + GetDlgItem(IDC_RADIO_ALL)->EnableWindow(FALSE); + } } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE @@ -670,24 +1129,16 @@ void CFilterDialog::UpdateColumn1Attributes() uint16 numItems; CComboBox *combo = NULL; - MSG_FolderInfo *pInbox = NULL; - MSG_GetFoldersWithFlag (WFE_MSGGetMaster(), MSG_FOLDER_FLAG_INBOX, &pInbox, 1); - MSG_GetNumAttributesForFilterScopes (WFE_MSGGetMaster(), scopeMailFolder, (void**)&pInbox, 1, &numItems); - MSG_SearchMenuItem * HeaderItems = new MSG_SearchMenuItem [numItems+1]; + MSG_ScopeAttribute scopeAttrib = GetFolderScopeAttribute(); + + MSG_GetNumAttributesForFilterScopes (WFE_MSGGetMaster(), scopeAttrib, (void**)&m_pFolderInfoScope, 1, &numItems); + MSG_SearchMenuItem * HeaderItems = new MSG_SearchMenuItem [numItems]; if (!HeaderItems) return; //something bad happened here!! //we are getting the list of Headers and updating controls in column 1 - MSG_GetAttributesForFilterScopes (WFE_MSGGetMaster(), scopeMailFolder, (void**)&pInbox, 1, HeaderItems, &numItems); - - CString strEditCustom; - strEditCustom.LoadString(IDS_EDIT_CUSTOM); - strcpy( HeaderItems[numItems].name, strEditCustom); - HeaderItems[numItems].attrib = -1; //identifies a command to launch the Edit headers dialog - HeaderItems[numItems].isEnabled = FALSE; - BOOL bUsesCustomHeaders = MSG_ScopeUsesCustomHeaders(WFE_MSGGetMaster(),scopeMailFolder, pInbox, TRUE); - + MSG_GetAttributesForFilterScopes (WFE_MSGGetMaster(), scopeAttrib, (void**)&m_pFolderInfoScope, 1, HeaderItems, &numItems); for (i = 0; i < 5; i++) { @@ -702,12 +1153,6 @@ void CFilterDialog::UpdateColumn1Attributes() combo->AddString(HeaderItems[j].name); combo->SetItemData(j, HeaderItems[j].attrib); } - if (j == numItems && bUsesCustomHeaders) - { //place the edit text in the last position of the combo box - combo->AddString(HeaderItems[j].name); - combo->SetItemData(j, HeaderItems[j].attrib); - } - combo->SetCurSel(0); UpdateOpList(i); } @@ -715,62 +1160,12 @@ void CFilterDialog::UpdateColumn1Attributes() delete HeaderItems; //free the memory since it's now in the combo box } - -void CFilterDialog::EditHeaders(int iRow) -{ - //We are being asked to modify custom headers - - CComboBox *combo; - int iCurSel; - MSG_SearchAttribute attrib; - m_iRowSelected = iRow; - combo = (CComboBox *) GetDlgItem( RuleMatrix[iRow][COL_ATTRIB] ); - iCurSel = combo->GetCurSel(); - attrib = (MSG_SearchAttribute) combo->GetItemData(iCurSel); - - if (attrib == -1) - { - MSG_Master *master = WFE_MSGGetMaster(); - //find out if we are the only ones trying to edit headers. - if (master) - { - if (!MSG_AcquireEditHeadersSemaphore(master, this)) - { - ::MessageBox(this->GetSafeHwnd(), - szLoadString(IDS_EDIT_HEADER_IN_USE), - szLoadString(IDS_CUSTOM_HEADER_ERROR), - MB_OK|MB_ICONSTOP); - combo->SetCurSel(0); - return; - } - } - else - { - return; - } - - m_pCustomHeadersDlg = new CCustomHeadersDlg(this); - if (m_pCustomHeadersDlg) - { - m_pCustomHeadersDlg->ShowWindow(SW_SHOW); - } - } -} - LONG CFilterDialog::OnFinishedHeaders(WPARAM wParam, LPARAM lParam ) { MSG_Master *master = WFE_MSGGetMaster(); - CComboBox *pCombo = (CComboBox *) GetDlgItem( RuleMatrix[m_iRowSelected][COL_ATTRIB] ); if (lParam == IDOK ) - { UpdateColumn1Attributes(); - } - else - { - pCombo->SetCurSel(0); - } MSG_ReleaseEditHeadersSemaphore(master, this); - m_pCustomHeadersDlg = NULL; return 0; } @@ -778,15 +1173,11 @@ void CFilterDialog::OnNewFolder() { int iCurSel = m_FolderCombo.GetCurSel(); MSG_FolderInfo *pFolderInfo = (MSG_FolderInfo*)m_FolderCombo.GetItemData(iCurSel); - if (pFolderInfo) - { - CNewFolderDialog(this, m_pPane, pFolderInfo); - } - else - { - CNewFolderDialog(this,m_pPane, NULL); - } - OnUpdateDest(); + + CNewFolderDialog nfd(this, m_pPane, pFolderInfo); + nfd.DoModal(); + + OnUpdateDest(); } @@ -810,9 +1201,13 @@ void CFilterDialog::UpdateOpList(int iRow) combo = (CComboBox *) GetDlgItem( RuleMatrix[iRow][COL_OP] ); combo->ResetContent(); - MSG_FolderInfo *pInbox = NULL; - MSG_GetFoldersWithFlag (WFE_MSGGetMaster(), MSG_FOLDER_FLAG_INBOX, &pInbox, 1); - MSG_GetOperatorsForFilterScopes (WFE_MSGGetMaster(), scopeMailFolder, (void**) &pInbox, 1, attrib, items, &maxItems); + MSG_ScopeAttribute scopeAttrib = GetFolderScopeAttribute(); + +#if defined (B3_SEARCH_API) + MSG_GetOperatorsForFilterScopes (WFE_MSGGetMaster(), scopeAttrib, (void**) &m_pFolderInfoScope, 1, attrib, items, &maxItems); +#else + MSG_GetOperatorsForAttribute(scopeAttrib, attrib, items, &maxItems); +#endif for (j = 0; j < maxItems; j++) { combo->AddString(items[j].name); @@ -1026,7 +1421,6 @@ void CFilterDialog::UpdateDestList() } } - int CFilterDialog::ChangeLogicText() { CWnd *widget; @@ -1040,12 +1434,12 @@ int CFilterDialog::ChangeLogicText() if (!widget) return 0; if (m_bLogicType) { //Display AND logic text - strLogicText.LoadString(IDS_ORTHE); + strLogicText.LoadString(IDS_ANDTHE); widget->SetWindowText(strLogicText); } else - { //Display AND logic text - strLogicText.LoadString(IDS_ANDTHE); + { //Display OR logic text + strLogicText.LoadString(IDS_ORTHE); widget->SetWindowText(strLogicText); } widget->ShowWindow(SW_SHOW); @@ -1054,8 +1448,6 @@ int CFilterDialog::ChangeLogicText() return 1; } - - int CFilterDialog::GetNumTerms() { return m_iRowIndex + 1; @@ -1063,6 +1455,8 @@ int CFilterDialog::GetNumTerms() static char szResultText[64]; +#ifdef FE_IMPLEMENTS_BOOLEAN_OR + void CFilterDialog::GetTerm( int iRow, MSG_SearchAttribute *attrib, MSG_SearchOperator *op, @@ -1113,6 +1507,58 @@ void CFilterDialog::GetTerm( int iRow, } } +#else + +void CFilterDialog::GetTerm( int iRow, + MSG_SearchAttribute *attrib, + MSG_SearchOperator *op, + MSG_SearchValue *value) + +{ + CComboBox *combo; + CNSDateEdit *date; + CWnd *widget; + int iCurSel; + + combo = (CComboBox *) GetDlgItem(RuleMatrix[iRow][COL_ATTRIB]); + iCurSel = combo->GetCurSel(); + *attrib = (MSG_SearchAttribute) combo->GetItemData(iCurSel); + + combo = (CComboBox *) GetDlgItem(RuleMatrix[iRow][COL_OP]); + iCurSel = combo->GetCurSel(); + *op = (MSG_SearchOperator) combo->GetItemData(iCurSel); + + widget = GetDlgItem(RuleMatrix[iRow][COL_VALUE]); + widget->GetWindowText(szResultText, sizeof(szResultText)); + + value->attribute = *attrib; + switch (*attrib) { + case attribDate: + { + CTime ctime; + date = (CNSDateEdit *) GetDlgItem(RuleMatrix[iRow][COL_VALUE]); + date->GetDate(ctime); + value->u.date = ctime.GetTime(); + } + break; + case attribPriority: + combo = (CComboBox *) GetDlgItem(RuleMatrix[iRow][COL_VALUE]); + iCurSel = combo->GetCurSel(); + value->u.priority = (MSG_PRIORITY) combo->GetItemData(iCurSel); + break; + case attribMsgStatus: + combo = (CComboBox *) GetDlgItem(RuleMatrix[iRow][COL_VALUE]); + iCurSel = combo->GetCurSel(); + value->u.msgStatus = combo->GetItemData(iCurSel); + break; + default: + value->u.string = XP_STRDUP( szResultText ); + } +} +#endif + +#ifdef FE_IMPLEMENTS_BOOLEAN_OR + void CFilterDialog::SetTerm( int iRow, MSG_SearchAttribute attrib, MSG_SearchOperator op, @@ -1130,8 +1576,15 @@ void CFilterDialog::SetTerm( int iRow, combo->SetCurSel(0); CString strCheckHeader = pszArbitraryHeader; + MSG_ScopeAttribute scopeAttrib = GetFolderScopeAttribute(); + + BOOL bUsesCustomHeaders = MSG_ScopeUsesCustomHeaders(WFE_MSGGetMaster(),scopeAttrib, m_pFolderInfoScope, TRUE); + + //if it uses custom headers then don't compare last item which is the "Custom" item + int headerCount = bUsesCustomHeaders ? combo->GetCount() - 1 : combo->GetCount(); + if (!strCheckHeader.IsEmpty() ) { - for ( i = 0; i < (combo->GetCount() -1) ; i++ ) { + for ( i = 0; i < headerCount ; i++ ) { combo->GetLBText(i,strHeader); if ( (MSG_SearchAttribute) combo->GetItemData(i) == attrib && !strHeader.Compare(strCheckHeader) ) { combo->SetCurSel(i); @@ -1142,7 +1595,8 @@ void CFilterDialog::SetTerm( int iRow, } else { - for ( i = 0; i < (combo->GetCount() -1) ; i++ ) { + // get count has to be based on whether or not there is a custom header in this. + for ( i = 0; i < headerCount ; i++ ) { if ( (MSG_SearchAttribute) combo->GetItemData(i) == attrib ) { combo->SetCurSel(i); bFound=TRUE; @@ -1232,6 +1686,73 @@ void CFilterDialog::SetTerm( int iRow, } } +#else +void CFilterDialog::SetTerm( int iRow, + MSG_SearchAttribute attrib, + MSG_SearchOperator op, + MSG_SearchValue value) +{ + CComboBox *combo; + CNSDateEdit *date; + CWnd *widget; + int i; + + combo = (CComboBox *) GetDlgItem( RuleMatrix[iRow][COL_ATTRIB] ); + combo->SetCurSel(0); + for ( i = 0; i < (combo->GetCount() -1) ; i++ ) { + if ( (MSG_SearchAttribute) combo->GetItemData(i) == attrib ) { + combo->SetCurSel(i); + break; + } + } + + + UpdateOpList( iRow ); + + combo = (CComboBox *) GetDlgItem( RuleMatrix[iRow][COL_OP] ); + combo->SetCurSel(0); + for ( i = 0; i < combo->GetCount(); i++ ) { + if ( (MSG_SearchOperator) combo->GetItemData(i) == op) { + combo->SetCurSel(i); + break; + } + } + + switch ( value.attribute ) { + case attribDate: + { + CTime ctime( value.u.date ); + date = (CNSDateEdit *) GetDlgItem( RuleMatrix[iRow][COL_VALUE] ); + date->SetDate( ctime ); + } + break; + case attribPriority: + combo = (CComboBox *) GetDlgItem( RuleMatrix[iRow][COL_VALUE] ); + combo->SetCurSel(0); + for ( i = 0; i < combo->GetCount(); i++ ) { + if ( (MSG_PRIORITY) combo->GetItemData(i) == value.u.priority ) { + combo->SetCurSel(i); + break; + } + } + break; + case attribMsgStatus: + combo = (CComboBox *) GetDlgItem( RuleMatrix[iRow][COL_VALUE] ); + for ( i = 0; i < combo->GetCount(); i++ ) { + if ( combo->GetItemData(i) == value.u.msgStatus ) { + combo->SetCurSel(i); + break; + } + } + break; + default: + widget = GetDlgItem( RuleMatrix[iRow][COL_VALUE] ); + widget->SetWindowText( (const char *) value.u.string ); + } +} + +#endif + void CFilterDialog::GetAction(MSG_RuleActionType *action, void **value) { CComboBox *combo; @@ -1324,7 +1845,9 @@ BEGIN_MESSAGE_MAP(CFilterDialog, CDialog) ON_CBN_SELCHANGE( IDC_COMBO_ATTRIB3, OnAttrib3 ) ON_CBN_SELCHANGE( IDC_COMBO_ATTRIB4, OnAttrib4 ) ON_CBN_SELCHANGE( IDC_COMBO_ATTRIB5, OnAttrib5 ) - ON_CBN_SELCHANGE( IDC_COMBO_AND_OR, OnAndOr ) + ON_BN_CLICKED(IDC_RADIO_ALL, OnAndOr) + ON_BN_CLICKED(IDC_RADIO_ANY, OnAndOr) + ON_BN_CLICKED(IDC_ADVANCED_OPTIONS, OnAdvanced) ON_MESSAGE(WM_EDIT_CUSTOM_DONE, OnFinishedHeaders ) //}}AFX_MSG_MAP #ifndef _WIN32 @@ -1351,7 +1874,10 @@ static void GrowDialog(CWnd *pWnd, int dx, int dy) static void SlideWindow(CWnd *pWnd, int dx, int dy) { - CRect rect; + if(pWnd == NULL) + return; + + CRect rect; CWnd *parent; pWnd->GetWindowRect(&rect); @@ -1376,8 +1902,6 @@ void CFilterDialog::SlideBottomControls(int dy) SlideWindow(widget, 0, dy); widget = GetDlgItem(IDC_STATIC2); SlideWindow(widget, 0, dy); - widget = GetDlgItem(IDC_STATIC3); - SlideWindow(widget, 0, dy); widget = GetDlgItem(IDCANCEL); SlideWindow(widget, 0, dy); widget = GetDlgItem(IDOK); @@ -1392,10 +1916,6 @@ void CFilterDialog::SlideBottomControls(int dy) SlideWindow(widget, 0, dy); widget = GetDlgItem(IDC_BUTTON_NEW_FOLDER); SlideWindow(widget,0,dy); - widget = GetDlgItem(IDC_RADIO_ON); - SlideWindow(widget, 0, dy); - widget = GetDlgItem(IDC_RADIO_OFF); - SlideWindow(widget, 0, dy); widget = GetDlgItem(IDC_FEWER); SlideWindow(widget, 0, dy); widget = GetDlgItem(IDC_MORE); @@ -1428,46 +1948,43 @@ void CFilterDialog::OnAction() void CFilterDialog::OnAttrib1() { - EditHeaders(0); UpdateOpList(0); } void CFilterDialog::OnAttrib2() { - EditHeaders(1); UpdateOpList(1); } void CFilterDialog::OnAttrib3() { - EditHeaders(2); UpdateOpList(2); } void CFilterDialog::OnAttrib4() { - EditHeaders(3); UpdateOpList(3); } void CFilterDialog::OnAttrib5() { - EditHeaders(4); UpdateOpList(4); } void CFilterDialog::OnAndOr() { - CComboBox *combo; - int iCurSel; - - combo = (CComboBox *) GetDlgItem( IDC_COMBO_AND_OR ); - if (!combo) return; - iCurSel = combo->GetCurSel(); - m_bLogicType = (iCurSel == 0 ? 0 : 1); + m_bLogicType = IsDlgButtonChecked(IDC_RADIO_ALL); ChangeLogicText(); } +void CFilterDialog::updateAndOr() +{ + BOOL bEnable = GetDlgItem(IDC_COMBO_ATTRIB2)->IsWindowVisible(); + GetDlgItem(IDC_RADIO_ANY)->EnableWindow(bEnable); + GetDlgItem(IDC_RADIO_ALL)->EnableWindow(bEnable); +} + + void CFilterDialog::OnMore() { // TODO: Add your control notification handler code here @@ -1480,16 +1997,19 @@ void CFilterDialog::OnMore() widget = GetDlgItem(RuleMatrix[m_iRowIndex][0]); widget->GetWindowRect(&rect); m_iRowIndex++; - for (j = 0; j < COL_COUNT; j++) { + for (j = 0; j < COL_COUNT; j++) + { widget = GetDlgItem(RuleMatrix[m_iRowIndex][j]); + if(widget == NULL) + continue; if (j == 3 && m_bLogicType) { - strLogicText.LoadString(IDS_ORTHE); + strLogicText.LoadString(IDS_ANDTHE); widget->SetWindowText(strLogicText); } else if ( j==3 && !m_bLogicType) - { //change the logic text for this new rule line to AND - strLogicText.LoadString(IDS_ANDTHE); + { //change the logic text for this new rule line to OR + strLogicText.LoadString(IDS_ORTHE); widget->SetWindowText(strLogicText); } widget->ShowWindow(SW_SHOW); @@ -1507,7 +2027,8 @@ void CFilterDialog::OnMore() widget = GetDlgItem(IDC_FEWER); widget->EnableWindow(TRUE); - Invalidate(); + updateAndOr(); + Invalidate(); } void CFilterDialog::OnFewer() @@ -1522,6 +2043,8 @@ void CFilterDialog::OnFewer() widget->GetWindowRect(&rect); for (j = 0; j < COL_COUNT; j++) { widget = GetDlgItem(RuleMatrix[m_iRowIndex][j]); + if(widget == NULL) + continue; widget->ShowWindow(SW_HIDE); } m_iRowIndex--; @@ -1538,9 +2061,41 @@ void CFilterDialog::OnFewer() widget = GetDlgItem(IDC_MORE); widget->EnableWindow(TRUE); + updateAndOr(); Invalidate(); } +void CFilterDialog::OnAdvanced() +{ + MSG_Master *master = WFE_MSGGetMaster(); + //find out if we are the only ones trying to edit headers. + if (master) + { + if (!MSG_AcquireEditHeadersSemaphore(master, this)) + { + ::MessageBox(FEU_GetLastActiveFrame()->GetSafeHwnd(), + szLoadString(IDS_EDIT_HEADER_IN_USE), + szLoadString(IDS_CUSTOM_HEADER_ERROR), + MB_OK|MB_ICONSTOP); + return; + //We can't edit anything since another window already has the semaphore. + } + } + else + { //Something is hosed! + return; + } + + CString title; + title.LoadString(IDS_ADVFILTER_PROPERTY_SHEET); + + // it will delete itself in OnNcDestroy. This is a way to have two "modal" dialogs + CAdvancedOptionsPropertySheet * paops = new CAdvancedOptionsPropertySheet(this, title, AOP_CUSTOM_HEADERS); + assert(paops != NULL); + if(paops != NULL) + paops->Create(this); +} + void CFilterDialog::OnHelp() { NetHelp(HELP_FILTER_RULES); @@ -1556,11 +2111,7 @@ void CFilterDialog::OnOK() MSG_DestroyFilter( *m_hFilter ); } - MSG_FilterType filterType = filterInboxRule; - - MSG_FolderInfo *folder = (m_pPane) ? MSG_GetCurFolder(m_pPane) : NULL; - if (folder && MSG_GetFolderFlags(folder) & MSG_FOLDER_FLAG_NEWSGROUP) - filterType = filterNewsRule; + MSG_FilterType filterType = GetFolderFilterType(); MSG_CreateFilter(filterType, (char *) (const char *) m_lpszFilterName, @@ -1581,8 +2132,13 @@ void CFilterDialog::OnOK() for (i = 0; i < GetNumTerms(); i++) { //TODO add support for arbitrary headers +#ifdef FE_IMPLEMENTS_BOOLEAN_OR GetTerm(i, &attrib, &op, &value, szHeader); - MSG_RuleAddTerm( rule, attrib, op, &value, !m_bLogicType, szHeader); + MSG_RuleAddTerm( rule, attrib, op, &value, m_bLogicType, szHeader); //~~ +#else + GetTerm(i, &attrib, &op, &value); + MSG_RuleAddTerm( rule, attrib, op, &value); +#endif } MSG_RuleActionType action; @@ -1601,3 +2157,4 @@ LRESULT CFilterDialog::OnDlgSubclass(WPARAM wParam, LPARAM lParam) } #endif + diff --git a/mozilla/cmd/winfe/filter.h b/mozilla/cmd/winfe/filter.h index 8f9323f8cb2..16845c0fc07 100755 --- a/mozilla/cmd/winfe/filter.h +++ b/mozilla/cmd/winfe/filter.h @@ -16,6 +16,7 @@ * Reserved. */ + #ifndef __Filter_h #define __Filter_h @@ -30,7 +31,34 @@ // filter.h : header file // +class CFilterScopeCombo: public CMiscFolderCombo +{ +protected: + int m_iPosIndex, m_iPosName, m_iPosStatus; + BOOL m_bFirst; + RECT m_rcList; + + HFONT m_hFont, m_hBigFont; +public: + + //overriding functionality called in CMailFolderHelper + int PopulateNews(MSG_Master *pMaster, BOOL bRoots); + void SubPopulate(int &index, MSG_FolderInfo *folder ); + + virtual void SetFont( CFont *pFont, CFont *pBigFont ); + + CFilterScopeCombo(); + ~CFilterScopeCombo(); + +protected: + virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct ); + + afx_msg void OnPaint( ); + afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor ); + DECLARE_MESSAGE_MAP() + +}; ///////////////////////////////////////////////////////////////////////////// // CFilterList @@ -64,15 +92,22 @@ class CFilterPickerDialog : public CDialog { protected: MSG_Pane *m_pPane; + CWnd *m_pParent; CFilterList m_FilterList; + CFilterScopeCombo m_ScopeCombo; + CBitmapButton m_UpButton; CBitmapButton m_DownButton; +public: + MSG_FolderInfo *m_FolderInfoScope; + CDWordArray *m_pDWordArray; //array of filter lists. // Construction public: CFilterPickerDialog(MSG_Pane *pPane, CWnd* pParent = NULL); + ~CFilterPickerDialog(); // Dialog Data //{{AFX_DATA(CFilterPickerDialog) enum { IDD = IDD_FILTER_PICKER }; @@ -89,6 +124,9 @@ public: protected: void UpdateList(); + MSG_FilterType GetFilterType(MSG_FolderInfo *pFolderInfo); + + BOOL FilterListAlreadyOpen(MSG_FolderInfo *pFolder, MSG_FilterList *&pReturnList); MSG_FilterList *m_pFilterList; MSG_Filter *m_pFilter; @@ -100,6 +138,9 @@ protected: // Generated message map functions //{{AFX_MSG(CFilterPickerDialog) afx_msg void OnDblclkListFilter(); + afx_msg void OnScope(); + afx_msg void OnServerFilters(); + afx_msg void OnUpdateServerFilters(CCmdUI *pCmdUI); afx_msg void OnSelchangeListFilter(); afx_msg void OnSelcancelListFilter(); afx_msg void OnOK(); @@ -123,20 +164,19 @@ protected: ///////////////////////////////////////////////////////////////////////////// // CFilterDialog dialog -class CCustomHeadersDlg; - class CFilterDialog : public CDialog { protected: CMailFolderCombo m_FolderCombo; MSG_Pane *m_pPane; MSG_Filter **m_hFilter; + MSG_FolderInfo *m_pFolderInfoScope; // Construction public: - CFilterDialog(MSG_Pane *pPane, MSG_Filter **filter, CWnd* pParent = NULL); + CFilterDialog(MSG_Pane *pPane, MSG_FolderInfo *pFolderInfoScope, + MSG_Filter **filter, CWnd* pParent = NULL); - CCustomHeadersDlg *m_pCustomHeadersDlg; int m_iRowIndex; BOOL m_bLogicType; int m_iRowSelected; @@ -144,10 +184,9 @@ public: void UpdateOpList(int iRow); void UpdateDestList(); void UpdateColumn1Attributes(); - void EditHeaders(int iRow); int GetNumTerms(); - +#ifdef FE_IMPLEMENTS_BOOLEAN_OR void GetTerm(int iRow, MSG_SearchAttribute *attrib, MSG_SearchOperator *op, @@ -159,6 +198,18 @@ public: MSG_SearchOperator op, MSG_SearchValue value, char *pszArbitraryHeader); +#else + void GetTerm(int iRow, + MSG_SearchAttribute *attrib, + MSG_SearchOperator *op, + MSG_SearchValue *value); + + void SetTerm(int iRow, + MSG_SearchAttribute attrib, + MSG_SearchOperator op, + MSG_SearchValue value); +#endif + void GetAction(MSG_RuleActionType *action, void **value); void SetAction(MSG_RuleActionType action, void *value); @@ -183,6 +234,10 @@ public: protected: void SlideBottomControls(int); + MSG_ScopeAttribute GetFolderScopeAttribute(); + MSG_FilterType GetFolderFilterType(); + void updateAndOr(); + // Generated message map functions //{{AFX_MSG(CFilterDialog) @@ -197,6 +252,7 @@ protected: afx_msg void OnFewer(); afx_msg void OnHelp(); afx_msg void OnAndOr(); + afx_msg void OnAdvanced(); virtual void OnOK(); virtual BOOL OnInitDialog(); afx_msg LONG OnFinishedHeaders(WPARAM wParam, LPARAM lParam ); @@ -211,3 +267,4 @@ protected: }; #endif + diff --git a/mozilla/cmd/winfe/fldrfrm.cpp b/mozilla/cmd/winfe/fldrfrm.cpp index 34af49a7536..913800df2b2 100644 --- a/mozilla/cmd/winfe/fldrfrm.cpp +++ b/mozilla/cmd/winfe/fldrfrm.cpp @@ -57,8 +57,9 @@ const UINT FolderCodes[] = { CFolderFrame::CFolderFrame() { m_iMessageMenuPos = 2; - m_iMoveMenuPos = 3; + m_iMoveMenuPos = 2; m_iCopyMenuPos = -1; + m_iAddAddressBookMenuPos = -1; m_iFileMenuPos = -1; m_iAttachMenuPos = -1; @@ -140,8 +141,6 @@ BEGIN_MESSAGE_MAP( CFolderFrame, CMsgListFrame ) ON_COMMAND(ID_FILE_UPDATECOUNTS, OnUpdateView) ON_UPDATE_COMMAND_UI(ID_FILE_UPDATECOUNTS, OnUpdateUpdateView) - ON_COMMAND(ID_VIEW_PROPERTIES, OnViewProperties) - ON_UPDATE_COMMAND_UI(ID_VIEW_PROPERTIES, OnUpdateViewProperties) // Organize Menu #ifdef ON_COMMAND_RANGE ON_COMMAND_RANGE(FIRST_MOVE_MENU_ID, LAST_MOVE_MENU_ID, OnMove ) @@ -348,7 +347,17 @@ void CFolderFrame::OnNew() if (folderLine.flags & (MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_NEWS_HOST)) { OnNewNewsgroup(); } else { - CNewFolderDialog( this, m_pPane, GetCurFolder() ); + MWContext *pXPCX = NULL; + MWContextType saveType; + if (m_pPane) + { + pXPCX = MSG_GetContext( m_pPane ); + saveType = pXPCX->type; + } + CNewFolderDialog newFolderDlg( this, m_pPane, MSG_SuggestNewFolderParent(GetCurFolder(), WFE_MSGGetMaster()) ); + newFolderDlg.DoModal(); + if (m_pPane) + pXPCX->type = saveType; } } @@ -391,124 +400,6 @@ void _ShutDownFrameCallBack(HWND hwnd, MSG_Pane *pane, void * closure) } -void CFolderFrame::OnViewProperties() -{ - MSG_ViewIndex *indices; - int count; - BOOL bNoPropertiesNeeded = FALSE; - MSG_FolderLine folderLine; - - m_pOutliner->GetSelection( indices, count ); - MSG_FolderInfo *folderInfo = MSG_GetFolderInfo( m_pPane, indices[0] ); - MSG_GetFolderLineByIndex( m_pPane, indices[0], 1, &folderLine ); - - CString csTitle; - if (folderLine.flags & (MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_CATEGORY)) { - csTitle.LoadString(IDS_NEWSGROUPPROP); - } else if (folderLine.flags & MSG_FOLDER_FLAG_NEWS_HOST) { - csTitle.LoadString(IDS_NEWSHOSTPROP); - } else { - if (folderLine.level > 1) { - csTitle.LoadString(IDS_FOLDERPROP); - }else { - csTitle.LoadString(IDS_MAILSERVERPROP); - } - } - CNewsFolderPropertySheet FolderSheet( csTitle, this ); - - //destructor handles clean up of added sheets - - //only make and add the pages if they selected a news group or category - if ( folderLine.flags & (MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_CATEGORY) ) - { - FolderSheet.m_pNewsFolderPage= new CNewsGeneralPropertyPage(&FolderSheet); - FolderSheet.m_pNewsFolderPage->SetFolderInfo( folderInfo, (MWContext*)GetContext() ); - - FolderSheet.m_pDownLoadPageNews = new CDownLoadPPNews(&FolderSheet); - FolderSheet.m_pDownLoadPageNews->SetFolderInfo(folderInfo); - - FolderSheet.m_pDiskSpacePage = new CDiskSpacePropertyPage(&FolderSheet); - FolderSheet.m_pDiskSpacePage->SetFolderInfo (folderInfo ); - - FolderSheet.AddPage(FolderSheet.m_pNewsFolderPage); - FolderSheet.AddPage(FolderSheet.m_pDownLoadPageNews); - FolderSheet.AddPage(FolderSheet.m_pDiskSpacePage); - } - else if ( folderLine.flags & MSG_FOLDER_FLAG_NEWS_HOST) - { - MSG_NewsHost *pNewsHost = MSG_GetNewsHostFromIndex (m_pPane, indices[0]); - FolderSheet.m_pNewsHostPage= new CNewsHostGeneralPropertyPage; - FolderSheet.m_pNewsHostPage->SetFolderInfo( folderInfo,pNewsHost ); - FolderSheet.AddPage(FolderSheet.m_pNewsHostPage); - } - else if ( folderLine.level > 1) - { - FolderSheet.m_pFolderPage= new CFolderPropertyPage(&FolderSheet); - FolderSheet.m_pFolderPage->SetFolderInfo( folderInfo, m_pPane ); - FolderSheet.AddPage(FolderSheet.m_pFolderPage); - //only add this page if it's an offline mail folder. - if (folderLine.flags & MSG_FOLDER_FLAG_IMAPBOX) - { - FolderSheet.m_pDownLoadPageMail = new CDownLoadPPMail; - FolderSheet.m_pDownLoadPageMail->SetFolderInfo( folderInfo ); - FolderSheet.AddPage(FolderSheet.m_pDownLoadPageMail); - } - } - else - { - wfe_DisplayPreferences((CGenericFrame*)this); - bNoPropertiesNeeded = TRUE; - } - - if ( !bNoPropertiesNeeded) - { - if(FolderSheet.DoModal() == IDOK) - { - if(FolderSheet.DownLoadNow()) - { - new CProgressDialog(this, NULL,_ShutDownFrameCallBack, - folderInfo,szLoadString(IDS_DOWNLOADINGARTICLES)); - ;//DonwLoad!!!!!!! - } - else if (FolderSheet.CleanUpNow()) - { - MSG_Command (m_pPane, MSG_CompressFolder, - indices, 1); - } - else if (FolderSheet.SynchronizeNow()) - ;//Synchronize!!!! - } - } -} - -void CFolderFrame::OnUpdateViewProperties( CCmdUI *pCmdUI ) -{ - MSG_ViewIndex *indices; - int count; - - m_pOutliner->GetSelection( indices, count ); - - MSG_FolderLine folderLine; - - MSG_FolderInfo *folderInfo = MSG_GetFolderInfo( m_pPane, indices[0] ); - MSG_GetFolderLineByIndex( m_pPane, indices[0], 1, &folderLine ); - - CString csTitle; - if (folderLine.flags & (MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_CATEGORY)) { - pCmdUI->SetText(szLoadString(IDS_POPUP_NEWSGROUPPROP)); - } else if (folderLine.flags & MSG_FOLDER_FLAG_NEWS_HOST) { - pCmdUI->SetText(szLoadString(IDS_POPUP_NEWSHOSTPROP)); - } else { - if (folderLine.level > 1) { - pCmdUI->SetText(szLoadString(IDS_POPUP_FOLDERPROP)); - }else { - pCmdUI->SetText(szLoadString(IDS_POPUP_MAILSERVERPROP)); - } - } - - pCmdUI->Enable( count == 1 ); -} - void CFolderFrame::OnMove(UINT nID) { if ( m_pPane ) { @@ -604,7 +495,10 @@ void CFolderFrame::DoOpenFolder(BOOL bReuse) } if (pFrame) + { pFrame->ActivateFrame(); + pFrame->LoadFolder(folderLine.id); + } } } } diff --git a/mozilla/cmd/winfe/fldrfrm.h b/mozilla/cmd/winfe/fldrfrm.h index 8bb74ef4d81..92e214e6ade 100644 --- a/mozilla/cmd/winfe/fldrfrm.h +++ b/mozilla/cmd/winfe/fldrfrm.h @@ -62,8 +62,6 @@ protected: // View Menu Items afx_msg void OnUpdateView(); afx_msg void OnUpdateUpdateView( CCmdUI *pCmdUI ); - afx_msg void OnViewProperties(); - afx_msg void OnUpdateViewProperties( CCmdUI *pCmdUI ); // Message Menu Items afx_msg void OnMove( UINT nID ); diff --git a/mozilla/cmd/winfe/genchrom.cpp b/mozilla/cmd/winfe/genchrom.cpp index 73720489e04..1574bf81bad 100755 --- a/mozilla/cmd/winfe/genchrom.cpp +++ b/mozilla/cmd/winfe/genchrom.cpp @@ -161,9 +161,21 @@ void CGenericToolBar::SetButtons( const UINT *lpIDArray, pButton->SetBitmap(hBitmap, TRUE); m_pCommandToolbar->AddButton(pButton); + } // m_barTool.PlaceToolbar(); } + +CToolbarButton *CGenericToolBar::GetButtonByIndex(int index) +{ + return m_pCommandToolbar->GetNthButton(index); + +} + +CToolbarButton *CGenericToolBar::GetButtonByID(int nCmd) +{ + return m_pCommandToolbar->GetButton(nCmd); +} void CGenericToolBar::SetButtonStyle( UINT nIDButtonCommand, DWORD dwButtonStyle ) { @@ -440,11 +452,11 @@ CNetscapeStatusBar *CGenericStatusBar::GetNetscapeStatusBar() return m_pStatusBar; } -BOOL CGenericStatusBar::Create( CWnd* pParentWnd, DWORD dwStyle, UINT nID, BOOL bSecurityStatus /*=TRUE*/, BOOL bTaskbar /*=TRUE*/ ) +BOOL CGenericStatusBar::Create( CWnd* pParentWnd, DWORD dwStyle, UINT nID, BOOL bxxx /*=TRUE*/, BOOL bTaskbar /*=TRUE*/ ) { m_pCreatedBar = new CNetscapeStatusBar; - if( !m_pCreatedBar->Create( pParentWnd, bSecurityStatus, bTaskbar ) ) + if( !m_pCreatedBar->Create( pParentWnd, bxxx, bTaskbar ) ) { delete m_pCreatedBar; m_pCreatedBar = NULL; diff --git a/mozilla/cmd/winfe/genchrom.h b/mozilla/cmd/winfe/genchrom.h index d60afbb1581..96632bcd034 100755 --- a/mozilla/cmd/winfe/genchrom.h +++ b/mozilla/cmd/winfe/genchrom.h @@ -65,6 +65,8 @@ public: virtual void RemoveAllButtons(); virtual CToolbarButton *RemoveButton( int index ); + virtual CToolbarButton *GetButtonByIndex(int index); + virtual CToolbarButton *GetButtonByID(int nCmd); virtual BOOL LoadBitmap( LPCSTR lpszResourceName ); @@ -112,7 +114,7 @@ public: virtual BOOL Create( CWnd* pParentWnd, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, UINT nID = AFX_IDW_STATUS_BAR, - BOOL bSecurityStatus = TRUE, BOOL bTaskbar = TRUE ); + BOOL bxxx = TRUE, BOOL bTaskbar = TRUE ); virtual void Attach( CNetscapeStatusBar *pBar ); diff --git a/mozilla/cmd/winfe/genfram2.cpp b/mozilla/cmd/winfe/genfram2.cpp index b29d4c2a26e..67ab36d5098 100644 --- a/mozilla/cmd/winfe/genfram2.cpp +++ b/mozilla/cmd/winfe/genfram2.cpp @@ -17,6 +17,8 @@ */ #include "stdafx.h" + +#include "rosetta.h" #include "ssl.h" #include "secnav.h" #include "wfemsg.h" @@ -33,9 +35,18 @@ #include "nethelp.h" #include "navfram.h" #include "prefapi.h" +#ifdef MOZ_MAIL_NEWS +#include "mailpriv.h" +#include "offlndlg.h" +#endif //MOZ_MAIL_NEWS + +#ifdef MOZ_MAIL_NEWS +extern "C" char *FE_GetProgramDirectory(char *buffer, int length); +#endif //MOZ_MAIL_NEWS void CGenericFrame::OnSecurity() { + HG73537 MWContext * pContext = GetMainContext()->GetContext(); if (pContext != NULL) @@ -54,11 +65,19 @@ void CGenericFrame::OnSecurity() void CGenericFrame::OnUpdateSecurity(CCmdUI *pCmdUI) { + HG73537 int status = XP_GetSecurityStatus(GetMainContext()->GetContext()); pCmdUI->Enable(status == SSL_SECURITY_STATUS_ON_LOW || status == SSL_SECURITY_STATUS_ON_HIGH); } +#ifdef MOZ_OFFLINE +void CGenericFrame::OnUpdateOnlineStatus(CCmdUI *pCmdUI) +{ + pCmdUI->Enable(!NET_IsOffline()); +} +#endif //MOZ_OFFLINE + void CGenericFrame::OnEnterIdle(UINT nWhy, CWnd* pWho ) { CFrameWnd::OnEnterIdle(nWhy, pWho); @@ -146,6 +165,29 @@ void CGenericFrame::OnShowAddressBookWindow() #endif } +#ifdef MOZ_MAIL_NEWS +void CGenericFrame::OnMigrationTools() +{ + WFE_MSGLaunchMigrationUtility(m_hWnd, FALSE, NULL); +} + +void CGenericFrame::OnUpdateMigrationTools(CCmdUI* pCmdUI) +{ + char executable [_MAX_PATH + 32]; + strcpy (executable, ""); + FE_GetProgramDirectory( executable, _MAX_PATH + 32 ); + if ( *executable ) + { + strcat( executable, "import32.exe" ); + } +#ifdef XP_WIN32 + DWORD result = GetFileAttributes(executable); + + pCmdUI->Enable(result !=0xFFFFFFFF); +#endif +} +#endif //MOZ_MAIL_NEWS + void CGenericFrame::OnFileMailNew() { #ifdef MOZ_MAIL_NEWS @@ -157,11 +199,123 @@ void CGenericFrame::OnFileMailNew() #endif } +// Toggle Go offline, Go online menu item +// +void CGenericFrame::OnGoOffline() +{ +#ifdef MOZ_OFFLINE + BOOL bOnline; + // This is now just a toggle. + PREF_GetBoolPref("network.online", &bOnline); + + COfflineInfo *info = NULL; + BOOL bProgress = FALSE; + if(!bOnline) + { +#ifdef MOZ_MAIL_NEWS + //if we're offline then tell it to send mail when we come back online + info = new COfflineInfo(FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE); + CProgressDialog *pProgress = + new CProgressDialog(this, NULL,COfflineDlg::ShutDownFrameCallBack, + info, szLoadString(IDS_SYNCHRONIZING), NULL, + COfflineDlg::ShowOnlineCallBack); // need correct window title + + if(!pProgress->GetProgressShown()) + { + PREF_SetBoolPref("network.online", TRUE); + } +#endif //MOZ_MAIL_NEWS + } + else + { + //if we have a master then there could be mail/news activity and we + // need to call progress pane. + if(WFE_MSGGetMasterValue() != NULL) + { +#ifdef MOZ_MAIL_NEWS + //if we're online then tell backend to do nothing (any synchronization + //gets done through synchronize menu + info = new COfflineInfo(FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE); + new CProgressDialog(this, NULL,COfflineDlg::ShutDownFrameCallBack, + info, szLoadString(IDS_SYNCHRONIZING)); // need correct window title +#endif // MOZ_MAIL_NEWS + } + else + { + PREF_SetBoolPref("network.online", FALSE); + } + + } + + if(info) + { + delete info; + } + +#endif //MOZ_OFFLINE +} + +void CGenericFrame::OnUpdateGoOffline(CCmdUI* pCmdUI) +{ +#ifdef MOZ_OFFLINE + BOOL bOnline; + CString menuText; + + PREF_GetBoolPref("network.online", &bOnline); + if (bOnline) + { //online now, set to offline + menuText.LoadString(IDS_GO_OFFLINE); + } + else + { //offline now, set to online + menuText.LoadString(IDS_GO_ONLINE); + } + pCmdUI->SetText(LPCTSTR(menuText)); + pCmdUI->Enable(!theApp.m_bSynchronizing); +#endif //MOZ_OFFLINE +} + +#ifdef MOZ_MAIL_NEWS +void CGenericFrame::OnSynchronize() +{ +#ifdef MOZ_OFFLINE + if(!theApp.m_bSynchronizing) + { + WFE_Synchronize(this, FALSE); + } +#endif //MOZ_OFFLINE +} + +void CGenericFrame::OnUpdateSynchronize(CCmdUI *pCmdUI) +{ +#ifdef MOZ_OFFLINE + BOOL bOnline; + PREF_GetBoolPref("network.online", &bOnline); + //don't want it enabled if app is currently synchronizing. + pCmdUI->Enable(bOnline && !theApp.m_bSynchronizing); +#endif //MOZ_OFFLINE +} +#endif //MOZ_MAIL_NEWS + +void CGenericFrame::OnDoneGoingOffline() +{ +#ifdef MOZ_OFFLINE + // I'm sure this could happen at the worst possible time + if (!GetMainContext() || !GetMainContext()->GetContext()) + return; + + MWContext *pContext = GetMainContext()->GetContext(); + if (NET_IsOffline() && !XP_IsContextBusy(pContext)) { + FE_Progress(pContext, szLoadString(IDS_STATUS_OFFLINE)); + } else { + FE_Progress(pContext, szLoadString(IDS_DOC_DONE)); + } +#endif // MOZ_OFFLINE +} + void CGenericFrame::OnLDAPSearch() { -#ifdef MOZ_LDAP - WFE_MSGOpenLDAPSearch(); -#endif + } // Set some options for printing. diff --git a/mozilla/cmd/winfe/genframe.cpp b/mozilla/cmd/winfe/genframe.cpp index 2228f93a7fb..1f4a79226d8 100644 --- a/mozilla/cmd/winfe/genframe.cpp +++ b/mozilla/cmd/winfe/genframe.cpp @@ -64,6 +64,9 @@ extern void wfe_Progress(MWContext *pContext, const char *pMessage); static char BASED_CODE THIS_FILE[] = __FILE__; #endif +UINT NEAR WM_FINDREPLACE = ::RegisterWindowMessage(FINDMSGSTRING); +UINT NEAR WM_HELPMSG = ::RegisterWindowMessage(HELPMSGSTRING); + //CLM: Global in TEMPLATE.CPP - saves last frame location // for new window postioning - cleared in ::OnClose method here extern CGenericFrame *wfe_pLastFrame; @@ -100,6 +103,39 @@ IMPLEMENT_DYNCREATE(CNSGenFrame, CFrameWnd) #ifndef _AFXDLL #define new DEBUG_NEW #endif + +extern "C" void WFE_StartCalendar() +{ + if(!FEU_IsCalendarAvailable()) + return; + + CString installDirectory, executable; + +#ifdef WIN32 + CString calRegistry; + + calRegistry.LoadString(IDS_CALENDAR_REGISTRY); + + calRegistry = FEU_GetCurrentRegistry(calRegistry); + if(calRegistry.IsEmpty()) + return; + + installDirectory = FEU_GetInstallationDirectory(calRegistry, szLoadString(IDS_INSTALL_DIRECTORY)); + executable = szLoadString(IDS_CALENDAR32EXE); +#else ifdef XP_WIN16 + installDirectory = FEU_GetInstallationDirectory(szLoadString(IDS_CALENDAR),szLoadString(IDS_INSTALL_DIRECTORY)); + executable = szLoadString(IDS_CALENDAR16EXE); +#endif + if(!installDirectory.IsEmpty()) + { + executable = installDirectory + executable; + + if( WinExec(executable, SW_SHOW) >= 31) + return; + } + ::MessageBox(NULL, szLoadString(IDS_CANTCALENDAR), szLoadString(IDS_CALENDAR), MB_OK); +} + ///////////////////////////////////////////////////////////////////////////// // CGenericFrame @@ -756,6 +792,10 @@ BEGIN_MESSAGE_MAP(CGenericFrame, CFrameWnd) ON_COMMAND(ID_OPEN_NEWS_WINDOW, OnOpenNewsWindow) ON_COMMAND(ID_WINDOW_BOOKMARKWINDOW, OnShowBookmarkWindow) ON_COMMAND(ID_WINDOW_ADDRESSBOOK, OnShowAddressBookWindow) +#ifdef MOZ_MAIL_NEWS + ON_COMMAND(ID_MIGRATION_TOOLS, OnMigrationTools) + ON_UPDATE_COMMAND_UI(ID_MIGRATION_TOOLS, OnUpdateMigrationTools) +#endif //MOZ_MAIL_NEWS #if defined(OJI) || defined(JAVA) ON_COMMAND(ID_OPTIONS_SHOWJAVACONSOLE, OnToggleJavaConsole) ON_UPDATE_COMMAND_UI(ID_OPTIONS_SHOWJAVACONSOLE, OnUpdateJavaConsole) @@ -779,6 +819,13 @@ BEGIN_MESSAGE_MAP(CGenericFrame, CFrameWnd) ON_COMMAND(ID_OPTIONS_MAILANDNEWS, OnPrefsMailNews) ON_COMMAND(ID_BIG_SWITCH, OnGoOffline) ON_UPDATE_COMMAND_UI(ID_BIG_SWITCH, OnUpdateGoOffline) +#ifdef MOZ_MAIL_NEWS + ON_COMMAND(ID_SYNCHRONIZE, OnSynchronize) + ON_UPDATE_COMMAND_UI(ID_SYNCHRONIZE, OnUpdateSynchronize) +#endif +#ifdef MOZ_OFFLINE + ON_UPDATE_COMMAND_UI(IDS_ONLINE_STATUS, OnUpdateOnlineStatus) +#endif //MOZ_OFFLINE ON_COMMAND(ID_DONEGOINGOFFLINE, OnDoneGoingOffline) #ifdef FORTEZZA ON_COMMAND(ID_FORTEZZA_CARD, OnStartFortezzaCard) @@ -2329,38 +2376,9 @@ void CGenericFrame::OnAim() void CGenericFrame::OnCalendar() { - - if(!FEU_IsCalendarAvailable()) - return; - - CString installDirectory, executable; - -#ifdef WIN32 - CString calRegistry; - - calRegistry.LoadString(IDS_CALENDAR_REGISTRY); - - calRegistry = FEU_GetCurrentRegistry(calRegistry); - if(calRegistry.IsEmpty()) - return; - - installDirectory = FEU_GetInstallationDirectory(calRegistry, szLoadString(IDS_INSTALL_DIRECTORY)); - executable = szLoadString(IDS_CALENDAR32EXE); -#else ifdef XP_WIN16 - installDirectory = FEU_GetInstallationDirectory(szLoadString(IDS_CALENDAR),szLoadString(IDS_INSTALL_DIRECTORY)); - executable = szLoadString(IDS_CALENDAR16EXE); -#endif - if(!installDirectory.IsEmpty()) - { - executable = installDirectory + executable; - - if( WinExec(executable, SW_SHOW) >= 31) - return; - } - MessageBox(szLoadString(IDS_CANTCALENDAR), szLoadString(IDS_CALENDAR), MB_OK); - - + WFE_StartCalendar(); } + void CGenericFrame::OnShowAdvanced() { int32 prefInt; @@ -2872,55 +2890,6 @@ void CNetscapePropertySheet::OnDestroy() extern int32 wfe_iFontSizeMode; -// Toggle Go offline, Go online menu item -// -void CGenericFrame::OnGoOffline() -{ -#ifdef MOZ_OFFLINE - BOOL bOnline; - CDownLoadDlg rDlg(this); - PREF_GetBoolPref("network.online", &bOnline); - rDlg.InitDialog(!bOnline); - rDlg.DoModal(); - // don't set the offline preference here! GoOffline won't work if we're offline! -#endif /* MOZ_OFFLINE */ -} - -void CGenericFrame::OnUpdateGoOffline(CCmdUI* pCmdUI) -{ -#ifdef MOZ_OFFLINE - BOOL bOnline; - CString menuText; - - PREF_GetBoolPref("network.online", &bOnline); - if (bOnline) - { //online now, set to offline - menuText.LoadString(IDS_GO_OFFLINE); - } - else - { //offline now, set to online - menuText.LoadString(IDS_GO_ONLINE); - } - pCmdUI->SetText(LPCTSTR(menuText)); -#endif /* MOZ_OFFLINE */ -} - -void CGenericFrame::OnDoneGoingOffline() -{ -#ifdef MOZ_OFFLINE - // I'm sure this could happen at the worst possible time - if (!GetMainContext() || !GetMainContext()->GetContext()) - return; - - MWContext *pContext = GetMainContext()->GetContext(); - if (NET_IsOffline() && !XP_IsContextBusy(pContext)) { - FE_Progress(pContext, szLoadString(IDS_STATUS_OFFLINE)); - } else { - FE_Progress(pContext, szLoadString(IDS_DOC_DONE)); - } -#endif // MOZ_OFFLINE -} - #ifdef FORTEZZA /* * It would be nice to replace the following code with a single routine diff --git a/mozilla/cmd/winfe/genframe.h b/mozilla/cmd/winfe/genframe.h index 692678a2e3d..df9fde6ee17 100644 --- a/mozilla/cmd/winfe/genframe.h +++ b/mozilla/cmd/winfe/genframe.h @@ -102,7 +102,7 @@ protected: #endif void AddToMenuMap(int nIndex, UINT nID); - void LoadFrameMenu(CMenu *pPopup, UINT nIndex); + virtual void LoadFrameMenu(CMenu *pPopup, UINT nIndex); void DeleteFrameMenu(HMENU hMenu); void DeleteMenuMapMenus(void); void DeleteMenuMapIDs(void); @@ -264,12 +264,19 @@ protected: afx_msg void OnFishCam(); afx_msg void OnShowBookmarkWindow(); afx_msg void OnShowAddressBookWindow(); +#ifdef MOZ_MAIL_NEWS + afx_msg void OnMigrationTools(); + afx_msg void OnUpdateMigrationTools(CCmdUI* pCmdUI); +#endif //MOZ_MAIL_NEWS #if defined(JAVA) || defined(OJI) afx_msg void OnToggleJavaConsole(); afx_msg void OnUpdateJavaConsole(CCmdUI* pCmdUI); #endif afx_msg void OnSecurity(); afx_msg void OnUpdateSecurity(CCmdUI *pCmdUI); +#ifdef MOZ_OFFLINE + afx_msg void OnUpdateOnlineStatus(CCmdUI *pCmdUI); +#endif //MOZ_OFFLINE afx_msg void OnViewCommandToolbar(); afx_msg void OnUpdateViewCommandToolbar(CCmdUI* pCmdUI); afx_msg void OnViewLocationToolbar(); @@ -301,6 +308,10 @@ protected: afx_msg void OnUpdateFileRoot(CCmdUI* pCmdUI); afx_msg void OnGoOffline(); afx_msg void OnUpdateGoOffline(CCmdUI* pCmdUI); +#ifdef MOZ_MAIL_NEWS + afx_msg void OnSynchronize(); + afx_msg void OnUpdateSynchronize(CCmdUI* pCmdUI); +#endif afx_msg void OnDoneGoingOffline(); #ifdef FORTEZZA afx_msg void OnStartFortezzaCard(); @@ -405,6 +416,6 @@ BOOL edt_IsEditorDynamicMenu(WPARAM wParam); CGenericFrame *wfe_FrameFromXPContext(MWContext * pXPCX); -static UINT NEAR WM_FINDREPLACE = ::RegisterWindowMessage(FINDMSGSTRING); -static UINT NEAR WM_HELPMSG = ::RegisterWindowMessage(HELPMSGSTRING); +extern UINT NEAR WM_FINDREPLACE; +extern UINT NEAR WM_HELPMSG; #endif diff --git a/mozilla/cmd/winfe/hiddenfr.cpp b/mozilla/cmd/winfe/hiddenfr.cpp index 724a0d37631..4386379e5e7 100644 --- a/mozilla/cmd/winfe/hiddenfr.cpp +++ b/mozilla/cmd/winfe/hiddenfr.cpp @@ -35,6 +35,9 @@ #include "nscpmapi.h" // rhp - for MAPI #include "mapihook.h" // rhp - for MAPI #include "mapismem.h" + +#include "abapi.h" // rhp - for Address Book API +#include "abhook.h" // rhp - for Address Book API #endif #ifdef _DEBUG @@ -745,7 +748,11 @@ LONG CHiddenFrame::OnProcessIPCHook(WPARAM wParam, LPARAM lParam) // Now check for what type of IPC message this really is? if ((pcds->dwData > NSCP_MAPIStartRequestID) && (pcds->dwData < NSCP_MAPIEndRequestID)) { - return ( ProcessNetscapeMAPIHook(wParam, lParam) ); + return ( ProcessNetscapeMAPIHook(wParam, lParam) ); + } + else if ((pcds->dwData > NSCP_NABStartRequestID) && (pcds->dwData < NSCP_NABEndRequestID)) + { + return ( ProcessNetscapeNABHook(wParam, lParam) ); // 3-17: Address book API } return(-1); diff --git a/mozilla/cmd/winfe/intlwin.cpp b/mozilla/cmd/winfe/intlwin.cpp index a2eecf7e13e..289379cafec 100755 --- a/mozilla/cmd/winfe/intlwin.cpp +++ b/mozilla/cmd/winfe/intlwin.cpp @@ -474,16 +474,16 @@ extern "C" size_t FE_StrfTime(MWContext *context, char *result, size_t maxsize, { case XP_TIME_FORMAT: // return strftime (result, maxsize, "%X", timeptr); - if (n = GetTimeFormat(LOCALE_SYSTEM_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOSECONDS | TIME_NOTIMEMARKER, &daytime, NULL, result, maxsize)) + if (n = GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &daytime, NULL, result, maxsize)) return n; else return strftime (result, maxsize, "%H:%M", timeptr); case XP_WEEKDAY_TIME_FORMAT: // return strftime (result, maxsize, "%a %X", timeptr); - if (GetDateFormat(LOCALE_SYSTEM_DEFAULT,0,&daytime,"ddd ", result, maxsize)) + if (GetDateFormat(LOCALE_USER_DEFAULT,0,&daytime,"ddd ", result, maxsize)) { n = strlen(result); - if (m = GetTimeFormat(LOCALE_SYSTEM_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOSECONDS | TIME_NOTIMEMARKER, &daytime, NULL, result+n, maxsize-n)) + if (m = GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &daytime, NULL, result+n, maxsize-n)) return n + m; else return strftime (result, maxsize, "%a %H:%M", timeptr); @@ -492,11 +492,11 @@ extern "C" size_t FE_StrfTime(MWContext *context, char *result, size_t maxsize, return strftime (result, maxsize, "%a %H:%M", timeptr); case XP_DATE_TIME_FORMAT: // return strftime (result, maxsize, "%x %X", timeptr); - if (GetDateFormat(LOCALE_SYSTEM_DEFAULT,DATE_SHORTDATE, &daytime,NULL, result, maxsize)) + if (GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE, &daytime,NULL, result, maxsize)) { n = strlen(result); result[n++] = ' '; - if (m = GetTimeFormat(LOCALE_SYSTEM_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOSECONDS | TIME_NOTIMEMARKER, &daytime, NULL, result+n, maxsize-n)) + if (m = GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &daytime, NULL, result+n, maxsize-n)) return m + n; else return strftime (result, maxsize, "%x %H:%M", timeptr); @@ -505,11 +505,11 @@ extern "C" size_t FE_StrfTime(MWContext *context, char *result, size_t maxsize, return strftime (result, maxsize, "%x %H:%M", timeptr); case XP_LONG_DATE_TIME_FORMAT: // return strftime (result, maxsize, "%x %X", timeptr); - if (GetDateFormat(LOCALE_SYSTEM_DEFAULT,DATE_LONGDATE, &daytime,NULL, result, maxsize)) + if (GetDateFormat(LOCALE_USER_DEFAULT,DATE_LONGDATE, &daytime,NULL, result, maxsize)) { n = strlen(result); result[n++] = ' '; - if (m = GetTimeFormat(LOCALE_SYSTEM_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &daytime, NULL, result+n, maxsize-n)) + if (m = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &daytime, NULL, result+n, maxsize-n)) return m + n; else return strftime (result, maxsize, "%x %H:%M", timeptr); diff --git a/mozilla/cmd/winfe/ipframe.cpp b/mozilla/cmd/winfe/ipframe.cpp index 89b009dc21f..31f66a46a32 100644 --- a/mozilla/cmd/winfe/ipframe.cpp +++ b/mozilla/cmd/winfe/ipframe.cpp @@ -225,10 +225,6 @@ BOOL CInPlaceFrame::OnCreateControlBars(CWnd* pWndFrame, CWnd* pWndDoc) // SetBarType(m_iShowStarterBar, m_iShowURLBar); - // Create the security bar. - // m_barSecurityStatus.Create(pWndFrame); - // m_barSecurityStatus.SetOwner(this); - ASSERT( m_pProxy2Frame ); LPNSSTATUSBAR pIStatusBar = NULL; diff --git a/mozilla/cmd/winfe/logindg.cpp b/mozilla/cmd/winfe/logindg.cpp index 1da6e7a2e99..ba3d6dc9507 100644 --- a/mozilla/cmd/winfe/logindg.cpp +++ b/mozilla/cmd/winfe/logindg.cpp @@ -33,6 +33,10 @@ #include "winli.h" #endif /* MOZ_LOC_INDEP */ +#ifdef NEW_PREF_ARCH +#include "cprofile.h" +#include "clocal.h" +#endif #ifdef XP_WIN16 #include "winfile.h" @@ -954,6 +958,88 @@ ProfileNameChangedFunc(const char *pref, void *data) return FALSE; } +#ifdef NEW_PREF_ARCH +int login_NewProfilePreInit() { + /* There's still some wacky stuff that the WinFE needs to do that + hasn't been rolled into the new profile/preference management. This is + where that goes */ + + //------------------------------------------------------------------------------------------------ + // KLUDGE! + // The Account Setup Wizard is now a Java/Javascript application. Since they have no control + // over the profile that will contain the preference changes, we use a hidden magic profile to + // hold their changes until they're done MUCKing about. When they've finished, they will + // rename the profile based on user inputs. If all goes well, the magic profile never outlives + // any given instance of the navigator/ASW. However, if anything fails the magic profile could + // be left lying about. This would be bad. + // + // The most unfortunate occurance of this problem would be while creating the first profile. + // In this case, we don't know the user hasn't successfully created a profile unless we check + // to see if the magic profile is the only one. The simplest way to handle this is to just + // expunge the magic profile whenever we get here and find that it exists. + //------------------------------------------------------------------------------------------------ + // + // Delete the magic profile if it exists + CUserProfileDB profileDB; + profileDB.DeleteUserProfile( ASW_MAGIC_PROFILE_NAME ); + + return 0; +} + + +int login_NewProfilePostInit(CProfile *pProfile) { + /* There's still some wacky stuff that the WinFE needs to do that + hasn't been rolled into the new profile/preference management. This is + where that goes */ + char profileName[81]; + char profilePW[41]; + int nameLength = 80; + int error = 0; + + PREF_GetCharPref("profile.name", profileName, &nameLength); + +#ifdef MOZ_LOC_INDEP + // read in the preference file (will assume valid dir here...we need to know if LI) + + XP_Bool prefBool=FALSE; + PREF_GetBoolPref("li.enabled",&prefBool); + + if (prefBool) { + CPrefStoreLocal *pLIStore; + CString csLIPrefsPath; + BOOL loginSuccess; + + pProfile->GetProfilePassword(profilePW, 40); + PREF_SetCharPref("li.login.password",profilePW); + + loginSuccess = FEU_StartGetCriticalFiles(profileName,theApp.m_UserDirectory); + + /* Ok, now we're back, so add the liprefs into the mix and reload from there */ + + if (loginSuccess) { + XP_StatStruct statinfo; + int ret; + + csLIPrefsPath = theApp.m_UserDirectory + "\\liprefs.js"; + + ret = _stat(csLIPrefsPath, &statinfo); + if(ret != -1) { + + pLIStore = new CPrefStoreLocalLI("liprefs.js", csLIPrefsPath); + pProfile->AddPrefsStoreBefore(pLIStore, "profile.cfg"); + + pProfile->LoadPrefs("liprefs.js", TRUE); + } + } else { + error = -1; + } + } +#endif + + return error; +} +#endif + int login_QueryForCurrentProfile() { CLoginDlg dlg; Bool bGotoASW = FALSE; @@ -1136,7 +1222,11 @@ int login_QueryForCurrentProfile() { // REMIND: JEM: we now read prefs twice...just to find this one pref...we should parse the file CString csTmp = pString; csTmp += "\\prefs.js"; - PREF_Init((char *)(const char *)csTmp); +#ifdef NEW_PREF_ARCH + PREF_Init(); +#else + PREF_Init((char *)(const char *)csTmp); +#endif XP_Bool prefBool=FALSE; PREF_GetBoolPref("li.enabled",&prefBool); @@ -1186,12 +1276,19 @@ Bool login_ProfileSelectedCompleteTheLogin(const char * szProfileName, const cha csTmp = theApp.m_UserDirectory; csTmp += "\\prefs.js"; - PREF_Init((char *)(const char *)csTmp); +#ifdef NEW_PREF_ARCH + PREF_Init(); +#else + PREF_Init((char *)(const char *)csTmp); +#endif - // read in the user's LI prefs file + +#ifdef MOZ_LOC_INDEP + // read in the user's LI prefs file char * prefName = WH_FileName(NULL, xpLIPrefs); PREF_ReadLIJSFile(prefName); XP_FREEIF (prefName); +#endif // read in the users optional JS file csTmp = theApp.m_UserDirectory; diff --git a/mozilla/cmd/winfe/mailfrm.cpp b/mozilla/cmd/winfe/mailfrm.cpp index 5294de22178..6f6f8a75a01 100755 --- a/mozilla/cmd/winfe/mailfrm.cpp +++ b/mozilla/cmd/winfe/mailfrm.cpp @@ -21,6 +21,8 @@ // #include "stdafx.h" + +#include "rosetta.h" #include "intl_csi.h" #include "netsvw.h" #include "cxsave.h" @@ -38,6 +40,9 @@ #include "prefapi.h" #include "ssl.h" #include "xpgetstr.h" +#include "wfemsg.h" +#include "abcom.h" +#include "addrfrm.h" //for MOZ_NEWADDR #ifdef DEBUG_WHITEBOX #include "xp_trace.h" @@ -59,6 +64,8 @@ static char BASED_CODE THIS_FILE[] = __FILE__; #endif int g_iModalDelay = -1; +int iMailFrameCount = 0; + MSG_Master *WFE_MSGGetMaster(); @@ -335,11 +342,12 @@ CMailNewsFrame::CMailNewsFrame() // Folder Frame is the only one that's different m_iMessageMenuPos = 4; - m_iMoveMenuPos = 6; - m_iCopyMenuPos = 7; + m_iMoveMenuPos = 7; + m_iCopyMenuPos = 8; + m_iAddAddressBookMenuPos = 10; m_iFileMenuPos = 0; - m_iAttachMenuPos = 3; + m_iAttachMenuPos = 1; m_pPane = NULL; m_pMessagePane = NULL; @@ -629,6 +637,8 @@ BEGIN_MESSAGE_MAP(CMailNewsFrame, CGenericFrame) ON_UPDATE_COMMAND_UI(ID_EDIT_MANAGEMAILACCOUNT, OnUpdateSetupWizard) ON_COMMAND(ID_EDIT_SERVER, OnServerStuff) ON_UPDATE_COMMAND_UI(ID_EDIT_SERVER, OnUpdateServerStuff) + ON_COMMAND(ID_VIEW_PROPERTIES, OnEditProperties) + ON_UPDATE_COMMAND_UI(ID_VIEW_PROPERTIES, OnUpdateProperties) // View Menu Items ON_COMMAND(ID_MAIL_SORTAGAIN, OnSortAgain) @@ -689,6 +699,8 @@ BEGIN_MESSAGE_MAP(CMailNewsFrame, CGenericFrame) ON_UPDATE_COMMAND_UI(ID_MESSAGE_PREVIOUS, OnUpdatePrevious) ON_COMMAND(ID_MESSAGE_PREVIOUSUNREAD, OnPreviousUnread) ON_UPDATE_COMMAND_UI(ID_MESSAGE_PREVIOUSUNREAD, OnUpdatePreviousUnread) + ON_COMMAND(ID_MESSAGE_FIRSTUNREAD, OnFirstUnread) + ON_UPDATE_COMMAND_UI(ID_MESSAGE_FIRSTUNREAD, OnUpdateFirstUnread) ON_COMMAND(ID_MESSAGE_NEXTUNREADTHREAD, OnNextUnreadThread) ON_UPDATE_COMMAND_UI(ID_MESSAGE_NEXTUNREADTHREAD, OnUpdateNextUnreadThread) ON_COMMAND(ID_MESSAGE_NEXTUNREADNEWSGROUP, OnNextUnreadFolder) @@ -710,6 +722,7 @@ BEGIN_MESSAGE_MAP(CMailNewsFrame, CGenericFrame) ON_COMMAND(ID_FILE_GETNEWMAIL, OnGetMail) ON_UPDATE_COMMAND_UI(ID_FILE_GETNEWMAIL, OnUpdateGetMail) ON_UPDATE_COMMAND_UI(ID_MESSAGE_REPLYBUTTON, OnUpdateReply) + ON_COMMAND(ID_MESSAGE_REPLYBUTTON, OnReplyButton) ON_COMMAND(ID_FILE_GETMOREMESSAGES, OnGetMail) ON_UPDATE_COMMAND_UI(ID_FILE_GETMOREMESSAGES, OnUpdateGetMail) ON_COMMAND(ID_FILE_GETNEXT, OnGetNext) @@ -725,10 +738,14 @@ BEGIN_MESSAGE_MAP(CMailNewsFrame, CGenericFrame) ON_UPDATE_COMMAND_UI(ID_MESSAGE_MARKBUTTON, OnUpdateMarkAllRead ) ON_COMMAND(ID_MESSAGE_REPLYALL, OnReplyAll) ON_UPDATE_COMMAND_UI(ID_MESSAGE_REPLYALL, OnUpdateReplyAll) + ON_COMMAND(ID_MESSAGE_FORWARDBUTTON, OnForwardButton) + ON_UPDATE_COMMAND_UI(ID_MESSAGE_FORWARDBUTTON, OnUpdateForwardButton) ON_COMMAND(ID_MESSAGE_FORWARD, OnForward) ON_UPDATE_COMMAND_UI(ID_MESSAGE_FORWARD, OnUpdateForward) ON_COMMAND(ID_MESSAGE_FORWARDQUOTED, OnForwardQuoted) ON_UPDATE_COMMAND_UI(ID_MESSAGE_FORWARDQUOTED, OnUpdateForwardQuoted) + ON_COMMAND(ID_MESSAGE_FORWARDINLINE, OnForwardInline) + ON_UPDATE_COMMAND_UI(ID_MESSAGE_FORWARDINLINE, OnUpdateForwardInline) ON_COMMAND(ID_MESSAGE_POSTREPLY, OnPostReply) ON_UPDATE_COMMAND_UI(ID_MESSAGE_POSTREPLY, OnUpdatePostReply) ON_COMMAND(ID_MESSAGE_POSTANDREPLY, OnPostAndMailReply) @@ -747,8 +764,6 @@ BEGIN_MESSAGE_MAP(CMailNewsFrame, CGenericFrame) ON_UPDATE_COMMAND_UI(ID_MESSAGE_MARKTHREADREAD, OnUpdateMarkThreadRead ) ON_COMMAND(ID_MESSAGE_MARKALLREAD, OnMarkAllRead ) ON_UPDATE_COMMAND_UI(ID_MESSAGE_MARKALLREAD, OnUpdateMarkAllRead ) - ON_COMMAND(ID_MESSAGE_MARKALLREAD, OnMarkAllRead ) - ON_UPDATE_COMMAND_UI(ID_MESSAGE_MARKALLREAD, OnUpdateMarkAllRead ) ON_COMMAND(ID_MESSAGE_CATCHUP, OnCatchup) ON_UPDATE_COMMAND_UI(ID_MESSAGE_CATCHUP, OnUpdateCatchup) ON_COMMAND(ID_MESSAGE_MARKASLATER, OnMarkMessagesLater) @@ -781,6 +796,53 @@ BEGIN_MESSAGE_MAP(CMailNewsFrame, CGenericFrame) ON_UPDATE_COMMAND_UI(ID_MESSAGE_ADDSENDER, OnUpdateAddToAddressBook) ON_COMMAND(ID_MESSAGE_ADDALL, OnAddAllToAddressBook) ON_UPDATE_COMMAND_UI(ID_MESSAGE_ADDALL, OnUpdateAddAllToAddressBook) +#ifdef ON_COMMAND_RANGE + ON_COMMAND_RANGE(FIRST_ADDSENDER_MENU_ID, LAST_ADDSENDER_MENU_ID, OnAddSenderAddressBook ) + ON_COMMAND_RANGE(FIRST_ADDALL_MENU_ID, LAST_ADDALL_MENU_ID, OnAddAllAddressBook ) + ON_UPDATE_COMMAND_UI_RANGE( FIRST_ADDSENDER_MENU_ID, LAST_ADDSENDER_MENU_ID, OnUpdateAddSenderAddressBook ) + ON_UPDATE_COMMAND_UI_RANGE( FIRST_ADDALL_MENU_ID, LAST_ADDALL_MENU_ID, OnUpdateAddAllAddressBook ) +#endif + // Encoding stuff + ON_COMMAND(ID_OPTIONS_ENCODING_1, OnToggleEncoding1) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_1, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_2, OnToggleEncoding2) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_2, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_3, OnToggleEncoding3) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_3, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_4, OnToggleEncoding4) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_4, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_5, OnToggleEncoding5) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_5, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_6, OnToggleEncoding6) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_6, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_7, OnToggleEncoding7) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_7, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_8, OnToggleEncoding8) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_8, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_9, OnToggleEncoding9) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_9, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_10, OnToggleEncoding10) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_10, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_11, OnToggleEncoding11) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_11, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_12, OnToggleEncoding12) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_12, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_13, OnToggleEncoding13) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_13, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_14, OnToggleEncoding14) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_14, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_15, OnToggleEncoding15) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_15, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_16, OnToggleEncoding16) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_16, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_17, OnToggleEncoding17) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_17, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_18, OnToggleEncoding18) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_18, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_19, OnToggleEncoding19) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_19, OnUpdateEncoding) + ON_COMMAND(ID_OPTIONS_ENCODING_20, OnToggleEncoding20) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_ENCODING_20, OnUpdateEncoding) // Non-MSG Commands ON_COMMAND(ID_OPTIONS_TIPS, OnTips) @@ -825,6 +887,17 @@ BOOL CMailNewsFrame::OnCommand( WPARAM wParam, LPARAM lParam ) OnAttachProperties( nID ); return TRUE; } + else if(nID >= FIRST_ADDSENDER_MENU_ID && nID <= LAST_ADDSENDER_MENU_ID) + { + OnAddSenderAddressBook(nID); + return TRUE; + } + else if(nID >= FIRST_ADDALL_MENU_ID && nID <= LAST_ADDALL_MENU_ID) + { + OnAddAllAddressBook(nID); + return TRUE; + } + #endif return CGenericFrame::OnCommand( wParam, lParam ); @@ -846,13 +919,23 @@ BOOL CMailNewsFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERI OnUpdateAttachProperties( pCmdUI ); return TRUE; } + else if(nID >= FIRST_ADDSENDER_MENU_ID && nID <= LAST_ADDSENDER_MENU_ID) + { + OnUpdateAddSenderAddressBook(pCmdUI); + return TRUE; + } + else if(nID >= FIRST_ADDALL_MENU_ID && nID <= LAST_ADDALL_MENU_ID) + { + OnUpdateAddAllAddressBook(pCmdUI); + return TRUE; + } + } return CGenericFrame::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); } #endif -static int iMailFrameCount = 0; int CMailNewsFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { @@ -900,31 +983,43 @@ HCURSOR CMailNewsFrame::OnQueryDragIcon() return (HCURSOR) theApp.LoadIcon(nIDIcon); } -void CMailNewsFrame::OnClose() +//this is a static function +BOOL CMailNewsFrame::CleanupFolders(MSG_Pane *pPane) { XP_Bool bSelectable = FALSE; XP_Bool bPlural = FALSE; MSG_COMMAND_CHECK_STATE sState = MSG_Unchecked; + ASSERT(pPane); + MSG_CommandStatus(pPane, MSG_DeliverQueuedMessages, 0, NULL, + &bSelectable, &sState, NULL, &bPlural); + + + if (bSelectable && !NET_IsOffline()) { + CString strTitle; + VERIFY(strTitle.LoadString(IDS_NETSCAPE_MAIL_TITLE)); + + if (::MessageBox(NULL, szLoadString(IDS_UNSENT_MESSAGES), strTitle, MB_YESNO) == IDYES) { + MSG_Command(pPane, MSG_DeliverQueuedMessages, 0, NULL ); + return FALSE; + } + } + if (MSG_CleanupNeeded(WFE_MSGGetMaster())) + new CProgressDialog(NULL, pPane,_ShutDownFrameCallBack, + NULL,szLoadString(IDS_COMPRESSINGFOLDERS)); + + return TRUE; +} + +void CMailNewsFrame::OnClose() +{ + if (1 == iMailFrameCount) // this seems to be null when you close a message window dmb { - ASSERT(m_pPane); - MSG_CommandStatus(m_pPane, MSG_DeliverQueuedMessages, 0, NULL, - &bSelectable, &sState, NULL, &bPlural); - - - if (bSelectable && !NET_IsOffline()) { - CString strTitle; - VERIFY(strTitle.LoadString(IDS_NETSCAPE_MAIL_TITLE)); - - if (MessageBox(szLoadString(IDS_UNSENT_MESSAGES), strTitle, MB_YESNO) == IDYES) { - MSG_Command(m_pPane, MSG_DeliverQueuedMessages, 0, NULL ); - return; - } + if(!CleanupFolders(m_pPane)) + { + return; } - if (MSG_CleanupNeeded(m_pMaster)) - new CProgressDialog(NULL, m_pPane,_ShutDownFrameCallBack, - NULL,szLoadString(IDS_COMPRESSINGFOLDERS)); } CGenericFrame::OnClose(); @@ -949,6 +1044,9 @@ void CMailNewsFrame::OnInitMenuPopup( CMenu* pPopupMenu, UINT nIndex, BOOL bSysM if ( m_iMessageMenuPos >= 0 && pPopupMenu->m_hMenu == GetSubMenu(hmenu, m_iMessageMenuPos )) { UpdateFileMenus(); +#ifdef MOZ_NEWADDR + UpdateAddressBookMenus(); +#endif } else if (m_iFileMenuPos >= 0 && pPopupMenu->m_hMenu == GetSubMenu(hmenu, m_iFileMenuPos )) { UpdateAttachmentMenus(); @@ -1070,12 +1168,13 @@ void CMailNewsFrame::UpdateMenu( MSG_FolderInfo *mailRoot, for (i = 0; i < iCount; i++) { if (MSG_GetFolderLineById(pMaster, folderInfos[i], &folderLine)) { if (folderLine.flags & MSG_FOLDER_FLAG_MAIL) { - if ( bAddSep ) { - ::AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); - } - UpdateMenu(folderInfos[i], hMenu, nID, nLevelTotal); - nLevelTotal = MSG_GetFolderChildren( pMaster, folderInfos[i], + int nChildTotal = MSG_GetFolderChildren( pMaster, folderInfos[i], NULL, NULL); + if (bAddSep) + ::AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); + if (nChildTotal) + UpdateMenu(folderInfos[i], hMenu, nID, nLevelTotal); + nLevelTotal += nChildTotal; bAddSep = TRUE; } } @@ -1158,6 +1257,34 @@ void CMailNewsFrame::UpdateFileMenus() DrawMenuBar(); } +void CMailNewsFrame::UpdateAddressBookMenus() +{ +#ifdef MOZ_NEWADDR + if(m_iAddAddressBookMenuPos == -1) + return; + + HMENU hFrameMenu = ::GetMenu( m_hWnd ); + + ASSERT( hFrameMenu ); + + if( hFrameMenu ) + { + HMENU hMessage = ::GetSubMenu( hFrameMenu, m_iMessageMenuPos ); + + if(hMessage) + { + + WFE_MSGBuildAddAddressBookPopups(hMessage, m_iAddAddressBookMenuPos, + FALSE, GetContext()->GetContext()); + } + } + DrawMenuBar(); +#endif +} + + + + void CMailNewsFrame::UpdateAttachmentMenus() { HMENU hFrameMenu = ::GetMenu( m_hWnd ); @@ -1224,13 +1351,35 @@ void CMailNewsFrame::DoUpdateCommand( CCmdUI* pCmdUI, MSG_CommandType cmd, BOOL MSG_COMMAND_CHECK_STATE sState; const char *display_string; - if (m_pPane) { + CMailNewsOutliner* pOutliner; + + if ((cmd == MSG_DeleteFolder || cmd == MSG_MarkAllRead || + cmd == MSG_DoRenameFolder) && + IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) + { + pOutliner = ((C3PaneMailFrame*)this)->GetFolderOutliner(); + if (cmd == MSG_MarkAllRead) + { + MSG_FolderLine folderLine; + if (((C3PaneMailFrame*)this)->GetSelectedFolder(&folderLine)) + { + if ( !(folderLine.flags & MSG_FOLDER_FLAG_NEWSGROUP) ) + pOutliner = m_pOutliner; + } + } + } + else + pOutliner = m_pOutliner; + + MSG_Pane *pPane = pOutliner ? pOutliner->GetPane(): m_pPane; + //XP_ASSERT(pPane); + if (pPane) { MSG_ViewIndex *indices = NULL; int count = 0; - if (m_pOutliner) - m_pOutliner->GetSelection(indices, count); + if (pOutliner) + pOutliner->GetSelection(indices, count); - MSG_CommandStatus(m_pPane, + MSG_CommandStatus(pPane, cmd, indices, count, &bSelectable, @@ -1256,7 +1405,8 @@ void CMailNewsFrame::DoCommand( MSG_CommandType msgCommand, int iModalDelay, BOO ModalStatusBegin( iModalDelay ); CMailNewsOutliner* pOutliner; - if (msgCommand == MSG_DeleteFolder && + if ((msgCommand == MSG_DeleteFolder || msgCommand == MSG_MarkAllRead || + msgCommand == MSG_DoRenameFolder) && IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) pOutliner = ((C3PaneMailFrame*)this)->GetFolderOutliner(); else @@ -1276,9 +1426,15 @@ void CMailNewsFrame::DoCommand( MSG_CommandType msgCommand, int iModalDelay, BOO } #endif + if (msgCommand == MSG_PostNew || msgCommand == MSG_PostReply || msgCommand == MSG_PostAndMailReply || + msgCommand == MSG_MailNew || msgCommand == MSG_ReplyToSender || msgCommand == MSG_ReplyToAll) + theApp.m_bReverseSenseOfHtmlCompose = (GetKeyState(VK_CONTROL) & 0x8000) != 0; + MSG_Pane *pPane = pOutliner ? pOutliner->GetPane(): m_pPane; MSG_Command(pPane, msgCommand, indices, count); + theApp.m_bReverseSenseOfHtmlCompose = FALSE; + if (!bAsync) ModalStatusEnd(); } @@ -1465,19 +1621,17 @@ void CMailNewsFrame::DoSubscribe(MSG_Host* pThisHost) CSubscribePropertySheet SubscribeNewsgroup(this, pContext, title); if (pThisHost) + { SubscribeNewsgroup.SetHost(pThisHost); + } else { MSG_FolderInfo* pFolderInfo = GetCurFolder(); if (pFolderInfo) { - MSG_FolderLine folderLine; - if (MSG_GetFolderLineById(WFE_MSGGetMaster(), pFolderInfo, - &folderLine)) - { - MSG_Host *pHost = MSG_GetHostForFolder(pFolderInfo); + MSG_Host *pHost = MSG_GetHostForFolder(pFolderInfo); + if (pHost) SubscribeNewsgroup.SetHost(pHost); - } } } @@ -1605,20 +1759,8 @@ void CMailNewsFrame::OnUpdateGoForward ( CCmdUI* pCmdUI ) DoUpdateNavigate(pCmdUI, MSG_Forward); } - void CMailNewsFrame::OnDeleteFolder( ) { - CMailNewsOutliner* pOutliner; - if (IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) - pOutliner = ((C3PaneMailFrame*)this)->GetFolderOutliner(); - else - pOutliner = m_pOutliner; - - MSG_ViewIndex *indices; - int count; - - pOutliner->GetSelection(indices, count); - DoCommand(MSG_DeleteFolder); } @@ -1630,7 +1772,7 @@ void CMailNewsFrame::OnUpdateDeleteFolder(CCmdUI* pCmdUI) MSG_FolderLine folderLine; MSG_GetFolderLineById( WFE_MSGGetMaster(), folderInfo, &folderLine ); - if ( pCmdUI->m_nID == ID_EDIT_DELETEFOLDER ) { + if ( pCmdUI->m_nID == ID_EDIT_DELETEFOLDER || pCmdUI->m_nID == ID_EDIT_DELETE_3PANE) { if ( folderLine.flags & MSG_FOLDER_FLAG_NEWS_HOST ) { pCmdUI->SetText( szLoadString( IDS_MENU_DELETENEWSHOST ) ); } else if ( folderLine.flags & MSG_FOLDER_FLAG_NEWSGROUP ) { @@ -1675,16 +1817,6 @@ void CMailNewsFrame::OnReallyDeleteMessage( ) void CMailNewsFrame::OnUpdateDeleteMessage(CCmdUI* pCmdUI) { - if (IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) - { - if (GetFocus() == (CWnd*)((C3PaneMailFrame*)this)->GetFolderOutliner()) - { - pCmdUI->Enable(FALSE); - return; - } - else - pCmdUI->Enable(TRUE); - } if ( m_bNews ) { pCmdUI->SetText( szLoadString( IDS_MENU_CANCELMESSAGE ) ); DoUpdateCommand(pCmdUI, MSG_CancelMessage); @@ -2028,6 +2160,20 @@ void CMailNewsFrame::OnUpdateNextUnread(CCmdUI* pCmdUI) pCmdUI->Enable(TRUE); } +void CMailNewsFrame::OnFirstUnread() +{ + //Currently no back end support for this and it asserts + + // DoNavigate(MSG_FirstUnreadMessage); +} + +void CMailNewsFrame::OnUpdateFirstUnread(CCmdUI* pCmdUI) +{ + //Currently no back end support for this and it asserts + pCmdUI->Enable(FALSE); +// DoUpdateNavigate(pCmdUI, MSG_FirstUnreadMessage); +} + void CMailNewsFrame::OnNext ( ) { DoNavigate( MSG_NextMessage ); @@ -2202,6 +2348,24 @@ void CMailNewsFrame::OnUpdateReply(CCmdUI* pCmdUI) DoUpdateCommand(pCmdUI, MSG_ReplyToSender); } +/* + * Reply button now has to respond on a single click as well + * as supply a menu. + */ +void CMailNewsFrame::OnReplyButton() +{ + // this will have to be changed to be based on preferences + if(m_bNews) + { + DoCommand(MSG_PostReply); + } + else + { + DoCommand(MSG_ReplyToSender); + } + +} + void CMailNewsFrame::OnReplyAll() { DoCommand(MSG_ReplyToAll); @@ -2212,14 +2376,25 @@ void CMailNewsFrame::OnUpdateReplyAll(CCmdUI* pCmdUI) DoUpdateCommand(pCmdUI, MSG_ReplyToAll); } +void CMailNewsFrame::OnForwardButton() +{ + + DoCommand(MSG_ForwardMessage); +} + +void CMailNewsFrame::OnUpdateForwardButton(CCmdUI* pCmdUI) +{ + DoUpdateCommand(pCmdUI, MSG_ForwardMessage); +} + void CMailNewsFrame::OnForward() { - DoCommand(MSG_ForwardMessage); + DoCommand(MSG_ForwardMessageAttachment); } void CMailNewsFrame::OnUpdateForward(CCmdUI* pCmdUI) { - DoUpdateCommand(pCmdUI, MSG_ForwardMessage); + DoUpdateCommand(pCmdUI, MSG_ForwardMessageAttachment); } void CMailNewsFrame::OnForwardQuoted() @@ -2232,6 +2407,16 @@ void CMailNewsFrame::OnUpdateForwardQuoted(CCmdUI* pCmdUI) DoUpdateCommand(pCmdUI, MSG_ForwardMessageQuoted); } +void CMailNewsFrame::OnForwardInline() +{ + DoCommand(MSG_ForwardMessageInline); +} + +void CMailNewsFrame::OnUpdateForwardInline(CCmdUI* pCmdUI) +{ + DoUpdateCommand(pCmdUI, MSG_ForwardMessageInline); +} + void CMailNewsFrame::OnSave ( ) { DoCommand(MSG_SaveMessagesAs); @@ -2477,7 +2662,14 @@ static void _EmptyTrashCallback(HWND hwnd, MSG_Pane *pane, void *closure) ///////////////////////////////////////////////////////////////////////////// void CMailNewsFrame::OnGetMail() { - new CProgressDialog(this, m_pPane, _GetMailCallback, NULL, NULL, _GetMailDoneCallback); + // prompt user about going online. Make sure get new mail is checked + if (NET_IsOffline()) + { + PREF_SetBoolPref("offline.download_mail", TRUE); + OnGoOffline(); + } + else + new CProgressDialog(this, m_pPane, _GetMailCallback, NULL, NULL, _GetMailDoneCallback); } void CMailNewsFrame::OnUpdateGetMail(CCmdUI *pCmdUI) @@ -2524,16 +2716,26 @@ void CMailNewsFrame::OnNewFolder ( ) else OnNewNewsgroup(); } else { + MSG_FolderInfo *pFolderInfo = NULL; if (IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) { MSG_FolderLine folderLine; if (((C3PaneMailFrame*)this)->GetSelectedFolder(&folderLine)) - CNewFolderDialog( this, m_pPane, folderLine.id ); - else - CNewFolderDialog( this, m_pPane, NULL ); + pFolderInfo = folderLine.id; } else - CNewFolderDialog( this, m_pPane, GetCurFolder() ); + pFolderInfo = GetCurFolder(); + MWContext *pXPCX = NULL; + MWContextType saveType; + if (m_pPane) + { + pXPCX = MSG_GetContext( m_pPane ); + saveType = pXPCX->type; + } + CNewFolderDialog newFolderDlg( this, m_pPane, MSG_SuggestNewFolderParent(pFolderInfo, WFE_MSGGetMaster()) ); + newFolderDlg.DoModal(); + if (m_pPane) + pXPCX->type = saveType; } } @@ -2578,15 +2780,23 @@ void CMailNewsFrame::OnCompressAll() MSG_FolderInfo *folderInfo = GetCurFolder(); if (folderInfo) { - XP_Bool bCompressAll = TRUE; + int32 lDeleteModel = 1; MSG_FolderLine folderLine; MSG_GetFolderLineById( WFE_MSGGetMaster(), GetCurFolder(), &folderLine ); if ( folderLine.flags & MSG_FOLDER_FLAG_IMAPBOX ) { - PREF_GetBoolPref("mail.imap.delete_is_move_to_trash", &bCompressAll); + MSG_Host *host = MSG_GetHostForFolder(folderInfo); + if(host != NULL) + { + const char * hostName = MSG_GetHostName(host); + if(hostName != NULL) + { + IMAP_GetIntPref(hostName, INT_DELETE_MODEL, &lDeleteModel); + } + } } - if (!bCompressAll) { + if (lDeleteModel != 1) { CompressFolderClosure cfc; cfc.indices = NULL; cfc.count = 0; @@ -2608,15 +2818,23 @@ void CMailNewsFrame::OnUpdateCompressAll ( CCmdUI* pCmdUI ) MSG_FolderInfo *folderInfo = GetCurFolder(); if (folderInfo) { - XP_Bool bCompressAll = TRUE; + int32 lDeleteModel = 1; MSG_FolderLine folderLine; MSG_GetFolderLineById( WFE_MSGGetMaster(), GetCurFolder(), &folderLine ); if ( folderLine.flags & MSG_FOLDER_FLAG_IMAPBOX ) { - PREF_GetBoolPref("mail.imap.delete_is_move_to_trash", &bCompressAll); + MSG_Host *host = MSG_GetHostForFolder(folderInfo); + if(host != NULL) + { + const char * hostName = MSG_GetHostName(host); + if(hostName != NULL) + { + IMAP_GetIntPref(hostName, INT_DELETE_MODEL, &lDeleteModel); + } + } } - if (!bCompressAll) { + if (lDeleteModel != 1) { pCmdUI->SetText(szLoadString(IDS_MENU_COMPRESSFOLDER)); DoUpdateCommand(pCmdUI, MSG_CompressFolder); } else { @@ -2639,6 +2857,87 @@ void CMailNewsFrame::OnUpdateEmptyTrash ( CCmdUI* pCmdUI ) DoUpdateCommand(pCmdUI, MSG_EmptyTrash); } +void CMailNewsFrame::OnAddSenderAddressBook(UINT nID) +{ + OnAddAddressBook(nID, MSG_AddSender); +} + +void CMailNewsFrame::OnAddAllAddressBook(UINT nID) +{ + OnAddAddressBook(nID, MSG_AddAll); +} + +void CMailNewsFrame::OnAddAddressBook(UINT nID, MSG_CommandType command) +{ + int nIndex = (command == MSG_AddSender) ? nID - FIRST_ADDSENDER_MENU_ID : + nID - FIRST_ADDALL_MENU_ID; + + XP_List *addressBooks = AB_AcquireAddressBookContainers(GetContext()->GetContext()); + + if(addressBooks) + { + AB_ContainerInfo *pInfo = (AB_ContainerInfo*)XP_ListGetObjectNum(addressBooks, nIndex); + + + if(m_pPane) + { + MSG_ViewIndex *indices = NULL; + int count = 0; + if(m_pOutliner) + m_pOutliner->GetSelection( indices, count ); + + MSG_AddToAddressBook(m_pPane, command, indices, count, pInfo); + } + + AB_ReleaseContainersList(addressBooks); + } + +} + +void CMailNewsFrame::OnUpdateAddSenderAddressBook(CCmdUI *pCmdUI) +{ + + OnUpdateAddAddressBook(pCmdUI, MSG_AddSender); + +} + +void CMailNewsFrame::OnUpdateAddAllAddressBook(CCmdUI *pCmdUI) +{ + + OnUpdateAddAddressBook(pCmdUI, MSG_AddAll); +} + +void CMailNewsFrame::OnUpdateAddAddressBook(CCmdUI *pCmdUI, MSG_CommandType command) +{ + XP_Bool selectable = FALSE; + MSG_COMMAND_CHECK_STATE selected; + const char *displayString = NULL; + XP_Bool plural = FALSE; + MSG_ViewIndex *indices = NULL; + int count = 0; + if(m_pOutliner) + m_pOutliner->GetSelection( indices, count ); + + int nIndex = (command == MSG_AddSender) ? pCmdUI->m_nID - FIRST_ADDSENDER_MENU_ID : + pCmdUI->m_nID - FIRST_ADDALL_MENU_ID; + + XP_List *addressBooks = AB_AcquireAddressBookContainers(GetContext()->GetContext()); + + if(addressBooks) + { + AB_ContainerInfo *pInfo = (AB_ContainerInfo*)XP_ListGetObjectNum(addressBooks, nIndex); + + + MSG_AddToAddressBookStatus(m_pPane, command, indices, count, &selectable, + &selected, &displayString, &plural, pInfo); + + pCmdUI->Enable(selectable); + + AB_ReleaseContainersList(addressBooks); + } + +} + void CMailNewsFrame::OnAddToAddressBook() { theApp.DoWaitCursor(1); @@ -2770,55 +3069,12 @@ void CMailNewsFrame::OnUpdatePriority(CCmdUI *pCmdUI) void CMailNewsFrame::OnUpdateSecurity(CCmdUI *pCmdUI) { - XP_Bool bSigned = FALSE; - XP_Bool bEncrypted = FALSE; - - MIME_GetMessageCryptoState(GetMainContext()->GetContext(), - 0, 0, - &bSigned, - &bEncrypted); - - if (m_bNews) { - int status = XP_GetSecurityStatus(GetMainContext()->GetContext()); - if (status == SSL_SECURITY_STATUS_ON_LOW || status == SSL_SECURITY_STATUS_ON_HIGH) - bEncrypted = TRUE; - } - - LPNSTOOLBAR pIToolBar; - m_pChrome->QueryInterface( IID_INSToolBar, (LPVOID *) &pIToolBar ); - if ( pIToolBar ) { - CCommandToolbar *pToolBar = (CCommandToolbar *) CWnd::FromHandlePermanent( pIToolBar->GetHWnd() ); - - int index = bEncrypted ? - (bSigned ? SEC_SIGNED_INDEX : SECURE_INDEX) : - (bSigned ? UNSEC_SIGNED_INDEX : UNSECURE_INDEX); - - pToolBar->ReplaceButtonBitmapIndex(ID_SECURITY, index); - pIToolBar->Release(); - } - pCmdUI->Enable(TRUE); + HG92611 } void CMailNewsFrame::OnUpdateSecureStatus(CCmdUI *pCmdUI) { - XP_Bool bSigned = FALSE; - XP_Bool bEncrypted = FALSE; - - MIME_GetMessageCryptoState(GetMainContext()->GetContext(), - 0, 0, - &bSigned, - &bEncrypted); - - if (m_bNews) { - int status = XP_GetSecurityStatus(GetMainContext()->GetContext()); - if (status == SSL_SECURITY_STATUS_ON_LOW || status == SSL_SECURITY_STATUS_ON_HIGH) - bEncrypted = TRUE; - } - - if (pCmdUI->m_nID == IDS_SECURITY_STATUS) - pCmdUI->Enable(bEncrypted); - else - pCmdUI->Enable(bSigned); + HG11173 } void CMailNewsFrame::SetCSID( int csid ) { @@ -2860,8 +3116,202 @@ void CMailNewsFrame::RefreshNewEncoding(int16 doc_csid, BOOL bSave ) } } -// CMsgListFrame +void CMailNewsFrame::OnToggleEncoding1() // Latin1 +{ + RefreshNewEncoding(CS_LATIN1); +} +void CMailNewsFrame::OnToggleEncoding2() // Latin2 +{ + RefreshNewEncoding(CS_LATIN2); +} + +void CMailNewsFrame::OnToggleEncoding3() // Japanese(Auto) +{ + RefreshNewEncoding(CS_SJIS_AUTO); +} + +void CMailNewsFrame::OnToggleEncoding4() // Japanese(ShiftJIS) +{ + RefreshNewEncoding(CS_SJIS); +} + +void CMailNewsFrame::OnToggleEncoding5() // Japanese(EUC) +{ + RefreshNewEncoding(CS_EUCJP); +} + +void CMailNewsFrame::OnToggleEncoding6() // Chinese(BIG5) +{ + RefreshNewEncoding(CS_BIG5); +} + +void CMailNewsFrame::OnToggleEncoding7() // Chinese (EUC) +{ + RefreshNewEncoding(CS_CNS_8BIT); +} + +void CMailNewsFrame::OnToggleEncoding8() // Simplified Chinese +{ + RefreshNewEncoding(CS_GB_8BIT); +} + +void CMailNewsFrame::OnToggleEncoding9() // Korean ( Auto ) +{ + RefreshNewEncoding(CS_KSC_8BIT | CS_AUTO); +} + +void CMailNewsFrame::OnToggleEncoding10() +{ + RefreshNewEncoding(CS_USER_DEFINED_ENCODING); +} + +void CMailNewsFrame::OnToggleEncoding11() +{ + RefreshNewEncoding(CS_CP_1250); +} + +void CMailNewsFrame::OnToggleEncoding12() +{ + RefreshNewEncoding(CS_CP_1251); +} + +void CMailNewsFrame::OnToggleEncoding13() +{ + RefreshNewEncoding(CS_8859_5); +} + +void CMailNewsFrame::OnToggleEncoding14() +{ + RefreshNewEncoding(CS_KOI8_R); +} + +void CMailNewsFrame::OnToggleEncoding15() +{ + RefreshNewEncoding(CS_8859_7); +} + +void CMailNewsFrame::OnToggleEncoding16() +{ + RefreshNewEncoding(CS_CP_1253); +} + +void CMailNewsFrame::OnToggleEncoding17() +{ + RefreshNewEncoding(CS_8859_9); +} + +void CMailNewsFrame::OnToggleEncoding18() +{ + RefreshNewEncoding(CS_UTF8); +} + +void CMailNewsFrame::OnToggleEncoding19() +{ + RefreshNewEncoding(CS_UCS2); +} + +void CMailNewsFrame::OnToggleEncoding20() +{ + RefreshNewEncoding(CS_UTF7); +} + +void CMailNewsFrame::OnUpdateEncoding(CCmdUI* pCmdUI) +{ + BOOL bCheck; + bCheck = FALSE; + switch (pCmdUI->m_nID) { + case ID_OPTIONS_ENCODING_1: // Western(Latin1) + if(m_iCSID == CS_LATIN1) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_2: // East European(latin2) + if(m_iCSID == CS_LATIN2) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_3: // Japanese(Auto) + if(m_iCSID == CS_SJIS_AUTO) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_4: // Japanese(ShiftJIS) + if(m_iCSID == CS_SJIS) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_5: // Japanese(EUC) + if(m_iCSID == CS_EUCJP) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_6: // Traditional Chinese(Big5) + if(m_iCSID == CS_BIG5) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_7: // Traditional Chinese(EUC) + if(m_iCSID == CS_CNS_8BIT) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_8: // Simplified Chinese + if(m_iCSID == CS_GB_8BIT) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_9: // Korean + if((m_iCSID & ~CS_AUTO) == CS_KSC_8BIT) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_10: // User defined + if(m_iCSID == CS_USER_DEFINED_ENCODING) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_11: // Windows Central European(latin2) + if(m_iCSID == CS_CP_1250) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_12: // Cyrillic (KOI8-R) + if(m_iCSID == CS_CP_1251) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_13: // Cyrillic (ISO8859-5) + if(m_iCSID == CS_8859_5) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_14: + if(m_iCSID == CS_KOI8_R) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_15: // Greek (8859_7) + if(m_iCSID == CS_8859_7) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_16: // Greek (cp1253) + if(m_iCSID == CS_CP_1253) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_17: // Turkish (8859_9) + if(m_iCSID == CS_8859_9) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_18: // Unicode (UTF8) + if(m_iCSID == CS_UTF8) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_19: // Unicode (UCS2) + if(m_iCSID == CS_UCS2 || m_iCSID == CS_UCS2_SWAP) + bCheck = TRUE; + break; + case ID_OPTIONS_ENCODING_20: // Unicode (UTF7) + if(m_iCSID == CS_UTF7) + bCheck = TRUE; + break; + default: // Illegal ID is wrong. + return; + } + + if (bCheck) + pCmdUI->SetCheck(TRUE); + else + pCmdUI->SetCheck(FALSE); +} + +// CMsgListFrame STDMETHODIMP CMsgListFrame::QueryInterface(REFIID refiid, LPVOID * ppv) { *ppv = NULL; diff --git a/mozilla/cmd/winfe/mailfrm.h b/mozilla/cmd/winfe/mailfrm.h index 16263c2044e..d1087fd6f64 100755 --- a/mozilla/cmd/winfe/mailfrm.h +++ b/mozilla/cmd/winfe/mailfrm.h @@ -179,6 +179,8 @@ public: void ActivateFrame( int nCmdShow = -1 ); virtual void RefreshNewEncoding(int16 doc_csid, BOOL bSave = TRUE); + static BOOL CleanupFolders(MSG_Pane *pPane); + protected: virtual void SetSort( int idSort ) {} @@ -191,11 +193,13 @@ protected: int m_iMessageMenuPos; int m_iMoveMenuPos; int m_iCopyMenuPos; + int m_iAddAddressBookMenuPos; int m_iFileMenuPos; int m_iAttachMenuPos; virtual void UpdateFileMenus(); + virtual void UpdateAddressBookMenus(); virtual void UpdateAttachmentMenus(); void ModalStatusBegin( int iModalDelay ); @@ -271,6 +275,8 @@ protected: afx_msg void OnUpdateSetupWizard( CCmdUI *pCmdUI ); afx_msg void OnServerStuff(); afx_msg void OnUpdateServerStuff( CCmdUI *pCmdUI ); + afx_msg void OnEditProperties(); + afx_msg void OnUpdateProperties( CCmdUI *pCmdUI ); // View/Sort Menu Items afx_msg void OnSortAgain (); @@ -329,6 +335,8 @@ protected: afx_msg void OnUpdatePrevious ( CCmdUI* pCmdUI ); afx_msg void OnNextUnread (); afx_msg void OnUpdateNextUnread ( CCmdUI* pCmdUI ); + afx_msg void OnFirstUnread(); + afx_msg void OnUpdateFirstUnread(CCmdUI *pCmdUI); afx_msg void OnNext(); afx_msg void OnUpdateNext ( CCmdUI* pCmdUI ); afx_msg void OnNextFolder(); @@ -359,6 +367,7 @@ protected: afx_msg void OnUpdateDeliverNow(CCmdUI*); afx_msg void OnReply (); afx_msg void OnUpdateReply ( CCmdUI* pCmdUI ); + afx_msg void OnReplyButton(); afx_msg void OnReplyAll (); afx_msg void OnUpdateReplyAll ( CCmdUI* pCmdUI ); afx_msg void OnPostNew (); @@ -369,10 +378,14 @@ protected: afx_msg void OnUpdatePostAndMail ( CCmdUI * pCmdUI ); afx_msg void OnPostReply (); afx_msg void OnUpdatePostReply ( CCmdUI* pCmdUI ); + afx_msg void OnForwardButton (); + afx_msg void OnUpdateForwardButton ( CCmdUI* pCmdUI ); afx_msg void OnForward (); afx_msg void OnUpdateForward ( CCmdUI* pCmdUI ); afx_msg void OnForwardQuoted (); afx_msg void OnUpdateForwardQuoted ( CCmdUI * pCmdUI ); + afx_msg void OnForwardInline (); + afx_msg void OnUpdateForwardInline ( CCmdUI * pCmdUI ); afx_msg void OnKill(); afx_msg void OnUpdateKill( CCmdUI *pCmdUI ); afx_msg void OnWatch(); @@ -415,11 +428,19 @@ protected: afx_msg void OnUpdateCompressAll ( CCmdUI* pCmdUI ); afx_msg void OnEmptyTrash (); afx_msg void OnUpdateEmptyTrash ( CCmdUI * pCmdUI ); + + //old address book afx_msg void OnAddToAddressBook (); afx_msg void OnUpdateAddToAddressBook ( CCmdUI * pCmdUI ); afx_msg void OnAddAllToAddressBook (); afx_msg void OnUpdateAddAllToAddressBook ( CCmdUI * pCmdUI ); + //new address book + afx_msg void OnUpdateAddSenderAddressBook(CCmdUI *pCmdUI); + afx_msg void OnUpdateAddAllAddressBook(CCmdUI *pCmdUI); + afx_msg void OnAddSenderAddressBook(UINT nID); + afx_msg void OnAddAllAddressBook(UINT nID); + // Stop afx_msg void OnInterrupt(); afx_msg void OnUpdateInterrupt( CCmdUI* pCmdUI ); @@ -440,7 +461,33 @@ protected: afx_msg void OnPriorityHighest(); afx_msg void OnUpdatePriority( CCmdUI *pCmdUI ); + afx_msg void OnToggleEncoding1(); + afx_msg void OnToggleEncoding2(); + afx_msg void OnToggleEncoding3(); + afx_msg void OnToggleEncoding4(); + afx_msg void OnToggleEncoding5(); + afx_msg void OnToggleEncoding6(); + afx_msg void OnToggleEncoding7(); + afx_msg void OnToggleEncoding8(); + afx_msg void OnToggleEncoding9(); + afx_msg void OnToggleEncoding10(); + afx_msg void OnToggleEncoding11(); + afx_msg void OnToggleEncoding12(); + afx_msg void OnToggleEncoding13(); + afx_msg void OnToggleEncoding14(); + afx_msg void OnToggleEncoding15(); + afx_msg void OnToggleEncoding16(); + afx_msg void OnToggleEncoding17(); + afx_msg void OnToggleEncoding18(); + afx_msg void OnToggleEncoding19(); + afx_msg void OnToggleEncoding20(); + afx_msg void OnUpdateEncoding(CCmdUI* pCmdUI); + DECLARE_MESSAGE_MAP() + + void OnUpdateAddAddressBook(CCmdUI *pCmdUI, MSG_CommandType command); + void OnAddAddressBook(UINT nID, MSG_CommandType command); + }; ///////////////////////////////////////////////////////////////////////////// @@ -479,6 +526,7 @@ protected: }; extern MSG_MessagePaneCallbacks MsgPaneCB; +extern int iMailFrameCount; ///////////////////////////////////////////////////////////////////////////// #endif diff --git a/mozilla/cmd/winfe/mailfrm2.cpp b/mozilla/cmd/winfe/mailfrm2.cpp index add8e99cf89..e94d253791a 100644 --- a/mozilla/cmd/winfe/mailfrm2.cpp +++ b/mozilla/cmd/winfe/mailfrm2.cpp @@ -24,6 +24,10 @@ #include "filter.h" #include "srchfrm.h" #include "mnwizard.h" +#include "prefs.h" +#include "dspppage.h" +#include "fldrfrm.h" +#include "thrdfrm.h" void CMailNewsFrame::OnSearch() { @@ -50,5 +54,161 @@ BOOL CMailNewsFrame::CheckWizard( CWnd *pParent ) return TRUE; } +void CMailNewsFrame::OnEditProperties() +{ + MSG_ViewIndex *indices = NULL; + int count = 0; + BOOL bNoPropertiesNeeded = FALSE; + MSG_FolderLine folderLine; + + CMailNewsOutliner* pOutliner; + MSG_Pane* pFolderPane; + if (IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) + { + pOutliner = ((C3PaneMailFrame*)this)->GetFolderOutliner(); + pFolderPane = ((C3PaneMailFrame*)this)->GetFolderPane(); + } + else + { + pOutliner = m_pOutliner; + pFolderPane = m_pPane; + } + + if (pOutliner) + pOutliner->GetSelection( indices, count ); + + if (indices && count) + { + MSG_FolderInfo *folderInfo = MSG_GetFolderInfo( pFolderPane, indices[0] ); + MSG_GetFolderLineByIndex( pFolderPane, indices[0], 1, &folderLine ); + + CString csTitle; + if (folderLine.flags & (MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_CATEGORY)) { + csTitle.LoadString(IDS_NEWSGROUPPROP); + } else if (folderLine.flags & MSG_FOLDER_FLAG_NEWS_HOST) { + csTitle.LoadString(IDS_NEWSHOSTPROP); + } else { + if (folderLine.level > 1) { + csTitle.LoadString(IDS_FOLDERPROP); + }else { + csTitle.LoadString(IDS_MAILSERVERPROP); + } + } + CNewsFolderPropertySheet FolderSheet( csTitle, this ); + //destructor handles clean up of added sheets + + //only make and add the pages if they selected a news group or category + if ( folderLine.flags & (MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_CATEGORY) ) + { + FolderSheet.m_pNewsFolderPage= new CNewsGeneralPropertyPage(&FolderSheet); + FolderSheet.m_pNewsFolderPage->SetFolderInfo( folderInfo, (MWContext*)GetContext() ); + + FolderSheet.m_pDownLoadPageNews = new CDownLoadPPNews(&FolderSheet); + FolderSheet.m_pDownLoadPageNews->SetFolderInfo(folderInfo); + + FolderSheet.m_pDiskSpacePage = new CDiskSpacePropertyPage(&FolderSheet); + FolderSheet.m_pDiskSpacePage->SetFolderInfo (folderInfo ); + + FolderSheet.AddPage(FolderSheet.m_pNewsFolderPage); + FolderSheet.AddPage(FolderSheet.m_pDownLoadPageNews); + FolderSheet.AddPage(FolderSheet.m_pDiskSpacePage); + } + else if ( folderLine.flags & MSG_FOLDER_FLAG_NEWS_HOST) + { + MSG_NewsHost *pNewsHost = MSG_GetNewsHostFromIndex (pFolderPane, indices[0]); + FolderSheet.m_pNewsHostPage= new CNewsHostGeneralPropertyPage; + FolderSheet.m_pNewsHostPage->SetFolderInfo( folderInfo,pNewsHost ); + FolderSheet.AddPage(FolderSheet.m_pNewsHostPage); + } + else if ( folderLine.level > 1) + { + FolderSheet.m_pFolderPage= new CFolderPropertyPage(&FolderSheet); + FolderSheet.m_pFolderPage->SetFolderInfo( folderInfo, pFolderPane ); + FolderSheet.AddPage(FolderSheet.m_pFolderPage); + //only add this page if it's an offline mail folder. + if (folderLine.flags & MSG_FOLDER_FLAG_IMAPBOX) + { + FolderSheet.m_pSharingPage= new CFolderSharingPage(&FolderSheet); + FolderSheet.m_pSharingPage->SetFolderInfo(folderInfo, + pFolderPane, (MWContext*)GetContext()); + FolderSheet.AddPage(FolderSheet.m_pSharingPage); + + FolderSheet.m_pDownLoadPageMail = new CDownLoadPPMail; + FolderSheet.m_pDownLoadPageMail->SetFolderInfo( folderInfo ); + FolderSheet.AddPage(FolderSheet.m_pDownLoadPageMail); + } + } + else + { + wfe_DisplayPreferences((CGenericFrame*)this); + bNoPropertiesNeeded = TRUE; + } + + if ( !bNoPropertiesNeeded) + { + if(FolderSheet.DoModal() == IDOK) + { + if(FolderSheet.DownLoadNow()) + { + new CProgressDialog(this, NULL,_ShutDownFrameCallBack, + folderInfo,szLoadString(IDS_DOWNLOADINGARTICLES)); + ;//DonwLoad!!!!!!! + } + else if (FolderSheet.CleanUpNow()) + { + MSG_Command (pFolderPane, MSG_CompressFolder, + indices, 1); + } + else if (FolderSheet.SynchronizeNow()) + ;//Synchronize!!!! + } + } + } +} + +void CMailNewsFrame::OnUpdateProperties( CCmdUI *pCmdUI ) +{ + MSG_ViewIndex *indices = NULL; + int count = 0; + MSG_FolderLine folderLine; + + if (pCmdUI) + { + CMailNewsOutliner* pOutliner; + MSG_Pane* pFolderPane; + if (IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) + { + pOutliner = ((C3PaneMailFrame*)this)->GetFolderOutliner(); + pFolderPane = ((C3PaneMailFrame*)this)->GetFolderPane(); + } + else + { + pOutliner = m_pOutliner; + pFolderPane = m_pPane; + } + pOutliner->GetSelection( indices, count ); + + if (indices && count) + { + MSG_FolderInfo *folderInfo = MSG_GetFolderInfo( pFolderPane, indices[0] ); + MSG_GetFolderLineByIndex( pFolderPane, indices[0], 1, &folderLine ); + + CString csTitle; + if (folderLine.flags & (MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_CATEGORY)) { + pCmdUI->SetText(szLoadString(IDS_POPUP_NEWSGROUPPROP)); + } else if (folderLine.flags & MSG_FOLDER_FLAG_NEWS_HOST) { + pCmdUI->SetText(szLoadString(IDS_POPUP_NEWSHOSTPROP)); + } else { + if (folderLine.level > 1) { + pCmdUI->SetText(szLoadString(IDS_POPUP_FOLDERPROP)); + }else { + pCmdUI->SetText(szLoadString(IDS_POPUP_MAILSERVERPROP)); + } + } + + } + pCmdUI->Enable( count == 1 ); + } +} diff --git a/mozilla/cmd/winfe/mailmisc.cpp b/mozilla/cmd/winfe/mailmisc.cpp index c01e410c8a7..56db0d3211f 100644 --- a/mozilla/cmd/winfe/mailmisc.cpp +++ b/mozilla/cmd/winfe/mailmisc.cpp @@ -32,6 +32,7 @@ #include "wfemsg.h" #include "intl_csi.h" #include "fegui.h" +#include "addrfrm.h" //for MOZ_NEWADDR #include "rdfglobal.h" #ifndef _AFXDLL @@ -47,6 +48,10 @@ IMPLEMENT_DYNCREATE(CFolderView, COutlinerView) extern "C" const char* FE_GetFolderDirectory(MWContext *pContext); +#ifdef _WIN32 +extern "C" BOOL UpdateMapiDll(void); +#endif + int WFE_MSGTranslateFolderIcon( uint8 level, int32 iFlags, BOOL bOpen ) { int folderTable[] = { IDX_MAILFOLDERCLOSED, IDX_MAILFOLDEROPEN, @@ -79,8 +84,14 @@ int WFE_MSGTranslateFolderIcon( uint8 level, int32 iFlags, BOOL bOpen ) IDX_TRASH, IDX_TRASHOPEN, IDX_TRASH, IDX_TRASHOPEN, // 40 - IDX_TEMPLATE, IDX_TEMPLATEOPEN, - IDX_TEMPLATE, IDX_TEMPLATEOPEN, + IDX_TEMPLATECLOSE, IDX_TEMPLATEOPEN, + IDX_TEMPLATECLOSE, IDX_TEMPLATEOPEN, + // 44 + IDX_SHARECLOSED, IDX_SHAREOPEN, + IDX_SHARECLOSED, IDX_SHAREOPEN, + // 48 + IDX_PUBLICCLOSED, IDX_PUBLICOPEN, + IDX_PUBLICCLOSED, IDX_PUBLICOPEN, }; int idx = 0; @@ -88,13 +99,16 @@ int WFE_MSGTranslateFolderIcon( uint8 level, int32 iFlags, BOOL bOpen ) if (iFlags & MSG_FOLDER_FLAG_NEWSGROUP) idx = 4; else if (level < 2) + { if (iFlags & MSG_FOLDER_FLAG_NEWS_HOST) idx = 16; else if (iFlags & MSG_FOLDER_FLAG_IMAPBOX) idx = 12; else idx = 8; + } else + { if (iFlags & MSG_FOLDER_FLAG_INBOX) idx = 20; else if (iFlags & MSG_FOLDER_FLAG_QUEUE) @@ -107,6 +121,13 @@ int WFE_MSGTranslateFolderIcon( uint8 level, int32 iFlags, BOOL bOpen ) idx = 28; else if (iFlags & MSG_FOLDER_FLAG_TEMPLATES ) idx = 40; + else if (iFlags & MSG_FOLDER_FLAG_PERSONAL_SHARED ) + idx = 44; + else if (iFlags & MSG_FOLDER_FLAG_IMAP_OTHER_USER ) + idx = 44; + else if (iFlags & MSG_FOLDER_FLAG_IMAP_PUBLIC ) + idx = 48; + } idx += bOpen ? 1 : 0; idx += iFlags & MSG_FOLDER_FLAG_GOT_NEW ? 2 : 0; @@ -114,7 +135,8 @@ int WFE_MSGTranslateFolderIcon( uint8 level, int32 iFlags, BOOL bOpen ) return folderTable[idx]; } -void WFE_MSGBuildMessagePopup( HMENU hmenu, BOOL bNews, BOOL bInHeaders ) + +void WFE_MSGBuildMessagePopup( HMENU hmenu, BOOL bNews, BOOL bInHeaders, MWContext *pContext ) { ::AppendMenu( hmenu, MF_STRING, ID_MESSAGE_REPLY, szLoadString( IDS_MENU_REPLY ) ); if ( bNews ) { @@ -125,12 +147,18 @@ void WFE_MSGBuildMessagePopup( HMENU hmenu, BOOL bNews, BOOL bInHeaders ) } ::AppendMenu( hmenu, MF_STRING, ID_MESSAGE_FORWARD, szLoadString( IDS_MENU_FORWARD ) ); ::AppendMenu( hmenu, MF_STRING, ID_MESSAGE_FORWARDQUOTED, szLoadString( IDS_MENU_FORWARDQUOTED ) ); + ::AppendMenu( hmenu, MF_STRING, ID_MESSAGE_FORWARDINLINE, szLoadString(IDS_MENU_FORWARDINLINE)); ::AppendMenu( hmenu, MF_SEPARATOR, 0, NULL ); +#ifdef MOZ_NEWADDR + WFE_MSGBuildAddAddressBookPopups(hmenu, ::GetMenuItemCount(hmenu), TRUE, pContext); + +#else HMENU hAddMenu = ::CreatePopupMenu(); ::AppendMenu( hAddMenu, MF_STRING, ID_MESSAGE_ADDSENDER, szLoadString( IDS_POPUP_ADDSENDER ) ); ::AppendMenu( hAddMenu, MF_STRING, ID_MESSAGE_ADDALL, szLoadString( IDS_POPUP_ADDALL ) ); ::AppendMenu( hmenu, MF_STRING|MF_POPUP, (UINT) hAddMenu, szLoadString( IDS_POPUP_ADDTOADDRESSBOOK ) ); +#endif ::AppendMenu( hmenu, MF_SEPARATOR, 0, NULL ); if (bInHeaders) { @@ -231,19 +259,33 @@ void WFE_MSGInit() void WFE_MSGShutdown() { - MSG_DestroyMaster(WFE_MSGGetMaster()); - MSG_ShutdownMsgLib(); - g_MsgPrefs.Shutdown(); + // Don't do anything if we never called WFE_MSGInit + if (g_MsgPrefs.m_bInitialized) + { + MSG_DestroyMaster(WFE_MSGGetMaster()); + MSG_ShutdownMsgLib(); + g_MsgPrefs.Shutdown(); + } } +// returns the master. If there isn't one then it +// creates one. MSG_Master* WFE_MSGGetMaster() { return g_MsgPrefs.GetMaster(); } +// returns the current value of the master. +MSG_Master* WFE_MSGGetMasterValue() +{ + return g_MsgPrefs.GetMasterValue(); + +} + CMsgPrefs::CMsgPrefs() { m_pMaster = NULL; + m_bInitialized = FALSE; } PR_CALLBACK cbMsgPrefs(const char *prefName, void *pData) @@ -331,7 +373,16 @@ PR_CALLBACK cbMsgPrefs(const char *prefName, void *pData) f->PostMessage(WM_COMMAND, (WPARAM) ID_DONEGOINGOFFLINE, (LPARAM) 0); } break; - + case 13: +#ifdef _WIN32 + UpdateMapiDll(); +#endif + break; + case 14: + bPref= TRUE; + PREF_GetBoolPref("ldap_1.autoComplete.showDialogForMultipleMatches", &bPref); + g_MsgPrefs.m_bShowCompletionPicker = bPref; + break; default: ASSERT(0); } @@ -343,6 +394,8 @@ PR_CALLBACK cbMsgPrefs(const char *prefName, void *pData) void CMsgPrefs::Init() { + m_bInitialized = TRUE; + m_pFolderTemplate = new CFolderTemplate(IDR_MAILFRAME, RUNTIME_CLASS(CNetscapeDoc), RUNTIME_CLASS(CFolderFrame), // mail window @@ -474,6 +527,10 @@ void CMsgPrefs::Init() PREF_GetBoolPref("mailnews.message_in_thread_window", &prefBool); m_bThreadPaneMaxed = !prefBool; + prefBool = TRUE; + PREF_GetBoolPref("ldap_1.autoComplete.showDialogForMultipleMatches", &prefBool); + m_bShowCompletionPicker = prefBool; + PREF_RegisterCallback("mailnews.reuse_thread_window", cbMsgPrefs, (void *) 0); PREF_RegisterCallback("mailnews.reuse_message_window", cbMsgPrefs, (void *) 1); PREF_RegisterCallback("mailnews.message_in_thread_window", cbMsgPrefs, (void *) 2); @@ -488,6 +545,9 @@ void CMsgPrefs::Init() PREF_RegisterCallback("mail.signature_file", cbMsgPrefs, (void *) 10); PREF_RegisterCallback("mail.leave_on_server", cbMsgPrefs, (void *) 11); PREF_RegisterCallback("network.online", cbMsgPrefs, (void *) 12); + PREF_RegisterCallback("mail.use_mapi_server", cbMsgPrefs, (void *) 13); + //autocomplete + PREF_RegisterCallback("ldap_1.autoComplete.showDialogForMultipleMatches", cbMsgPrefs, (void*) 14); // START THE BIFF CONTEXT CBiffCX *pCX = new CBiffCX(); @@ -511,15 +571,29 @@ BOOL CMsgPrefs::IsValid() const int nLen = 255; buffer[0] = '\0'; - if (PREF_NOERROR == PREF_GetCharPref("mail.pop_name", buffer, &nLen)) - { - if (strlen(buffer) && !m_csMailHost.IsEmpty()) + + long prefLong = MSG_Pop3; + PREF_GetIntPref("mail.server_type",&prefLong); + if (prefLong == MSG_Imap4 && + PREF_NOERROR == PREF_GetCharPref("network.hosts.imap_servers", buffer, &nLen)) + { + if (strlen(buffer)) return TRUE; else return FALSE; } else - return FALSE; + { + if (PREF_NOERROR == PREF_GetCharPref("mail.pop_name", buffer, &nLen)) + { + if (strlen(buffer) && !m_csMailHost.IsEmpty()) + return TRUE; + else + return FALSE; + } + else + return FALSE; + } } MSG_Master *CMsgPrefs::GetMaster() @@ -536,6 +610,11 @@ MSG_Master *CMsgPrefs::GetMaster() return m_pMaster; } +MSG_Master *CMsgPrefs::GetMasterValue() +{ + return m_pMaster; +} + ////////////////////////////////////////////////////////////////////////////// // CMailNewsOutliner @@ -546,6 +625,7 @@ CMailNewsOutliner::CMailNewsOutliner() m_bExpandOrCollapse = FALSE; m_pPane = NULL; m_iMysticPlane = 0; + m_nCurrentSelected = -1; } CMailNewsOutliner::~CMailNewsOutliner() @@ -657,6 +737,8 @@ int CMailNewsOutliner::ToggleExpansion( int iLine ) MSG_ToggleExpansion( m_pPane, iLine, &numChanged ); m_bExpandOrCollapse = FALSE; + m_iLastSelected = m_iSelection; + return (int) numChanged; } @@ -758,10 +840,9 @@ CFolderOutliner::CFolderOutliner ( ) m_uTimer = 0; m_dwPrevTime = 0; - m_bLButtonDown = FALSE; m_bDoubleClicked = FALSE; m_b3PaneParent = FALSE; - m_nCurrentSelected = -1; + m_bRButtonDown = FALSE; } CFolderOutliner::~CFolderOutliner ( ) @@ -1127,14 +1208,10 @@ void CFolderOutliner::AcceptDrop( int iLineNo, COleDataObject *pDataObject, pDragData->m_count, pFolder); if (IsParent3PaneFrame()) { - C3PaneMailFrame* pFrame = C3PaneMailFrame::FindFrame(pFolder);; + C3PaneMailFrame* pFrame = C3PaneMailFrame::FindFrame(pFolder); if (pFrame) pFrame->ActivateFrame(); -#if 0 // this interrupts the move - why are we doing it? - else - GetParentFrame()->SendMessage(WM_COMMAND, - ID_FOLDER_SELECT, 0); -#endif + ((C3PaneMailFrame*)GetParentFrame())->BlockFolderSelection (TRUE); } } GlobalUnlock (hContent); //do we have to GlobalFree it too? @@ -1303,12 +1380,6 @@ void CFolderOutliner::OnDestroy() CMailNewsOutliner::OnDestroy(); } -void CFolderOutliner::OnLButtonDown(UINT nFlags, CPoint point) -{ - m_bLButtonDown = TRUE; - CMailNewsOutliner::OnLButtonDown(nFlags, point); -} - void CFolderOutliner::OnTimer(UINT nIDEvent) { if (m_uTimer == nIDEvent) @@ -1325,12 +1396,9 @@ void CFolderOutliner::OnTimer(UINT nIDEvent) if (delta > GetDoubleClickTime()) { // single click m_bSelChanged = FALSE; - if (GetCurrentSelected() != m_iSelection) - { - if (!m_iSelBlock) - GetParentFrame()->SendMessage(WM_COMMAND, - ID_FOLDER_SELECT, 0); - } + if (!m_iSelBlock) + GetParentFrame()->SendMessage(WM_COMMAND, + ID_FOLDER_SELECT, 0); KillTimer(m_uTimer); m_uTimer = 0; } @@ -1345,8 +1413,14 @@ void CFolderOutliner::OnSelChanged() { if (IsParent3PaneFrame()) { + if (m_bRButtonDown) + { + ((C3PaneMailFrame*)GetParentFrame())->BlankOutRightPanes(); + return; + } SetCurrentSelected(m_iLastSelected); - if (m_uTimer == 0 && m_bLButtonDown && !m_bDoubleClicked) + BOOL bControlKeydown = ((GetKeyState(VK_CONTROL) & 0x8000) && m_bLButtonDown); + if (!bControlKeydown && m_bLButtonDown && m_uTimer == 0 && !m_bDoubleClicked) { m_dwPrevTime = GetTickCount(); UINT uElapse = GetDoubleClickTime() / 5; @@ -1361,7 +1435,8 @@ void CFolderOutliner::OnSelChanged() void CFolderOutliner::OnSelDblClk() { - m_bDoubleClicked = TRUE; + if (m_bLButtonDown && m_uTimer != 0) + m_bDoubleClicked = TRUE; MSG_FolderLine folderLine; if (MSG_GetFolderLineByIndex(m_pPane, m_iFocus, 1, &folderLine)) { @@ -1447,11 +1522,36 @@ LPCTSTR CFolderOutliner::GetColumnTip( UINT iColumn, void * pLineData ) return NULL; } +void CFolderOutliner::OnSetFocus(CWnd* pOldWnd) +{ + C3PaneMailFrame* pParent = (C3PaneMailFrame*)GetParentFrame(); + CMailNewsOutliner::OnSetFocus(pOldWnd); + if (IsParent3PaneFrame()) + pParent->SetFocusWindow(this); +} + +void CFolderOutliner::OnRButtonDown (UINT nFlags, CPoint point) +{ + m_bRButtonDown = TRUE; + CMailNewsOutliner::OnRButtonDown (nFlags, point); +} + +void CFolderOutliner::OnRButtonUp(UINT nFlags, CPoint point) +{ + CMailNewsOutliner::OnRButtonUp(nFlags, point); + m_bRButtonDown = FALSE; + + if (IsParent3PaneFrame()) + ((C3PaneMailFrame*)GetParentFrame())->CheckForChangeFocus(); +} + BEGIN_MESSAGE_MAP(CFolderOutliner, CMailNewsOutliner) ON_WM_CREATE() - ON_WM_LBUTTONDOWN() ON_WM_TIMER() + ON_WM_SETFOCUS() ON_WM_DESTROY() + ON_WM_RBUTTONDOWN() + ON_WM_RBUTTONUP() END_MESSAGE_MAP() ////////////////////////////////////////////////////////////////////////////// @@ -1467,9 +1567,7 @@ CMessageOutliner::CMessageOutliner ( ) m_uTimer = 0; m_dwPrevTime = 0; - m_bLButtonDown = FALSE; m_bDoubleClicked = FALSE; - m_nCurrentSelected = -1; m_pUnkUserImage = NULL; ApiApiPtr(api); @@ -1625,26 +1723,32 @@ BOOL CMessageOutliner::IsCollapsed( int iLine ) return messageLine.flags & MSG_FLAG_ELIDED ? TRUE : FALSE; } +void CMessageOutliner::SelectAllMessages() +{ + for (int i = GetTotalLines() - 1; i >= 0; i--) + Expand(i); +} + int CMessageOutliner::ExpandAll( int iLine ) { - int iDelta = 0; - for (int i = GetTotalLines() - 1; i >= 0; i--) { - iDelta += Expand(i); - } + MSG_ViewIndex viewIndex = (MSG_ViewIndex) iLine; + int32 numLines = GetTotalLines(); + + MSG_Command(m_pPane, MSG_ExpandAll, &viewIndex, 1); ScrollIntoView(m_iFocus); - return iDelta; + return GetTotalLines() - numLines; } int CMessageOutliner::CollapseAll( int iLine ) { - int iDelta = 0; - for (int i = 0; i < GetTotalLines(); i++) { - iDelta += Collapse(i); - } + MSG_ViewIndex viewIndex = (MSG_ViewIndex) iLine; + int32 numLines = GetTotalLines(); + + MSG_Command(m_pPane, MSG_CollapseAll, &viewIndex, 1); ScrollIntoView(m_iFocus); - return iDelta; + return numLines - GetTotalLines(); } void CMessageOutliner::SelectThread( int iLine, UINT flags ) @@ -1770,7 +1874,7 @@ void CMessageOutliner::PropertyMenu ( int iSel, UINT flags ) } ::AppendMenu( hmenu, MF_SEPARATOR, 0, NULL ); // - WFE_MSGBuildMessagePopup( hmenu, m_bNews, TRUE ); + WFE_MSGBuildMessagePopup( hmenu, m_bNews, TRUE, MSG_GetContext(m_pPane) ); } // Track the popup now. @@ -1896,8 +2000,7 @@ void CMessageOutliner::AcceptDrop( int iLineNo, COleDataObject *pDataObject, pInterface->CopyMessagesInto( pDragData->m_pane, pDragData->m_indices, pDragData->m_count, pFolder); break; - default: - ASSERT(0); + default: //do nothing break; } } @@ -2005,6 +2108,8 @@ int CMessageOutliner::TranslateIcon (void * pData) if (pMessage->flags & MSG_FLAG_IMAP_DELETED) return IDX_IMAPMSGDELETED; + if (pMessage->flags & MSG_FLAG_ATTACHMENT) + return IDX_ATTACHMENTMAIL; int idx = 0; @@ -2051,6 +2156,7 @@ BOOL CMessageOutliner::ColumnCommand ( int iColumn, int iLine ) case ID_COLUMN_THREAD: if ( MSG_GetToggleStatus( m_pPane, MSG_SortByThread, NULL, 0) == MSG_Checked ) { SelectThread( iLine ); + SetCapture();//~~~ return TRUE; } else { return FALSE; @@ -2269,12 +2375,6 @@ void CMessageOutliner::OnDestroy() CMailNewsOutliner::OnDestroy(); } -void CMessageOutliner::OnLButtonDown(UINT nFlags, CPoint point) -{ - m_bLButtonDown = TRUE; - CMailNewsOutliner::OnLButtonDown(nFlags, point); -} - void CMessageOutliner::OnTimer(UINT nIDEvent) { if (m_uTimer == nIDEvent) @@ -2308,20 +2408,31 @@ void CMessageOutliner::OnTimer(UINT nIDEvent) void CMessageOutliner::OnSelChanged() { - SetCurrentSelected(m_iLastSelected); - if (m_bLButtonDown && m_uTimer == 0 && !m_bDoubleClicked) + if (((C3PaneMailFrame*)GetParentFrame())->MessageViewClosed()) { - m_dwPrevTime = GetTickCount(); - UINT uElapse = GetDoubleClickTime() / 5; - m_uTimer = SetTimer(DOUBLE_CLICK_TIMER, uElapse, NULL); + m_bSelChanged = FALSE; + if (!m_iSelBlock) + GetParentFrame()->PostMessage(WM_COMMAND, ID_MESSAGE_SELECT, 0); } else { - if (!m_bDoubleClicked) + BOOL bControlKeydown = ((GetKeyState(VK_CONTROL) & 0x8000) && m_bLButtonDown); + if (!bControlKeydown) + SetCurrentSelected(m_iLastSelected); + if (!bControlKeydown && m_bLButtonDown && m_uTimer == 0 && !m_bDoubleClicked) { - m_bSelChanged = FALSE; - if (!m_iSelBlock) - GetParentFrame()->PostMessage(WM_COMMAND, ID_MESSAGE_SELECT, 0); + m_dwPrevTime = GetTickCount(); + UINT uElapse = GetDoubleClickTime() / 5; + m_uTimer = SetTimer(DOUBLE_CLICK_TIMER, uElapse, NULL); + } + else + { + if (!m_bDoubleClicked) + { + m_bSelChanged = FALSE; + if (!m_iSelBlock) + GetParentFrame()->PostMessage(WM_COMMAND, ID_MESSAGE_SELECT, 0); + } } } } @@ -2334,9 +2445,16 @@ void CMessageOutliner::OnSelDblClk() GetParentFrame()->PostMessage(WM_COMMAND, ID_FILE_OPENMESSAGE, 0); } +void CMessageOutliner::OnSetFocus(CWnd* pOldWnd) +{ + C3PaneMailFrame* pParent = (C3PaneMailFrame*)GetParentFrame(); + CMailNewsOutliner::OnSetFocus(pOldWnd); + pParent->SetFocusWindow(this); +} + BEGIN_MESSAGE_MAP(CMessageOutliner, CMailNewsOutliner) - ON_WM_LBUTTONDOWN() ON_WM_TIMER() + ON_WM_SETFOCUS() ON_WM_DESTROY() END_MESSAGE_MAP() diff --git a/mozilla/cmd/winfe/mailmisc.h b/mozilla/cmd/winfe/mailmisc.h index 84e4a3eac12..560ca40ffee 100644 --- a/mozilla/cmd/winfe/mailmisc.h +++ b/mozilla/cmd/winfe/mailmisc.h @@ -93,8 +93,14 @@ #define IDX_MAILREADOFFLINE 53 #define IDX_MAILMSGOFFLINE 54 #define IDX_IMAPMSGDELETED 55 -#define IDX_TEMPLATE 56 +#define IDX_TEMPLATECLOSE 56 #define IDX_TEMPLATEOPEN 57 +#define IDX_TEMPLAT 58 +#define IDX_SHARECLOSED 59 +#define IDX_SHAREOPEN 60 +#define IDX_PUBLICCLOSED 61 +#define IDX_PUBLICOPEN 62 +#define IDX_ATTACHMENTMAIL 63 // array of indexes for IDB_MAILCOL #define IDX_THREAD 0 @@ -108,7 +114,8 @@ #define NETSCAPE_SEARCH_FORMAT "Netscape Search" int WFE_MSGTranslateFolderIcon( uint8 level, int32 iFlags, BOOL bOpen ); -void WFE_MSGBuildMessagePopup( HMENU hmenu, BOOL bNews, BOOL bInHeaders = FALSE ); +void WFE_MSGBuildMessagePopup( HMENU hmenu, BOOL bNews, BOOL bInHeaders = FALSE , + MWContext *pContext = NULL); /////////////////////////////////////////////////////////////////////// // CMessagePrefs @@ -126,6 +133,7 @@ public: BOOL IsValid() const; MSG_Master *GetMaster(); + MSG_Master *GetMasterValue(); CGenericDocTemplate *m_pFolderTemplate; CGenericDocTemplate *m_pThreadTemplate; @@ -146,9 +154,11 @@ public: CString m_csUsersOrganization; LPSTR m_pszUserSig; + BOOL m_bInitialized; BOOL m_bThreadPaneMaxed; BOOL m_bMessageReuse; BOOL m_bThreadReuse; + BOOL m_bShowCompletionPicker; }; extern CMsgPrefs g_MsgPrefs; @@ -170,6 +180,7 @@ protected: BOOL m_bSelChanged; int m_iSelBlock; BOOL m_bExpandOrCollapse; + int m_nCurrentSelected; public: CMailNewsOutliner(); @@ -177,6 +188,8 @@ public: virtual void SetPane( MSG_Pane *pane ); MSG_Pane *GetPane() { return m_pPane; } + void SetCurrentSelected(int nIndex) { m_nCurrentSelected = nIndex; } + int GetCurrentSelected() { return m_nCurrentSelected; } virtual void MysticStuffStarting( XP_Bool asynchronous, MSG_NOTIFY_CODE notify, @@ -218,10 +231,9 @@ protected: DWORD m_dwPrevTime; UINT m_uTimer; - BOOL m_bLButtonDown; BOOL m_bDoubleClicked; BOOL m_b3PaneParent; - int m_nCurrentSelected; + BOOL m_bRButtonDown; MSG_FolderInfo **m_pMysticStuff; MSG_FolderInfo *m_MysticFocus; @@ -232,8 +244,6 @@ public: ~CFolderOutliner ( ); BOOL IsParent3PaneFrame() { return m_b3PaneParent; } - void SetCurrentSelected(int nIndex) { m_nCurrentSelected = nIndex; } - int GetCurrentSelected() { return m_nCurrentSelected; } virtual void MysticStuffStarting( XP_Bool asynchronous, MSG_NOTIFY_CODE notify, @@ -278,9 +288,11 @@ protected: virtual void AcceptDrop(int iLineNo, COleDataObject *object, DROPEFFECT effect); afx_msg int OnCreate(LPCREATESTRUCT lpcs); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnSetFocus(CWnd* pOldWnd); afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnDestroy(); + afx_msg void OnRButtonDown( UINT nFlags, CPoint pt ); + afx_msg void OnRButtonUp( UINT nFlags, CPoint pt ); DECLARE_MESSAGE_MAP() }; @@ -301,9 +313,7 @@ protected: BOOL m_bNews, m_bDrafts; UINT m_uTimer; - BOOL m_bLButtonDown; BOOL m_bDoubleClicked; - int m_nCurrentSelected; DWORD m_dwPrevTime; public: @@ -319,9 +329,6 @@ public: MSG_ViewIndex where, int32 num); - void SetCurrentSelected(int nIndex) { m_nCurrentSelected = nIndex; } - int GetCurrentSelected() { return m_nCurrentSelected; } - void SelectThread( int iLine, UINT flags = 0 ); void SelectFlagged(); @@ -330,6 +337,8 @@ public: void EnsureFlagsVisible(); + void SelectAllMessages(); + protected: virtual void OnSelChanged(); virtual void OnSelDblClk(); @@ -371,8 +380,8 @@ protected: virtual DROPEFFECT DropSelect( int iLineNo, COleDataObject *object ); virtual void AcceptDrop( int iLineNo, COleDataObject *object, DROPEFFECT effect ); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnTimer(UINT nIDEvent); + afx_msg void OnSetFocus(CWnd* pOldWnd); afx_msg void OnDestroy(); DECLARE_MESSAGE_MAP() }; @@ -529,6 +538,32 @@ public: } }; +///////////////////////////////////////////////////////////////////////////// +// CMiscFolderCombo + +class CMiscFolderCombo: public CMailFolderCombo { + +protected: + + virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct ) + { + DoDrawItem( m_hWnd, lpDrawItemStruct ); + } + + virtual void MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct ) + { + DoMeasureItem( m_hWnd, lpMeasureItemStruct ); + } + +public: + CMiscFolderCombo(): CMailFolderCombo() {} + + virtual int Populate( MSG_Master *pMaster, MSG_FolderInfo *folderInfo ) + { + return CMailFolderCombo::Populate( pMaster, folderInfo ); + } +}; + class CMailNewsFrame; class IMailFrame: public IUnknown diff --git a/mozilla/cmd/winfe/mailpriv.cpp b/mozilla/cmd/winfe/mailpriv.cpp index 984b6b5bc8b..4eaf6fd3bf5 100644 --- a/mozilla/cmd/winfe/mailpriv.cpp +++ b/mozilla/cmd/winfe/mailpriv.cpp @@ -17,6 +17,8 @@ */ #include "stdafx.h" + +#include "rosetta.h" #include "msgcom.h" #include "wfemsg.h" #include "dspppage.h" @@ -24,6 +26,8 @@ #include "nethelp.h" #include "xp_help.h" #include "prefapi.h" +#include "mailfrm.h" +#include "thrdfrm.h" #ifndef _AFXDLL #undef new @@ -81,7 +85,8 @@ BOOL CFolderPropertyPage::OnInitDialog() char buff[50]; CWnd *widget = NULL; - if ( MSG_GetFolderLineById( WFE_MSGGetMaster(), m_folderInfo, &folderLine ) ) { + if ( MSG_GetFolderLineById( WFE_MSGGetMaster(), m_folderInfo, &folderLine ) ) + { widget = GetDlgItem( IDC_EDIT1 ); if(widget) widget->SetWindowText( folderLine.prettyName != NULL ? folderLine.prettyName : folderLine.name ); @@ -89,14 +94,28 @@ BOOL CFolderPropertyPage::OnInitDialog() int nLen = 49; - if ( PREF_NOERROR == PREF_GetCharPref("network.hosts.pop_server",buff,&nLen) ) + MSG_FolderInfo* pHostFolderInfo = GetHostFolderInfo(m_folderInfo); + if (pHostFolderInfo) + { + MSG_FolderLine hostFolderLine; + if ( MSG_GetFolderLineById( WFE_MSGGetMaster(), pHostFolderInfo, &hostFolderLine ) ) + SetDlgItemText(IDC_MAIL_SERVER_NAME, + hostFolderLine.prettyName != NULL ? hostFolderLine.prettyName : hostFolderLine.name ); + } + else if ( PREF_NOERROR == PREF_GetCharPref("network.hosts.pop_server",buff,&nLen) ) SetDlgItemText(IDC_MAIL_SERVER_NAME,buff); - + char* pFolderType = MSG_GetFolderTypeName(m_folderInfo); + if (pFolderType) + { + SetDlgItemText(IDC_STATIC_TYPE, pFolderType); + XP_FREE(pFolderType); + } + widget = GetDlgItem(IDC_STATIC_UNREAD); if (widget) { - if (folderLine.unseen > 0) + if (folderLine.unseen >= 0) widget->SetWindowText(itoa(folderLine.unseen, buff, 10)); } @@ -105,21 +124,16 @@ BOOL CFolderPropertyPage::OnInitDialog() widget->SetWindowText(itoa(folderLine.total, buff, 10)); int32 nSpaceUsed = MSG_GetFolderSizeOnDisk (m_folderInfo); - int nSpaceWasted = 0; - - if (folderLine.deletedBytes != 0 && (nSpaceUsed != 0))//never divide by zero - nSpaceWasted = (int)(100 *((double)(folderLine.deletedBytes)/(double)nSpaceUsed) ); - else - nSpaceWasted = 0; - - //never calculate more than a 100% - nSpaceWasted = nSpaceWasted > 100 ? 100 : nSpaceWasted; + int nSpaceWasted = folderLine.deletedBytes; widget = GetDlgItem(IDC_PERCENT_WASTED); if (widget) { - CString strSpaceWasted = itoa(nSpaceWasted, buff, 10) + (CString)"%"; - widget->SetWindowText(strSpaceWasted); + char buff[30]; + //convert bytes to Kilobytes and display in floating point format with + //up to 2 pricision points + sprintf(buff,"%.2f kbytes",(float)nSpaceWasted/1000/1000); + widget->SetWindowText(buff); } widget = GetDlgItem(IDC_USED_SPACE); @@ -134,6 +148,15 @@ BOOL CFolderPropertyPage::OnInitDialog() if (folderLine.flags & MSG_FOLDER_FLAG_IMAPBOX) { + if (folderLine.flags & MSG_FOLDER_FLAG_IMAP_PERSONAL) + SetDlgItemText(IDC_STATIC_TYPE, "Personal Folder"); + else if(folderLine.flags & MSG_FOLDER_FLAG_IMAP_PUBLIC) + SetDlgItemText(IDC_STATIC_TYPE, "Public Folder"); + else if(folderLine.flags & MSG_FOLDER_FLAG_PERSONAL_SHARED) + SetDlgItemText(IDC_STATIC_TYPE, "Shared Folder"); + else if(folderLine.flags & MSG_FOLDER_FLAG_IMAP_OTHER_USER) + SetDlgItemText(IDC_STATIC_TYPE, "Other User's Folder"); + if (widget = GetDlgItem(IDC_BUTTON1)) widget->ShowWindow(SW_HIDE); } @@ -151,6 +174,87 @@ void CFolderPropertyPage::OnOK() MSG_RenameMailFolder (m_pPane,m_folderInfo,m_strFolderName); } +//Mail folder property page +CFolderSharingPage::CFolderSharingPage(CWnd *pWnd): + CNetscapePropertyPage( CFolderSharingPage::IDD, 0 ) +{ + m_pParent = (CNewsFolderPropertySheet*)pWnd; + m_pContext = NULL; +} + +void CFolderSharingPage::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CDiskSpacePropertyPage) + //}}AFX_DATA_MAP +} + +BOOL CFolderSharingPage::OnInitDialog() +{ + BOOL ret = CNetscapePropertyPage::OnInitDialog(); + + char* pFolderType = MSG_GetFolderTypeName(m_folderInfo); + if (pFolderType) + { + SetDlgItemText(IDC_STATIC_TYPE, pFolderType); + XP_FREE(pFolderType); + } + + char* pFolderDesc = MSG_GetFolderTypeDescription(m_folderInfo); + if (pFolderDesc) + { + SetDlgItemText(IDC_STATIC_DESCRIPTION, pFolderDesc); + XP_FREE(pFolderDesc); + } + + MSG_IMAPHost* pHost = MSG_GetIMAPHostFromMSGHost( + MSG_GetHostForFolder(m_folderInfo)); + if (MSG_GetHostSupportsSharing(pHost)) + { + char* pRighrts = MSG_GetACLRightsStringForFolder(m_folderInfo); + if (pRighrts) + { + SetDlgItemText(IDC_STATIC_ACLRIGHTS, pRighrts); + XP_FREE(pRighrts); + } + GetDlgItem(IDC_PRIVILEGES)->EnableWindow( + MSG_HaveAdminUrlForFolder(m_folderInfo, MSG_AdminFolder)); + } + else + { + SetDlgItemText(IDC_STATIC2, szLoadString(IDS_NO_ACLSHARING)); + GetDlgItem(IDC_STATIC_ACLRIGHTS)->ShowWindow(SW_HIDE); + GetDlgItem(IDC_STATIC4)->ShowWindow(SW_HIDE); + GetDlgItem(IDC_STATIC5)->ShowWindow(SW_HIDE); + GetDlgItem(IDC_PRIVILEGES)->ShowWindow(SW_HIDE); + } + return ret; +} + +void CFolderSharingPage::OnOK() +{ + CNetscapePropertyPage::OnOK(); +} + +void CFolderSharingPage::SetFolderInfo +(MSG_FolderInfo *folderInfo, MSG_Pane *pPane, MWContext *pContext) +{ + m_folderInfo = folderInfo; + m_pPane = pPane; + m_pContext = pContext; +} + +void CFolderSharingPage::OnClickPrivileges() +{ + MSG_GetAdminUrlForFolder(m_pContext, m_folderInfo, MSG_AdminFolder); +} + +BEGIN_MESSAGE_MAP(CFolderSharingPage, CPropertyPage) + //{{AFX_MSG_MAP(CFolderSharingPage) + ON_BN_CLICKED(IDC_PRIVILEGES, OnClickPrivileges) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + /////////////////////////////////////////////////////////////////////////////////////////// //CNewsGeneralPropertyPage //The general news property page @@ -293,18 +397,7 @@ BOOL CNewsHostGeneralPropertyPage::OnInitDialog() int32 nPort = MSG_GetNewsHostPort(m_pNewsHost); if (widget) widget->SetWindowText(itoa(nPort,buffer,10)); - //set the security type - widget = GetDlgItem( IDC_SECURITY_TYPE ); - if ( MSG_IsNewsHostSecure(m_pNewsHost)) - { - strItemText.LoadString(IDS_IS_ENCRYPTED); - } - else - { - strItemText.LoadString(IDS_NOT_ENCRYPTED); - } - if (widget) - widget->SetWindowText(strItemText); + HG21215 //set the authentication type. //We are transposing values here because the radio buttons are in reverse @@ -332,6 +425,7 @@ CNewsFolderPropertySheet::CNewsFolderPropertySheet(LPCTSTR pszCaption, CWnd *pPa : CNetscapePropertySheet(pszCaption, pParent) { m_pFolderPage=NULL; + m_pSharingPage=NULL; m_pNewsFolderPage=NULL; m_pDiskSpacePage=NULL; m_pDownLoadPageMail=NULL; @@ -348,6 +442,8 @@ CNewsFolderPropertySheet::~CNewsFolderPropertySheet() { if (m_pFolderPage) delete m_pFolderPage; + if (m_pSharingPage) + delete m_pSharingPage; if (m_pNewsFolderPage) delete m_pNewsFolderPage; if (m_pDiskSpacePage) @@ -365,8 +461,11 @@ void CNewsFolderPropertySheet::OnHelp() if ((GetActivePage() == m_pFolderPage)) NetHelp(HELP_MAIL_FOLDER_PROPS_GENERAL); + else if (GetActivePage() == m_pSharingPage) + NetHelp(HELP_MAIL_FOLDER_PROPERTIES_SHARING); + else if (GetActivePage() == m_pDownLoadPageMail) - NetHelp(HELP_MAIL_FOLDER_PROPS_GENERAL); + NetHelp(HELP_MAIL_FOLDER_PROPERTIES_DOWNLOAD); else if (GetActivePage() == m_pNewsFolderPage ) NetHelp(HELP_NEWS_DISCUSION_GENERAL); @@ -379,6 +478,7 @@ void CNewsFolderPropertySheet::OnHelp() else if (GetActivePage() == m_pDownLoadPageNews) NetHelp(HELP_NEWS_DISCUSION_DOWNLOAD); + } void CNewsFolderPropertySheet::OnDownLoadButton() @@ -590,7 +690,7 @@ void CThreadStatusBar::OnPaint() CProgressDialog::CProgressDialog( CWnd *pParent, MSG_Pane *parentPane, PROGRESSCALLBACK callback, void * closure, char * pszTitle, - PROGRESSCALLBACK cbDone): + PROGRESSCALLBACK cbDone, SHOWPROGRESSCALLBACK showCallback): CStubsCX( MailCX, MWContextMailNewsProgress ) { m_pszTitle = pszTitle ? XP_STRDUP(pszTitle) : NULL; @@ -600,12 +700,43 @@ CProgressDialog::CProgressDialog( CWnd *pParent, MSG_Pane *parentPane, m_pParent = pParent; m_cbDone = cbDone; m_closure = closure; - MSG_SetFEData( m_pPane, (LPVOID) (LPUNKNOWN) (LPMAILFRAME) this ); + m_uTimerId = 0; + m_uProgressPos = 0; + m_bProgressShown = FALSE; + if(showCallback) + { + if(!(*showCallback)(m_pParent ? m_pParent->m_hWnd : NULL, + m_pPane, closure)) + { + if ( m_pPane ) + { + MSG_DestroyPane( m_pPane ); + m_pPane = NULL; + } + + + if(!IsDestroyed()) { + DestroyContext(); + + } + m_bProgressShown = FALSE; + return; + } + } + if (Create( CProgressDialog::IDD, pParent )) { + m_bProgressShown = TRUE; if (callback) + { (*callback)(m_hWnd, m_pPane, closure); + //m_hWnd may have been destroyed during above callback. + if(::IsWindow(m_hWnd)) + { + StartAnimation(); + } + } } else { if (m_cbDone) (*m_cbDone)(m_hWnd, m_pPane, closure); @@ -641,7 +772,13 @@ STDMETHODIMP_(ULONG) CProgressDialog::Release(void) void CProgressDialog::PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, MSG_PANE_CHANGED_NOTIFY_CODE notify, int32 value) { - if ( notify == MSG_PanePastPasswordCheck ) { + if ( notify == MSG_PaneNotifySelectNewFolder || + notify == MSG_PaneNotifyNewFolderFailed ) + { + if (m_cbDone) + (*m_cbDone)(m_hWnd, m_pPane, m_closure); + } + if ( notify == MSG_PanePastPasswordCheck ) { ShowWindow( SW_SHOWNA ); UpdateWindow(); } @@ -662,6 +799,7 @@ void CProgressDialog::UserWantsToSeeAttachments(MSG_Pane *messagepane, void *clo BEGIN_MESSAGE_MAP( CProgressDialog, CDialog ) ON_WM_DESTROY() ON_MESSAGE(WM_REQUESTPARENT,OnRequestParent) + ON_WM_TIMER() END_MESSAGE_MAP() LONG CProgressDialog::OnRequestParent(WPARAM,LPARAM) @@ -680,21 +818,34 @@ BOOL CProgressDialog::OnInitDialog( ) void CProgressDialog::OnCancel() { + StopAnimation(); if (XP_IsContextStoppable(GetContext())) XP_InterruptContext(GetContext()); else + { DestroyWindow(); + if ( m_pPane ) + { + MSG_DestroyPane( m_pPane ); + m_pPane = NULL; + } + } } + void CProgressDialog::OnDestroy() { + StopAnimation(); if (m_cbDone) (*m_cbDone)(m_hWnd, m_pPane, m_closure); CDialog::OnDestroy(); if ( m_pPane ) + { MSG_DestroyPane( m_pPane ); + m_pPane = NULL; + } if(!IsDestroyed()) { DestroyContext(); @@ -705,6 +856,7 @@ void CProgressDialog::SetProgressBarPercent(MWContext *pContext, int32 lPercent { // Ensure the safety of the value. + StopAnimation(); lPercent = lPercent < 0 ? 0 : ( lPercent > 100 ? 100 : lPercent ); if ( m_lPercent == lPercent ) { @@ -734,14 +886,36 @@ int32 CProgressDialog::QueryProgressPercent() void CProgressDialog::SetDocTitle( MWContext *pContext, char *pTitle ) { + int i = 0; } +#define ID_CYLONTIMER 3001 // timer id +#define PULSE_INTERVAL 250 // Pulse interval for timer (ms) void CProgressDialog::StartAnimation() { + if( m_uTimerId ) + { + return; + } + m_uProgressPos = 0; + m_uTimerId = SetTimer(ID_CYLONTIMER, PULSE_INTERVAL, NULL); + + if( !m_uTimerId ) + { + return; + } } void CProgressDialog::StopAnimation() { + if( !m_uTimerId ) + { + return; + } + + KillTimer(ID_CYLONTIMER); + m_uProgressPos = 0; + m_uTimerId = 0; } void CProgressDialog::AllConnectionsComplete(MWContext *pContext) @@ -760,6 +934,53 @@ CWnd *CProgressDialog::GetDialogOwner() const { return (CDialog *) this; } +void CProgressDialog::OnTimer(UINT nIDEvent) +{ + if (m_uTimerId == nIDEvent) + { + m_uProgressPos += 10; + if (m_uProgressPos > 100) + m_uProgressPos = 0; + m_progressMeter.StepItTo( CASTINT(m_uProgressPos) ); + } +} + +///////////////////////////////////////////////////////////////////// +// +// COfflineProgressDialog +// +// Dialog for offline progress +// + +COfflineProgressDialog::COfflineProgressDialog( CWnd *pParent, + MSG_Pane *parentPane, + PROGRESSCALLBACK callback, void * closure, + char * pszTitle, PROGRESSCALLBACK cbDone, BOOL bQuitOnCompletion): + CProgressDialog(pParent, parentPane, callback, closure, pszTitle, cbDone) +{ + + m_bQuitOnCompletion = bQuitOnCompletion; + +} + +void COfflineProgressDialog::AllConnectionsComplete(MWContext *pContext) +{ + CProgressDialog::AllConnectionsComplete(pContext); + theApp.m_bSynchronizing = FALSE; + + //if we're the last one keeping count then we need to cleanup + //folders. Note DestroyWindow is called first which is why == 0 + + if(m_bQuitOnCompletion) + { + theApp.CommonAppExit(); + } +} + + + + + ///////////////////////////////////////////////////////////////////// // // CNewFolderDialog @@ -771,30 +992,18 @@ CNewFolderDialog::CNewFolderDialog( CWnd *pParent, MSG_Pane *pPane, MSG_FolderInfo *folderInfo ): CDialog( IDD, pParent ) { - MWContext *pXPCX; - MWContextType saveType; - m_bEnabled = TRUE; m_pPane = NULL; if (pPane) { - pXPCX = MSG_GetContext( pPane ); - // Since the progress pane changes it's context's type, - // Save it - saveType = pXPCX->type; + MWContext *pXPCX = MSG_GetContext( pPane ); m_pPane= MSG_CreateProgressPane( pXPCX, WFE_MSGGetMaster(), pPane ); MSG_SetFEData( m_pPane, (LPVOID) (LPUNKNOWN) this ); } m_pParentFolder = folderInfo; - - DoModal(); - - // Restore true context type - if (pPane) - pXPCX->type = saveType; } BOOL CNewFolderDialog::OnInitDialog( ) @@ -883,7 +1092,8 @@ STDMETHODIMP_(ULONG) CNewFolderDialog::Release(void) void CNewFolderDialog::PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, MSG_PANE_CHANGED_NOTIFY_CODE notify, int32 value) { - if ( notify == MSG_PaneNotifySelectNewFolder ) { + if ( notify == MSG_PaneNotifySelectNewFolder || + notify == MSG_PaneNotifyNewFolderFailed ) { EndDialog( IDOK ); } } @@ -1036,7 +1246,7 @@ BOOL CPrefNewFolderDialog::OnCommand(WPARAM wParam, LPARAM lParam) { m_bCreating = TRUE; new CProgressDialog(this, NULL, _CreateFolderCallback, - this->GetSafeHwnd(), "Createing Mail Folder", _CreateFolderDoneCallback); + this->GetSafeHwnd(), szLoadString(IDS_CREATING_FOLDER), _CreateFolderDoneCallback); return TRUE; } else @@ -1100,6 +1310,9 @@ CMailNewsSplitter::CMailNewsSplitter() m_bZapperDown = FALSE; m_bDoubleClicked = FALSE; m_bMouseMove = FALSE; + + m_pNotifyFrame = NULL; + m_bLoadMessage = FALSE; } CMailNewsSplitter::~CMailNewsSplitter() @@ -1296,6 +1509,7 @@ void CMailNewsSplitter::SetPaneSize(CWnd *pWnd, int nSize) if (m_bVertical) { + m_nPrevSize = m_rcSlider.left; if (nSize > (rect.right - m_nSliderWidth)) { if (m_pWnd1 == pWnd) @@ -1308,12 +1522,13 @@ void CMailNewsSplitter::SetPaneSize(CWnd *pWnd, int nSize) if (m_pWnd1 == pWnd) m_rcSlider.left = nSize; else if (m_pWnd2 == pWnd) - m_rcSlider.left = rect.right - nSize; + m_rcSlider.left = rect.right - nSize - m_nSliderWidth; } m_rcSlider.right = m_rcSlider.left + m_nSliderWidth; } else { + m_nPrevSize = m_rcSlider.top; if (nSize > (rect.bottom - m_nSliderWidth)) { if (m_pWnd1 == pWnd) @@ -1326,10 +1541,14 @@ void CMailNewsSplitter::SetPaneSize(CWnd *pWnd, int nSize) if (m_pWnd1 == pWnd) m_rcSlider.top = nSize; else if (m_pWnd2 == pWnd) - m_rcSlider.top = rect.bottom - nSize; + m_rcSlider.top = rect.bottom - nSize - m_nSliderWidth; } m_rcSlider.bottom = m_rcSlider.top + m_nSliderWidth; } + //if we are setting a pane to 0 then we need to set zapped state + //otherwise we know it's not zapped. + m_bZapped = (nSize == 0); + PositionWindows(rect.right - rect.left, rect.bottom - rect.top); } // always return width of m_pWnd1 if split vertically @@ -1342,6 +1561,14 @@ int CMailNewsSplitter::GetPaneSize() return m_rcSlider.top; } +// if vertical always returns the left of the slider(which is right of 1st pane) +// or if horizontal always returns the top of the slider (which is bottom of 1st pane) +int CMailNewsSplitter::GetPreviousPaneSize() +{ + return m_nPrevSize; + +} + void CMailNewsSplitter::UpdateSplitter() { RECT rect; @@ -1477,6 +1704,24 @@ void CMailNewsSplitter::InvertSlider(RECT* pRect) ::ReleaseDC(GetSafeHwnd(), hDC); } +void CMailNewsSplitter::UpdateZapper() +{ + RECT rect = m_rcSlider; + + if (m_bVertical) + { + rect.top = (m_rcSlider.bottom - m_rcSlider.top - ZAP_HEIGHT) / 2; + rect.bottom = rect.top + ZAP_HEIGHT; + } + else + { + rect.left = (m_rcSlider.right - m_rcSlider.left - ZAP_HEIGHT) / 2; + rect.right = rect.left + ZAP_HEIGHT; + } + InvalidateRect(&rect, FALSE); + UpdateWindow(); +} + BEGIN_MESSAGE_MAP(CMailNewsSplitter, CView) ON_WM_CREATE() ON_WM_SETFOCUS() @@ -1497,14 +1742,12 @@ int CMailNewsSplitter::OnCreate(LPCREATESTRUCT lpCreateStruct) //create invert slider brush HDC hDC = ::GetDC(GetSafeHwnd()); - WORD grayBits[8]; - for (int i = 0; i < 8; i++) - grayBits[i] = (WORD)(0x5555 << (i & 1)); - HBITMAP grayBitmap = CreateBitmap(8, 8, 1, 1, &grayBits); - if (grayBitmap != NULL) + WORD sliderBits[8] = {43690,21845,43690,21845,43690,21845,43690,21845}; + HBITMAP sliderBitmap = CreateBitmap(8, 8, 1, 1, &sliderBits); + if (sliderBitmap != NULL) { - m_hSliderBrush = ::CreatePatternBrush(grayBitmap); - DeleteObject(grayBitmap); + m_hSliderBrush = ::CreatePatternBrush(sliderBitmap); + DeleteObject(sliderBitmap); } CreateBitmaps(hDC); @@ -1521,10 +1764,9 @@ BOOL CMailNewsSplitter::PreTranslateMessage( MSG* pMsg ) if ((GetCapture() != this) && m_bZapperDown) { m_bZapperDown = FALSE; - Invalidate(); - UpdateWindow(); + UpdateZapper(); } - } + } return CView::PreTranslateMessage( pMsg ); } @@ -1605,21 +1847,8 @@ void CMailNewsSplitter::OnLButtonDown(UINT nFlags, CPoint point) if (IsInZapper(point)) { - RECT rect = m_rcSlider; - m_bZapperDown = TRUE; - if (m_bVertical) - { - rect.top = (m_rcSlider.bottom - m_rcSlider.top - ZAP_HEIGHT) / 2; - rect.bottom = rect.top + ZAP_HEIGHT; - } - else - { - rect.left = (m_rcSlider.right - m_rcSlider.left - ZAP_HEIGHT) / 2; - rect.right = rect.left + ZAP_HEIGHT; - } - InvalidateRect(&rect, TRUE); - UpdateWindow(); + UpdateZapper(); } m_ptHit = point; m_ptFirstHit = point; @@ -1634,21 +1863,14 @@ void CMailNewsSplitter::OnMouseMove(UINT nFlags, CPoint point) if (IsInZapper(point)) { if (!m_bZapperDown) - { m_bZapperDown = TRUE; - Invalidate(); - UpdateWindow(); - } } else { if (m_bZapperDown) - { m_bZapperDown = FALSE; - Invalidate(); - UpdateWindow(); - } } + UpdateZapper(); } if (GetCapture() == this) { @@ -1722,6 +1944,24 @@ void CMailNewsSplitter::OnMouseMove(UINT nFlags, CPoint point) } } +//When the pane opens in 3pane mail frame, +//Need to load the current message +void CMailNewsSplitter::LoadingMessage() +{ + if (m_pNotifyFrame && m_bLoadMessage && + m_pNotifyFrame->IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) + m_pNotifyFrame->PostMessage(WM_COMMAND, ID_MESSAGE_SELECT, 0); +} + +//When the collapse window has focus +//change focus to next windwow +void CMailNewsSplitter::CheckFocusWindow() +{ + if (m_pNotifyFrame && + m_pNotifyFrame->IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) + ((C3PaneMailFrame*)m_pNotifyFrame)->CheckFocusWindow(FALSE); +} + void CMailNewsSplitter::OnLButtonUp(UINT nFlags, CPoint point) { if (m_bDoubleClicked) @@ -1737,6 +1977,7 @@ void CMailNewsSplitter::OnLButtonUp(UINT nFlags, CPoint point) if (GetCapture() == this) { + BOOL bCheckFocus = FALSE; ReleaseCapture(); RECT rect; @@ -1762,6 +2003,14 @@ void CMailNewsSplitter::OnLButtonUp(UINT nFlags, CPoint point) } m_rcSlider.right = m_rcSlider.left + m_nSliderWidth; m_bZapped = !m_bZapped; + if (m_bZapped) + { //only use for 3 pane mail frame + bCheckFocus = TRUE; + } + else + { //only use for 3 pane mail frame + LoadingMessage(); + } } else if (m_bTrackSlider) { @@ -1801,6 +2050,14 @@ void CMailNewsSplitter::OnLButtonUp(UINT nFlags, CPoint point) } m_rcSlider.bottom = m_rcSlider.top + m_nSliderWidth; m_bZapped = !m_bZapped; + if (m_bZapped) + { //only use for 3 pane mail frame + bCheckFocus = TRUE; + } + else + { //only use for 3 pane mail frame + LoadingMessage(); + } } else if (m_bTrackSlider) { @@ -1821,6 +2078,8 @@ void CMailNewsSplitter::OnLButtonUp(UINT nFlags, CPoint point) m_bZapperDown = FALSE; Invalidate(); UpdateWindow(); + if (bCheckFocus) + CheckFocusWindow(); } } @@ -1830,8 +2089,6 @@ void CMailNewsSplitter::OnLButtonDblClk( UINT nFlags, CPoint point ) { m_bTrackSlider = FALSE; m_bDoubleClicked = TRUE; -// if (GetCapture() == this) -// ReleaseCapture(); RECT rect; GetClientRect(&rect); if (m_bVertical) @@ -1920,12 +2177,9 @@ void CMailNewsSplitter::OnSize(UINT nType, int cx, int cy) void CMailNewsSplitter::OnSetFocus(CWnd* pOldWnd) { - if (m_pWnd1) - m_pWnd1->SetFocus(); - else if (m_pWnd2) - m_pWnd2->SetFocus(); - - CView::OnSetFocus(pOldWnd); + if (m_pNotifyFrame && + m_pNotifyFrame->IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) + ((C3PaneMailFrame*)m_pNotifyFrame)->SetFocusWindowBackToFrame(); } void CMailNewsSplitter::OnShowWindow(BOOL bShow, UINT nStatus) @@ -1943,48 +2197,16 @@ BOOL CMailNewsSplitter::OnEraseBkgnd(CDC* pDC) return TRUE; } - BOOL CMailNewsSplitter::IsOnePaneClosed() const { - CRect rect; - if (m_bVertical) - { - m_pWnd1->GetClientRect(&rect); - if (rect.right == 0) - return TRUE; - else - return FALSE; - } - else - { - m_pWnd2->GetClientRect(&rect); - if (rect.bottom == 0) - return TRUE; - else - return FALSE; - } - - return FALSE; + return m_bZapped; } - int CMailNewsSplitter::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message) { int nResult; nResult = CWnd::OnMouseActivate(pDesktopWnd, nHitTest, message); - if (nResult == MA_NOACTIVATE || nResult == MA_NOACTIVATEANDEAT) - return nResult; // frame does not want to activate - - CFrameWnd* pParentFrame = GetParentFrame(); - if (pParentFrame != NULL) - { - // eat it if this will cause activation - if (pParentFrame == pDesktopWnd || pDesktopWnd->IsChild(pParentFrame)) - nResult = CView::OnMouseActivate(pDesktopWnd, nHitTest, message); - } return nResult; } - - diff --git a/mozilla/cmd/winfe/mailpriv.h b/mozilla/cmd/winfe/mailpriv.h index 2c02b6111b5..9c279d37b00 100644 --- a/mozilla/cmd/winfe/mailpriv.h +++ b/mozilla/cmd/winfe/mailpriv.h @@ -245,6 +245,33 @@ protected: }; +/////////////////////////////////////////////////////////////////////// +//CFolderSharingPage +//Mail folder property page. +class CFolderSharingPage: public CNetscapePropertyPage { + +protected: + MSG_FolderInfo *m_folderInfo; + MWContext *m_pContext; + MSG_Pane *m_pPane; + CNewsFolderPropertySheet *m_pParent; + +public: + enum { IDD = IDD_PP_SHARING }; + + CFolderSharingPage(CWnd *pWnd = NULL); + void SetFolderInfo(MSG_FolderInfo *folderInfo, MSG_Pane *pPane, MWContext *pContext); + + virtual BOOL OnInitDialog(); + virtual void OnOK(); +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + afx_msg void OnClickPrivileges(); + DECLARE_MESSAGE_MAP() + +}; + /////////////////////////////////////////////////////////////////////// ///News Host property page. class CNewsHostGeneralPropertyPage: public CNetscapePropertyPage { @@ -334,7 +361,8 @@ public: public: CNewsGeneralPropertyPage *m_pNewsFolderPage; - CFolderPropertyPage *m_pFolderPage; + CFolderPropertyPage *m_pFolderPage; + CFolderSharingPage *m_pSharingPage; CDiskSpacePropertyPage *m_pDiskSpacePage; CDownLoadPPNews *m_pDownLoadPageNews; CDownLoadPPMail *m_pDownLoadPageMail; @@ -428,6 +456,7 @@ protected: // typedef void (*PROGRESSCALLBACK)(HWND,MSG_Pane *, void*); +typedef BOOL (*SHOWPROGRESSCALLBACK)(HWND, MSG_Pane*, void*); #define WM_REQUESTPARENT WM_USER+1442 @@ -438,16 +467,19 @@ protected: MSG_Pane *m_pPane; CWnd * m_pParent; char * m_pszTitle; - void *m_closure; PROGRESSCALLBACK m_cbDone; + UINT m_uTimerId; + UINT m_uProgressPos; + BOOL m_bProgressShown; public: CProgressDialog( CWnd *pParent, MSG_Pane *parentPane, PROGRESSCALLBACK callback, void * closure = NULL, char * pszTitle = NULL, - PROGRESSCALLBACK cbDone = NULL); + PROGRESSCALLBACK cbDone = NULL, + SHOWPROGRESSCALLBACK showCallback = NULL); ~CProgressDialog() { if (m_pszTitle) XP_FREE(m_pszTitle); @@ -477,8 +509,10 @@ protected: afx_msg void OnDestroy(); afx_msg LONG OnRequestParent(WPARAM,LPARAM); + afx_msg void OnTimer(UINT nIDEvent); DECLARE_MESSAGE_MAP() + public: int32 QueryProgressPercent(); void SetProgressBarPercent(MWContext *pContext, int32 lPercent); @@ -494,6 +528,34 @@ public: void UpdateStopState( MWContext *pContext ); CWnd *GetDialogOwner() const; + // returns TRUE if we get past the test callback function + // used to determine if we should destruct now. + BOOL GetProgressShown() {return m_bProgressShown;} +}; + +///////////////////////////////////////////////////////////////////// +// +// COfflineProgressDialog +// +// Progress for offline synchronizing +// + +class COfflineProgressDialog: public CProgressDialog { + +protected: + BOOL m_bQuitOnCompletion; + +public: + COfflineProgressDialog( CWnd *pParent, + MSG_Pane *parentPane, + PROGRESSCALLBACK callback, void * closure = NULL, + char * pszTitle = NULL, + PROGRESSCALLBACK cbDone = NULL, BOOL bQuitOnCompletion = FALSE); + + void AllConnectionsComplete(MWContext *pContext); + +protected: + }; ///////////////////////////////////////////////////////////////////// @@ -583,6 +645,7 @@ protected: BOOL m_bEraseBackground; HBRUSH m_hSliderBrush; + CMailNewsFrame* m_pNotifyFrame; CWnd *m_pWnd1, *m_pWnd2; BOOL m_bVertical; BOOL m_bTrackSlider; @@ -590,6 +653,7 @@ protected: BOOL m_bZapperDown; BOOL m_bZapped; BOOL m_bDoubleClicked; + BOOL m_bLoadMessage; RECT m_rcSlider; POINT m_ptHit; POINT m_ptFirstHit; @@ -603,11 +667,15 @@ protected: public: ~CMailNewsSplitter(); + + void SetNotifyFrame(CMailNewsFrame* pFrame = NULL) { m_pNotifyFrame = pFrame; } + void SetLoadMessage(BOOL bLoad = FALSE) { m_bLoadMessage = bLoad; } void AddPanes(CWnd *pWnd1, CWnd *pWnd2 = NULL, int nSize = -1, BOOL bVertical = TRUE); void AddOnePane(CWnd *pWnd, BOOL bFirstPane = FALSE, BOOL bVertical = TRUE); void RemoveOnePane(CWnd *pWnd); void SetPaneSize(CWnd *pWnd, int nSize); int GetPaneSize(); + int GetPreviousPaneSize(); BOOL IsOnePaneClosed() const; @@ -619,6 +687,9 @@ protected: BOOL IsInZapper(POINT point); void DeleteBitmaps(); void CreateBitmaps(HDC hDC); + void LoadingMessage(); + void CheckFocusWindow(); + void UpdateZapper(); virtual void PositionWindows(int cx, int cy); virtual void InvertSlider(RECT* pRect); diff --git a/mozilla/cmd/winfe/mainfrm.cpp b/mozilla/cmd/winfe/mainfrm.cpp index 21b6667edb8..d829cb5b0c8 100644 --- a/mozilla/cmd/winfe/mainfrm.cpp +++ b/mozilla/cmd/winfe/mainfrm.cpp @@ -21,6 +21,7 @@ #include "stdafx.h" +#include "rosetta.h" #include "dialog.h" #include "winclose.h" #include "cntritem.h" @@ -408,6 +409,7 @@ void CMainFrame::OnUpdateNetSearch(CCmdUI *pCmdUI) void CMainFrame::OnUpdateSecurity(CCmdUI *pCmdUI) { + HG73537 MWContext *pContext = GetMainContext()->GetContext(); if(EDT_IS_EDITOR(pContext)) @@ -442,6 +444,7 @@ void CMainFrame::OnUpdateSecurity(CCmdUI *pCmdUI) void CMainFrame::OnUpdateSecurityStatus(CCmdUI *pCmdUI) { + HG73537 int status = XP_GetSecurityStatus(GetMainContext()->GetContext()); pCmdUI->Enable(status == SSL_SECURITY_STATUS_ON_LOW || status == SSL_SECURITY_STATUS_ON_HIGH); } diff --git a/mozilla/cmd/winfe/makefile.win b/mozilla/cmd/winfe/makefile.win index dd286bd1b1e..fe35223bd5c 100644 --- a/mozilla/cmd/winfe/makefile.win +++ b/mozilla/cmd/winfe/makefile.win @@ -34,7 +34,7 @@ DIRS=\ edtrcdll \ !endif !ifdef MOZ_MAIL_NEWS - mnrcdll \ + mnrcdll \ !endif xpstrdll \ $(NULL) diff --git a/mozilla/cmd/winfe/mapi/maindll.cpp b/mozilla/cmd/winfe/mapi/maindll.cpp new file mode 100644 index 00000000000..2ef8ba9d4e1 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/maindll.cpp @@ -0,0 +1,81 @@ +/* -*- 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. + */ +// +// DLLMain to get a handle on an hInstance +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +#include + +// +// global variables +// +HINSTANCE hInstance; + +// +// DLL entry +// +#ifdef WIN32 +/**************************************************************************** + FUNCTION: DllMain(HANDLE, DWORD, LPVOID) + + PURPOSE: DllMain is called by Windows when + the DLL is initialized, Thread Attached, and other times. + Refer to SDK documentation, as to the different ways this + may be called. + + The DllMain function should perform additional initialization + tasks required by the DLL. In this example, no initialization + tasks are required. DllMain should return a value of 1 if + the initialization is successful. + +*******************************************************************************/ +BOOL APIENTRY DllMain(HANDLE hInstLocal, DWORD ul_reason_being_called, LPVOID lpReserved) +{ + hInstance = (HINSTANCE)hInstLocal; + + if (hInstance != NULL) + return 1; + else + return 0; +} + +#else // WIN16 + + +//-------------------------------------------------------------------- +// LibMain( hInstance, wDataSegment, wHeapSize, lpszCmdLine ) : WORD +// +// hInstance library instance handle +// wDataSegment library data segment +// wHeapSize default heap size +// lpszCmdLine command line arguments +// +//-------------------------------------------------------------------- + +int CALLBACK LibMain(HINSTANCE hInstLocal, WORD wDataSegment, WORD wHeapSize, LPSTR lpszCmdLine) +{ + hInstance = hInstLocal; + /* return result 1 = success; 0 = fail */ + if (hInstance != NULL) + return 1; + else + return 0; +} + +#endif // WIN16 + diff --git a/mozilla/cmd/winfe/mapi/mapi32.cpp b/mozilla/cmd/winfe/mapi/mapi32.cpp new file mode 100644 index 00000000000..c24cb4e53da --- /dev/null +++ b/mozilla/cmd/winfe/mapi/mapi32.cpp @@ -0,0 +1,2368 @@ +/* -*- 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. + */ +// +// Simple MAPI API +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// +#include +#include + +#include "xpapi.h" +#include "trace.h" +#include "mapiipc.h" +#include "mapiutl.h" +#include "nsstrseq.h" +#include "mapismem.h" +#include "mapimem.h" + +#include "nscpmapi.h" + +#ifndef MAPI_OLE // Because MSFT doesn't do this for us :-( +#include "mapi.h" +#endif + +// +// Necessary variables... +// +memTrackerType memArray[MAX_POINTERS]; + +// +// For remembering memory...how ironic. +// +void +SetPointerArray(LPVOID ptr, BYTE type) +{ +int i; + + for (i=0; im_dwSize = memSize; + memcpy(sMem->m_buf, &(logonInfo), sizeof(MAPILogonType)); + memcpy(sMem->m_buf + sizeof(MAPILogonType), strSeq, (size_t) strSize); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPILogon, &ipcInfo); + + // Check for IPC completion + MAPILogonType *logInfo = (MAPILogonType *) &(sMem->m_buf[0]); + if (!logInfo->ipcWorked) + { + result = MAPI_E_FAILURE; + } + + // + // If successfull, then we need to get the information + if (result == SUCCESS_SUCCESS) + { + *lplhSession = logInfo->lhSession; + } + + // + // Now time to do some cleanup... + // + NSStrSeqDelete(strSeq); + NSCloseSharedMemory(sMem, hSharedMemory); + + CleanupMAPITempFiles(); + TRACE(" Returning lhSession=%lu\n", *lplhSession); + LogString("--MAPILogon complete\r\n"); + + return(result); +} + +// +// The MAPILogoff function ends a session with the messaging system. +// +MAPI_IMPLEMENT(ULONG) +MAPILogoff( + LHANDLE lhSession, + ULONG ulUIParam, + FLAGS flFlags, + ULONG ulReserved) +{ +LRESULT result; +HWND hWndIPC; +MAPIIPCType ipcInfo; + + TRACE_FN("MAPILogoff"); + TRACE("lhSession Session ID = %lu\n", lhSession); + LogString("--MAPILogoff\r\n"); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, ulUIParam); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + MAPILogoffType logoffInfo; + + memSize = sizeof(MAPILogoffType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // Now populate a Logon structure with the passed in information + // + logoffInfo.lhSession = lhSession; + logoffInfo.ulUIParam = ulUIParam; + logoffInfo.flFlags = flFlags; + logoffInfo.ipcWorked = 0; + + // + // Now copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + memcpy(sMem->m_buf, &(logoffInfo), sizeof(MAPILogoffType)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPILogoff, &ipcInfo); + + // Check for IPC completion + MAPILogoffType *logInfo = (MAPILogoffType *) &(sMem->m_buf[0]); + if (!logInfo->ipcWorked) + { + result = MAPI_E_FAILURE; + } + + // + // Now do cleanup on the way out... + // + NSCloseSharedMemory(sMem, hSharedMemory); + + // + // Close the stuff for WM_COPYDATA calls and anything else + // + nsMAPI_CloseAPI(); + + LogString("--MAPILogoff complete\r\n"); + + CleanupMAPITempFiles(); + + // Now just return! + return(result); +} + +// +// The MAPIFreeBuffer function frees a memory buffer allocated with a call to +// the MAPIAllocateBuffer function or the MAPIAllocateMore function. +// +MAPI_IMPLEMENT(ULONG) +MAPIFreeBuffer(LPVOID pv) +{ +int i; + + TRACE_FN("MAPIFreeBuffer"); + + if (!pv) +#ifdef WIN16 + return(SUCCESS_SUCCESS); +#else + return(S_OK); +#endif + + for (i=0; ilpszSubject = '%s'\n", lpMessage->lpszSubject); + TRACE(" lpMessage->nRecipCount = %lu\n lpMessage->nFileCount=%lu\n", lpMessage->nRecipCount, lpMessage->nFileCount); + lpMapiFileDesc pFiles = lpMessage->lpFiles; + for (ULONG i = 0; i < lpMessage->nFileCount; i++) + { + TRACE(" lpszPathName='%s', lpszFileName='%s'\n", pFiles[i].lpszPathName, pFiles[i].lpszFileName); + } + } +#endif + CleanupMAPITempFiles(); + + // + // Needed variables... + // + BOOL isTempSession = FALSE; + LONG result = SUCCESS_SUCCESS; + HWND hWndIPC; + MAPIIPCType ipcInfo; + + if (!lpMessage) + { + return(MAPI_E_FAILURE); + } + + // + // Sanity Check the attachments if any here... + // + if (lpMessage->nFileCount > 0) + { + DWORD rc = SanityCheckAttachmentFiles(lpMessage); // return of zero is ok + if (rc == 1) + { + return(MAPI_E_ATTACHMENT_NOT_FOUND); + } + else if (rc == 2) + { + return(MAPI_E_ATTACHMENT_OPEN_FAILURE); + } + } + + // + // If lhSession is ZERO, then we have to get a temporary session and + // go from there. + // + if (lhSession == 0) + { + LHANDLE lhTempSession; + if (MAPILogon(0, NULL, NULL, 0, 0, &lhTempSession) != SUCCESS_SUCCESS) + { + isTempSession = TRUE; + if (MAPILogon(0, "dummy", "dummy", 0, 0, &lhTempSession) != SUCCESS_SUCCESS) + { + return(MAPI_E_LOGIN_FAILURE); + } + } + + lhSession = lhTempSession; + } + + // + // Now create the big chunk of memory that we will pass across which + // represents the message + // + DWORD totalSize; + MAPISendMailType *memToPass = NULL; + + memToPass = (MAPISendMailType *) FlattenMAPIMessageStructure(lpMessage, &totalSize); + if (!memToPass) + { + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + memToPass->lhSession = lhSession; + memToPass->ulUIParam = UIParam; + memToPass->flFlags = flags; + memToPass->ipcWorked = 0; + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + free(memToPass); + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, UIParam); + + // + // Build the shared memory segment of information to pass into + // Communicator for send message call. + // + CSharedMem *sMem; + HANDLE hSharedMemory; + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(totalSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + free(memToPass); + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // Now copy the information into the memory segment. + // + sMem->m_dwSize = totalSize; + memcpy(sMem->m_buf, memToPass, (size_t) totalSize); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = totalSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPISendMail, &ipcInfo); + + // Check for IPC completion + MAPISendMailType *ptr = (MAPISendMailType *) &(sMem->m_buf[0]); + if (!ptr->ipcWorked) + { + result = MAPI_E_FAILURE; + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + free(memToPass); + + LogString("--MAPISendMail complete\r\n"); + + // + // If we created a temp session, then we need to trash it... + // + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + + return(result); +} + +// +// The MAPISendDocuments function sends a standard message with one or more attached +// files and a cover note. The cover note is a dialog box that allows the user to +// enter a list of recipients and an optional message. MAPISendDocuments differs +// from the MAPISendMail function in that it allows less flexibility in message generation. +// +void +CleanupStringArray(LPSTR *strArray, DWORD arraySize) +{ + DWORD i; + + if (strArray == NULL) + return; + + for (i=0; idataBuf[0]), strSeq, (size_t) strSize); + + // Cleanup sequence... + NSStrSeqDelete(strSeq); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + free(memToPass); + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, ulUIParam); + + // + // Build the shared memory segment of information to pass into + // Communicator for send message call. + // + CSharedMem *sMem; + HANDLE hSharedMemory; + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + free(memToPass); + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // Now copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + memcpy(sMem->m_buf, memToPass, (size_t) memSize); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPISendDocuments, &ipcInfo); + + MAPISendDocumentsType *ptr = (MAPISendDocumentsType *) &(sMem->m_buf[0]); + if (!ptr->ipcWorked) + { + result = MAPI_E_FAILURE; + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + free(memToPass); + + LogString("--MAPISendDocuments() complete\r\n"); + return(result); +} + +MAPI_IMPLEMENT(ULONG) +MAPIFindNext( + LHANDLE lhSession, + ULONG ulUIParam, + LPSTR lpszMessageType, + LPSTR lpszSeedMessageID, + FLAGS flFlags, + ULONG ulReserved, + LPSTR lpszMessageID) +{ +LRESULT result; +HWND hWndIPC; +MAPIIPCType ipcInfo; +LPSTR tempSeedString = ""; + + TRACE_FN("MAPIFindNext"); + if (lhSession == 0) + { + return(MAPI_E_INVALID_SESSION); + } + + if (lpszSeedMessageID) + { + if (strlen(lpszSeedMessageID) > 511) + { + return(MAPI_E_INSUFFICIENT_MEMORY); + } + } + else + { + lpszSeedMessageID = tempSeedString; + } + + TRACE("MAPIFindNext lhSession Session ID = %lu\n", lhSession); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, ulUIParam); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + MAPIFindNextType findInfo; + + memSize = sizeof(MAPIFindNextType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // Now populate a Logon structure with the passed in information + // + findInfo.lhSession = lhSession; + findInfo.ulUIParam = ulUIParam; + findInfo.flFlags = flFlags; + findInfo.ipcWorked = 0; + + // + // Copy the seed value in the structure + // + strcpy((LPSTR) findInfo.lpszSeedMessageID, lpszSeedMessageID); + + // + // Now copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + memcpy(sMem->m_buf, &(findInfo), sizeof(MAPIFindNextType)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPIFindNext, &ipcInfo); + + // Check for IPC completion + MAPIFindNextType *findNextInfo = (MAPIFindNextType *) &(sMem->m_buf[0]); + if (!findNextInfo->ipcWorked) + { + result = MAPI_E_FAILURE; + } + + // + // Now return the value to the caller... + // + if (result == SUCCESS_SUCCESS) + { + strcpy(lpszMessageID, (LPSTR) findNextInfo->lpszMessageID); + } + + // + // Now do cleanup on the way out... + // + NSCloseSharedMemory(sMem, hSharedMemory); + LogString("--MAPIFindNext complete\r\n"); + return(result); +} + +MAPI_IMPLEMENT(ULONG) +MAPIReadMail( + LHANDLE lhSession, + ULONG ulUIParam, + LPSTR lpszMessageID, + FLAGS flFlags, + ULONG ulReserved, + lpMapiMessage FAR *lppMessage) +{ +LRESULT result; +HWND hWndIPC; +MAPIIPCType ipcInfo; + + TRACE_FN("MAPIReadMail"); + // + // This one has to have a valid session handle, or we bail! + // + if (lhSession == 0) + { + return(MAPI_E_INVALID_SESSION); + } + + if (strlen(lpszMessageID) > 511) + { + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, ulUIParam); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + MAPIReadMailType readMailInfo; + + memSize = sizeof(MAPIReadMailType); + memset(&readMailInfo, 0, (size_t) memSize); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // Now populate a Logon structure with the passed in information + // + readMailInfo.lhSession = lhSession; + readMailInfo.ulUIParam = ulUIParam; + readMailInfo.flFlags = flFlags; + readMailInfo.ipcWorked = 0; + + // + // Copy the seed value in the structure + // + strcpy((LPSTR) readMailInfo.lpszMessageID, lpszMessageID); + + // + // Now copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + memcpy(sMem->m_buf, &(readMailInfo), sizeof(MAPIReadMailType)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPIReadMail, &ipcInfo); + + // Check the IPC status... + MAPIReadMailType *rMailPtr = (MAPIReadMailType *) &(sMem->m_buf[0]); + + // + // Now return the value to the caller if we bombed... + // + if ((result != SUCCESS_SUCCESS) || (!(rMailPtr->ipcWorked))) + { + NSCloseSharedMemory(sMem, hSharedMemory); + LogString("--MAPIReadMail failed\r\n"); + return(result); + } + + // Now get a hold of the various values for the message we need to + // return in the lpMapiMessage structure + + if (rMailPtr->MSG_nRecipCount == 0) + { + NSCloseSharedMemory(sMem, hSharedMemory); + LogString("--MAPIReadMail failed - ZERO recipients\r\n"); + return(MAPI_E_FAILURE); + } + + // + // Get the blob loaded into memory... + // + NSstringSeq blobSequence = (NSstringSeq) LoadBlobToMemory((LPSTR) rMailPtr->lpszBlob); + + // Now check on the blob + if (!blobSequence) + { + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + lpMapiMessage msgPtr = (MapiMessage *)malloc(sizeof(MapiMessage)); + if (msgPtr == NULL) + { + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + NSStrSeqDelete(blobSequence); + LogString("--MAPIReadMail failed\r\n"); + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + memset(msgPtr, 0, sizeof(MapiMessage)); + + // + // At this point, we need to populate the structure of information + // we are passing back via the *lppMessage and then start parsing through the + // String sequence for each of needed fields. After populating the entire + // structure, return this pointer and our job on this side is done! + // + LPSTR subject = NSStrSeqGet(blobSequence, 0); + LPSTR noteText = NSStrSeqGet(blobSequence, 1); + LPSTR dateReceived = NSStrSeqGet(blobSequence, 2); + LPSTR threadID = NSStrSeqGet(blobSequence, 3); + LPSTR origName = NSStrSeqGet(blobSequence, 4); + LPSTR origAddress = NSStrSeqGet(blobSequence, 5); + + UINT i; + ULONG stringCount = 6; // This is to start with the rest of the string seq + + // Set all of the general header information first! + msgPtr->lpszSubject = strdup(CheckNullString(subject)); + msgPtr->lpszDateReceived = strdup(CheckNullString(dateReceived)); + msgPtr->lpszConversationID = strdup(CheckNullString(threadID)); + msgPtr->flFlags = rMailPtr->MSG_flFlags; + + // Setup the originator information! + msgPtr->lpOriginator = (lpMapiRecipDesc) malloc(sizeof(MapiRecipDesc)); + if (!msgPtr->lpOriginator) + { + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + + FreeMAPIMessage(msgPtr); + NSStrSeqDelete(blobSequence); + LogString("--MAPIReadMail failed\r\n"); + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // memset the area just allocated to null + memset(msgPtr->lpOriginator, 0, sizeof(MapiRecipDesc)); + + msgPtr->lpOriginator->lpszName = strdup(CheckNullString(origName)); + msgPtr->lpOriginator->lpszAddress = strdup(CheckNullString(origAddress)); + msgPtr->lpOriginator->ulRecipClass = rMailPtr->MSG_ORIG_ulRecipClass; + + // Now deal with the recipients of this message + msgPtr->lpRecips = (lpMapiRecipDesc) malloc((size_t) (sizeof(MapiRecipDesc) * + rMailPtr->MSG_nRecipCount)); + if (!msgPtr->lpRecips) + { + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + + FreeMAPIMessage(msgPtr); + NSStrSeqDelete(blobSequence); + LogString("--MAPIReadMail failed\r\n"); + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + msgPtr->nRecipCount = rMailPtr->MSG_nRecipCount; + memset(msgPtr->lpRecips, 0, (size_t) (sizeof(MapiRecipDesc) * msgPtr->nRecipCount)); + + for (i=0; inRecipCount; i++) + { + // String x: LPSTR lpszName; // Recipient N name + // String x: LPSTR lpszAddress; // Recipient N address (optional) + // String x: LPSTR lpszRecipClass // recipient class - sprintf of ULONG + + msgPtr->lpRecips[i].lpszName = + strdup( CheckNullString(NSStrSeqGet(blobSequence, stringCount++)) ); + + msgPtr->lpRecips[i].lpszAddress = + strdup( CheckNullString(NSStrSeqGet(blobSequence, stringCount++)) ); + + msgPtr->lpRecips[i].ulRecipClass = + (ULONG) atoi( CheckNullString(NSStrSeqGet(blobSequence, stringCount++)) ); + } + + // + // MAPI_ENVELOPE_ONLY + // Indicates MAPIReadMail should read the message header only. File attachments are + // not copied to temporary files, and neither temporary file names nor message text + // is written. Setting this flag enhances performance. + // + // MAPI_SUPPRESS_ATTACH + // Indicates MAPIReadMail should not copy file attachments but should write message + // text into the MapiMessage structure. MAPIReadMail ignores this flag if the + // calling application has set the MAPI_ENVELOPE_ONLY flag. Setting the + // MAPI_SUPPRESS_ATTACH flag enhances performance. + // + if (flFlags & MAPI_ENVELOPE_ONLY) + { + noteText = NULL; + rMailPtr->MSG_nFileCount = 0; + } + else if ( (flFlags & MAPI_BODY_AS_FILE) && + (flFlags & MAPI_SUPPRESS_ATTACH)) + { + rMailPtr->MSG_nFileCount = 1; + } + else if (flFlags & MAPI_BODY_AS_FILE) + { + ++(rMailPtr->MSG_nFileCount); + } + + // Now deal with the list of attachments! Since the nFileCount should be set + // correctly, this loop will automagically be correct + // + if (rMailPtr->MSG_nFileCount > 0) + { + msgPtr->lpFiles = (lpMapiFileDesc) malloc((size_t) (sizeof(MapiFileDesc) * + rMailPtr->MSG_nFileCount) ); + if (!msgPtr->lpFiles) + { + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + + FreeMAPIMessage(msgPtr); + NSStrSeqDelete(blobSequence); + LogString("--MAPIReadMail failed\r\n"); + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + memset(msgPtr->lpFiles, 0, (size_t) (sizeof(MapiFileDesc) * rMailPtr->MSG_nFileCount)); + } + + UCHAR fNameBody[_MAX_PATH]; + + // Now do body and attachment stuff only if we haven't been told + // not to do it by the user. + if (!(flFlags & MAPI_ENVELOPE_ONLY)) + { + if (flFlags & MAPI_BODY_AS_FILE) + { + LPSTR tempNoteText = CheckNullString(noteText); + + if (GetTempAttachmentName((LPSTR) fNameBody) != 0) + { + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + + FreeMAPIMessage(msgPtr); + NSStrSeqDelete(blobSequence); + LogString("--MAPIReadMail failed\r\n"); + return(MAPI_E_ATTACHMENT_WRITE_FAILURE); + } + + if (WriteMemoryBufferToDisk((LPSTR) fNameBody, + (strlen(tempNoteText) + 1), tempNoteText) != 0) + { + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + + FreeMAPIMessage(msgPtr); + NSStrSeqDelete(blobSequence); + LogString("--MAPIReadMail failed\r\n"); + return(MAPI_E_ATTACHMENT_WRITE_FAILURE); + } + } + else + { + msgPtr->lpszNoteText = strdup(noteText); + } + + msgPtr->nFileCount = rMailPtr->MSG_nFileCount; + for (i=0; inFileCount; i++) + { + // + // MAPI_BODY_AS_FILE + // Indicates MAPIReadMail should write the message text to a temporary file + // and add it as the first attachment in the attachment list. + if ( (i == 0) && (flFlags & MAPI_BODY_AS_FILE)) + { + msgPtr->lpFiles[i].lpszPathName = strdup((LPSTR)fNameBody); + msgPtr->lpFiles[i].lpszFileName = strdup((LPSTR)fNameBody); + continue; + } + + msgPtr->lpFiles[i].lpszPathName = + strdup( CheckNullString(NSStrSeqGet(blobSequence, stringCount++)) ); + msgPtr->lpFiles[i].lpszFileName = + strdup( CheckNullString(NSStrSeqGet(blobSequence, stringCount++)) ); + } + } + + // + // RICHIE - For now, let's do a little cleanup on the message itself + // and strip the following inline tags: + // + //   < + // + msgPtr->lpszNoteText = StripHTML(msgPtr->lpszNoteText); + + // + // Now that we are here, set the pointer array and move on with life... + // + *lppMessage = msgPtr; + SetPointerArray(msgPtr, MAPI_MESSAGE_TYPE); + + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + if (blobSequence) + NSStrSeqDelete(blobSequence); + + // + // Now, get out... + // + LogString("--MAPIReadMail complete\r\n"); + return(result); +} + +MAPI_IMPLEMENT(ULONG) +MAPISaveMail( + LHANDLE lhSession, + ULONG ulUIParam, + lpMapiMessage lpMessage, + FLAGS flFlags, + ULONG ulReserved, + LPSTR lpszMessageID +) +{ +#ifdef _DEBUG + TRACE_FN("MapiSaveMail"); + TRACE(" lhSession=%lu\n", lhSession); + if (lpMessage) + { + TRACE(" lpMessage->lpszSubject = '%s'\n lpMessage->lpszNoteText='%s'\n", lpMessage->lpszSubject, lpMessage->lpszNoteText); + TRACE(" lpMessage->nRecipCount = %lu\n lpMessage->nFileCount=%lu\n", lpMessage->nRecipCount, lpMessage->nFileCount); + lpMapiFileDesc pFiles = lpMessage->lpFiles; + for (ULONG i = 0; i < lpMessage->nFileCount; i++) + { + TRACE(" lpszPathName='%s', lpszFileName='%s'\n", pFiles[i].lpszPathName, pFiles[i].lpszFileName); + } + } +#endif + + CleanupMAPITempFiles(); + + // + // Needed variables... + // + BOOL isTempSession = FALSE; + LONG result = SUCCESS_SUCCESS; + HWND hWndIPC; + MAPIIPCType ipcInfo; + + if (!lpMessage) + { + return(MAPI_E_FAILURE); + } + + // + // Sanity Check the attachments if any here... + // + if (lpMessage->nFileCount > 0) + { + DWORD rc = SanityCheckAttachmentFiles(lpMessage); // return of zero is ok + if (rc == 1) + { + return(MAPI_E_ATTACHMENT_NOT_FOUND); + } + else if (rc == 2) + { + return(MAPI_E_ATTACHMENT_OPEN_FAILURE); + } + } + + // + // If lhSession is ZERO, then we have to get a temporary session and + // go from there. + // + if ( (lhSession == 0) || (flFlags & MAPI_NEW_SESSION)) + { + LHANDLE lhTempSession; + if (MAPILogon(0, NULL, NULL, 0, 0, &lhTempSession) != SUCCESS_SUCCESS) + { + isTempSession = TRUE; + if (MAPILogon(0, "dummy", "dummy", 0, 0, &lhTempSession) != SUCCESS_SUCCESS) + { + return(MAPI_E_LOGIN_FAILURE); + } + } + + lhSession = lhTempSession; + } + + // + // Now create the big chunk of memory that we will pass across which + // represents the message + // + DWORD totalSize; + MAPISendMailType *memToPass = NULL; + + memToPass = (MAPISendMailType *) FlattenMAPIMessageStructure(lpMessage, &totalSize); + if (!memToPass) + { + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + memToPass->lhSession = lhSession; + memToPass->ulUIParam = ulUIParam; + memToPass->flFlags = flFlags; + memToPass->ipcWorked = 0; + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + free(memToPass); + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, ulUIParam); + + // + // Build the shared memory segment of information to pass into + // Communicator for send message call. + // + CSharedMem *sMem; + HANDLE hSharedMemory; + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(totalSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + free(memToPass); + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // Now copy the information into the memory segment. + // + sMem->m_dwSize = totalSize; + memcpy(sMem->m_buf, memToPass, (size_t) totalSize); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = totalSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPISaveMail, &ipcInfo); + + // Check for IPC completion + MAPISendMailType *ptr = (MAPISendMailType *) &(sMem->m_buf[0]); + if (!ptr->ipcWorked) + { + result = MAPI_E_FAILURE; + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + free(memToPass); + + LogString("--MAPISaveMail complete\r\n"); + + // + // If we created a temp session, then we need to trash it... + // + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + + return(result); +} + +// +// The MAPIDeleteMail function deletes a message. +// +MAPI_IMPLEMENT(ULONG) +MAPIDeleteMail( + LHANDLE lhSession, + ULONG ulUIParam, + LPSTR lpszMessageID, + FLAGS flFlags, + ULONG ulReserved) +{ +LRESULT result; +HWND hWndIPC; +MAPIIPCType ipcInfo; + + TRACE_FN("MAPIDeleteMail"); + if (lhSession == 0) + { + return(MAPI_E_INVALID_SESSION); + } + + // Make sure we have something valid on the message ID front! + if ((!lpszMessageID) || (!*lpszMessageID)) + { + return(MAPI_E_INVALID_MESSAGE); + } + + if (strlen(lpszMessageID) > 511) + { + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + TRACE("MAPIDeleteMail lhSession Session ID = %lu\n", lhSession); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, ulUIParam); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + MAPIDeleteMailType delInfo; + + memSize = sizeof(MAPIDeleteMailType); + lstrcpy((LPSTR)delInfo.lpszMessageID, lpszMessageID); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // Now populate a Logon structure with the passed in information + // + delInfo.lhSession = lhSession; + delInfo.ulUIParam = ulUIParam; + delInfo.ipcWorked = 0; + + // + // Now copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + memcpy(sMem->m_buf, &(delInfo), sizeof(MAPIDeleteMailType)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPIDeleteMail, &ipcInfo); + + // Check for IPC completion + MAPIDeleteMailType *ptr = (MAPIDeleteMailType *) &(sMem->m_buf[0]); + if (!ptr->ipcWorked) + { + result = MAPI_E_FAILURE; + } + + // + // Now do cleanup on the way out and return the value to the caller... + // + NSCloseSharedMemory(sMem, hSharedMemory); + LogString("--MAPIDeleteMail complete\r\n"); + return(result); +} + +// RICHIE - MAPI ADDRESS HERE + +// +// The MAPIDetails function displays a dialog box containing the details +// of a selected address list entry +// +MAPI_IMPLEMENT(ULONG) +MAPIDetails( + LHANDLE lhSession, + ULONG ulUIParam, + lpMapiRecipDesc lpRecip, + FLAGS flFlags, + ULONG ulReserved) +{ + TRACE_FN("MAPIDetails"); + // + // Needed variables... + // + BOOL isTempSession = FALSE; + LONG result = SUCCESS_SUCCESS; + HWND hWndIPC; + MAPIIPCType ipcInfo; + + // Make sure we have something valid on the query name front! + if (!lpRecip) + { + return(MAPI_E_AMBIGUOUS_RECIPIENT); + } + + if ((lpRecip->ulEIDSize == 0) || (lpRecip->ulEIDSize > MAX_NAME_LEN)) + { + return(MAPI_E_AMBIGUOUS_RECIPIENT); + } + + // + // If lhSession is ZERO, then we have to get a temporary session and + // go from there. + // + if (lhSession == 0) + { + LHANDLE lhTempSession; + if (MAPILogon(0, NULL, NULL, 0, 0, &lhTempSession) != SUCCESS_SUCCESS) + { + isTempSession = TRUE; + if (MAPILogon(0, "dummy", "dummy", 0, 0, &lhTempSession) != SUCCESS_SUCCESS) + { + return(MAPI_E_LOGIN_FAILURE); + } + } + + lhSession = lhTempSession; + } + + // + // Now create the big chunk of memory that we will pass across which + // represents the message + // + MAPIDetailsType detailInfo; + + memset(&detailInfo, 0, sizeof(MAPIDetailsType)); + detailInfo.lhSession = lhSession; + detailInfo.ulUIParam = ulUIParam; + detailInfo.flFlags = flFlags; + detailInfo.ipcWorked = 0; + memcpy(detailInfo.lpszABookID, lpRecip->lpEntryID, (size_t) lpRecip->ulEIDSize); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, ulUIParam); + + // + // Build the shared memory segment of information to pass into + // Communicator for send message call. + // + CSharedMem *sMem; + HANDLE hSharedMemory; + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(sizeof(MAPIDetailsType), (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // Now copy the information into the memory segment. + // + sMem->m_dwSize = sizeof(MAPIDetailsType); + memcpy(sMem->m_buf, &detailInfo, sizeof(MAPIDetailsType)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = sizeof(MAPIDetailsType); + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPIDetails, &ipcInfo); + + // Check for IPC completion + MAPIDetailsType *ptr = (MAPIDetailsType *) &(sMem->m_buf[0]); + if (!ptr->ipcWorked) + { + result = MAPI_E_FAILURE; + } + + // + // Now time to do some real cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + + // + // If we created a temp session, then we need to trash it... + // + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + + LogString("--MAPIDetails complete\r\n"); + return(result); +} + +// +// The MAPIResolveName function transforms a message recipient's name as entered by a +// user to an unambiguous address list entry. +// +MAPI_IMPLEMENT(ULONG) +MAPIResolveName( + LHANDLE lhSession, + ULONG ulUIParam, + LPSTR lpszName, + FLAGS flFlags, + ULONG ulReserved, + lpMapiRecipDesc FAR *lppRecip) +{ + TRACE_FN("MAPIResolveName"); + // + // Needed variables... + // + BOOL isTempSession = FALSE; + LONG result = SUCCESS_SUCCESS; + HWND hWndIPC; + MAPIIPCType ipcInfo; + + // Make sure we have something valid on the query name front! + if ((!lpszName) || (!*lpszName)) + { + return(MAPI_E_UNKNOWN_RECIPIENT); + } + + if (strlen(lpszName) > 255) + { + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // If lhSession is ZERO, then we have to get a temporary session and + // go from there. + // + if (lhSession == 0) + { + LHANDLE lhTempSession; + if (MAPILogon(0, NULL, NULL, 0, 0, &lhTempSession) != SUCCESS_SUCCESS) + { + isTempSession = TRUE; + if (MAPILogon(0, "dummy", "dummy", 0, 0, &lhTempSession) != SUCCESS_SUCCESS) + { + return(MAPI_E_LOGIN_FAILURE); + } + } + + lhSession = lhTempSession; + } + + // + // Now create the big chunk of memory that we will pass across which + // represents the message + // + MAPIResolveNameType nameInfo; + + nameInfo.lhSession = lhSession; + nameInfo.ulUIParam = ulUIParam; + nameInfo.flFlags = flFlags; + nameInfo.ipcWorked = 0; + lstrcpy((LPSTR) nameInfo.lpszName, lpszName); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, ulUIParam); + + // + // Build the shared memory segment of information to pass into + // Communicator for send message call. + // + CSharedMem *sMem; + HANDLE hSharedMemory; + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(sizeof(MAPIResolveNameType), (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // Now copy the information into the memory segment. + // + sMem->m_dwSize = sizeof(MAPIResolveNameType); + memcpy(sMem->m_buf, &nameInfo, sizeof(MAPIResolveNameType)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = sizeof(MAPIResolveNameType); + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPIResolveName, &ipcInfo); + + // Check for IPC completion + MAPIResolveNameType *ptr = (MAPIResolveNameType *) &(sMem->m_buf[0]); + if (!ptr->ipcWorked) + { + result = MAPI_E_FAILURE; + } + + // + // IF FOUND: create the new structure for the matched address info and set the + // memory tracking array correctly for cleanup later down the road. + // + if (result == SUCCESS_SUCCESS) + { + *lppRecip = (MapiRecipDesc FAR *)malloc(sizeof(MapiRecipDesc)); + if (lppRecip == NULL) + { + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // Null out the new memory... + memset((*lppRecip), 0, sizeof(MapiRecipDesc)); + MAPIResolveNameType *resultInfo = (MAPIResolveNameType *) &(sMem->m_buf[0]); + + (*lppRecip)->ulRecipClass = 0; // This field is meaningless in this call + (*lppRecip)->lpszName = strdup((LPSTR) resultInfo->lpszABookName); + (*lppRecip)->lpszAddress = strdup((LPSTR) resultInfo->lpszABookAddress); + + // We will be using a string made up of the first and last name of the + // person as a unique ID for that individual. The string will be delimited + // like this: + // + // :=LAST=: + // + (*lppRecip)->ulEIDSize = strlen((LPSTR) resultInfo->lpszABookID) + 1; + (*lppRecip)->lpEntryID = strdup((LPSTR) resultInfo->lpszABookID); + + SetPointerArray(*lppRecip, MAPI_RECIPIENT_TYPE); + } + + // + // Now time to do some real cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + + // + // If we created a temp session, then we need to trash it... + // + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + + LogString("--MAPIResolveName complete\r\n"); + return(result); +} + +MAPI_IMPLEMENT(ULONG) +MAPIAddress( + LHANDLE lhSession, + ULONG ulUIParam, + LPSTR lpszCaption, + ULONG nEditFields, + LPSTR lpszLabels, + ULONG nRecips, + lpMapiRecipDesc lpRecips, + FLAGS flFlags, + ULONG ulReserved, + LPULONG lpnNewRecips, + lpMapiRecipDesc FAR *lppNewRecips) +{ + TRACE_FN("MAPIAddress"); + TRACE("MAPIAddress: lhSession=%lu\n", lhSession); + // + // Needed variables... + // + BOOL isTempSession = FALSE; + LONG result = SUCCESS_SUCCESS; + HWND hWndIPC; + MAPIIPCType ipcInfo; + + *lppNewRecips = NULL; + + // + // If lhSession is ZERO, then we have to get a temporary session and + // go from there. + // + if ( (lhSession == 0) || (flFlags & MAPI_NEW_SESSION)) + { + LHANDLE lhTempSession; + if (MAPILogon(0, NULL, NULL, 0, 0, &lhTempSession) != SUCCESS_SUCCESS) + { + isTempSession = TRUE; + if (MAPILogon(0, "dummy", "dummy", 0, 0, &lhTempSession) != SUCCESS_SUCCESS) + { + return(MAPI_E_LOGIN_FAILURE); + } + } + + lhSession = lhTempSession; + } + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, ulUIParam); + + // + // Build the shared memory segment of information to pass into + // Communicator for the address call. + // + ULONG i; + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + MAPIAddressType addrInfo; + LONG strSeqSize = 0; + NSstringSeq strSeq = NULL; + DWORD currentString = 0; + + // + // First populate a address structure with the passed in information + // + memset(&addrInfo, 0, (size_t) sizeof(MAPIAddressType)); + + addrInfo.lhSession = lhSession; + addrInfo.ulUIParam = ulUIParam; + addrInfo.flFlags = flFlags; + addrInfo.ipcWorked = 0; + addrInfo.nNewRecips = 0; // number of recips returned... + addrInfo.lpszBlob[0] = '\0'; // file name for blob of information + + addrInfo.nRecips = nRecips; // number of recips to start with... + + // + // Copy the caption into the structure + // + if ((lpszCaption) && (*lpszCaption)) // check for no null + { + strcpy((LPSTR) addrInfo.lpszCaption, lpszCaption); + } + + // Now build the glob of memory of addresses to start with... + if (nRecips > 0) + { + LPSTR *strArray = (LPSTR *) malloc((size_t) (sizeof(LPSTR) * ((nRecips * 3) + 1))); + if (!strArray) + { + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + LPSTR toString = "1"; + LPSTR ccString = "2"; + LPSTR bccString = "3"; + + for (i=0; im_dwSize = memSize; + memcpy(sMem->m_buf, &(addrInfo), sizeof(MAPIAddressType)); + + // Now if we have recipients...copy in the sequence! + if (nRecips > 0) + { + MAPIAddressType *ptr = (MAPIAddressType *)&(sMem->m_buf[0]); + + memcpy(ptr->dataBuf, strSeq, strSeqSize); + NSStrSeqDelete(strSeq); + } + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPIAddress, &ipcInfo); + + // Check the IPC status... + MAPIAddressType *addrPtr = (MAPIAddressType *) &(sMem->m_buf[0]); + + // + // Now return the value to the caller if we bombed... + // + if ((result != SUCCESS_SUCCESS) || (!(addrPtr->ipcWorked))) + { + NSCloseSharedMemory(sMem, hSharedMemory); + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + LogString("--MAPIAddress failed\r\n"); + return(result); + } + + // Now deal with the addresses selected and move on... + if (addrPtr->nNewRecips == 0) + { + NSCloseSharedMemory(sMem, hSharedMemory); + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + + LogString("--MAPIAddress - ZERO recipients\r\n"); + return(result); + } + + // + // Get the blob loaded into memory... + // + NSstringSeq blobSequence = (NSstringSeq) LoadBlobToMemory((LPSTR) addrPtr->lpszBlob); + + // Now check on the blob + if (!blobSequence) + { + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + ULONG stringCount = 0; // This is to start with the rest of the string seq + lpMapiRecipDesc lpNewRecips; + + // Now deal with the recipients of this message + lpNewRecips = (lpMapiRecipDesc) malloc((size_t) (sizeof(MapiRecipDesc) * + addrPtr->nNewRecips)); + if (!lpNewRecips) + { + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + + NSStrSeqDelete(blobSequence); + LogString("--MAPIAddress failed\r\n"); + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + memset(lpNewRecips, 0, (size_t) (sizeof(MapiRecipDesc) * addrPtr->nNewRecips)); + + for (i=0; inNewRecips; i++) + { + // String x: LPSTR lpszName; // Recipient N name + // String x: LPSTR lpszAddress; // Recipient N address (optional) + // String x: LPSTR lpszRecipClass // recipient class - sprintf of ULONG + lpNewRecips[i].lpszName = + strdup( CheckNullString(NSStrSeqGet(blobSequence, stringCount++)) ); + + lpNewRecips[i].lpszAddress = + strdup( CheckNullString(NSStrSeqGet(blobSequence, stringCount++)) ); + + lpNewRecips[i].ulRecipClass = + (ULONG) atoi( CheckNullString(NSStrSeqGet(blobSequence, stringCount++)) ); + } + + // + // Now that we are here, set the pointer array and move on with life... + // + *lppNewRecips = lpNewRecips; + *lpnNewRecips = addrPtr->nNewRecips; + SetPointerArray(lpNewRecips, MAPI_RECIPIENT_TYPE); + + // Cleanup the shared memory... + NSCloseSharedMemory(sMem, hSharedMemory); + if (blobSequence) + NSStrSeqDelete(blobSequence); + + // + // If we created a temp session, then we need to trash it... + // + if (isTempSession) + { + MAPILogoff(lhSession, 0, 0, 0); + } + + TRACE("MAPIAddress Complete"); + return(result); +} + +MAPI_IMPLEMENT(ULONG) +MAPIGetNetscapeVersion(void) +{ + return(450); +} + +MAPI_IMPLEMENT(ULONG) +MAPI_NSCP_SynchronizeClient(LHANDLE lhSession, + ULONG ulReserved) +{ +LRESULT result; +HWND hWndIPC; +MAPIIPCType ipcInfo; + + TRACE_FN("MAPI_NSCP_SynchronizeClient"); + TRACE("lhSession Session ID = %lu\n", lhSession); + LogString("--MAPI_NSCP_SynchronizeClient\r\n"); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + return(MAPI_E_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, 0); + + // + // Build the shared memory segment of information to pass into + // Communicator for the sync call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + MAPI_NSCP_SynchronizeClientType syncInfo; + + memSize = sizeof(MAPI_NSCP_SynchronizeClientType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + return(MAPI_E_INSUFFICIENT_MEMORY); + } + + // + // Now populate a Sync structure with the passed in information + // + syncInfo.lhSession = lhSession; + syncInfo.ipcWorked = 0; + + // + // Now copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + memcpy(sMem->m_buf, &(syncInfo), sizeof(MAPI_NSCP_SynchronizeClientType)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendMAPIRequest(hWndIPC, NSCP_MAPI_NSCP_SynchronizeClient, &ipcInfo); + + // Check for IPC completion + MAPI_NSCP_SynchronizeClientType *sInfo = (MAPI_NSCP_SynchronizeClientType *) &(sMem->m_buf[0]); + if (!sInfo->ipcWorked) + { + result = MAPI_E_FAILURE; + } + + // + // Now do cleanup on the way out... + // + NSCloseSharedMemory(sMem, hSharedMemory); + LogString("--MAPI_NSCP_SynchronizeClientType complete\r\n"); + + // Now just return! + return(result); +} diff --git a/mozilla/cmd/winfe/mapi/mapi32.def b/mozilla/cmd/winfe/mapi/mapi32.def new file mode 100644 index 00000000000..4119f3c81f5 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/mapi32.def @@ -0,0 +1,15 @@ +EXPORTS + MAPILogon + MAPILogoff + MAPISendMail + MAPISendDocuments + MAPIFreeBuffer + MAPIFindNext + MAPIReadMail + MAPISaveMail + MAPIDeleteMail + MAPIAddress + MAPIDetails + MAPIResolveName + MAPIGetNetscapeVersion + MAPI_NSCP_SynchronizeClient diff --git a/mozilla/cmd/winfe/mapi/mapi32.mak b/mozilla/cmd/winfe/mapi/mapi32.mak new file mode 100644 index 00000000000..334abe7825e --- /dev/null +++ b/mozilla/cmd/winfe/mapi/mapi32.mak @@ -0,0 +1,413 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +/* -*- 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. + */ +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=mapi32 - Win32 Debug +!MESSAGE No configuration specified. Defaulting to mapi32 - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "mapi32 - Win32 Release" && "$(CFG)" != "mapi32 - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "mapi32.mak" CFG="mapi32 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "mapi32 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "mapi32 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "mapi32 - Win32 Debug" +CPP=cl.exe +MTL=mktyplib.exe +RSC=rc.exe + +!IF "$(CFG)" == "mapi32 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "x86Rel" +# PROP Intermediate_Dir "x86Rel" +# PROP Target_Dir "" +OUTDIR=.\x86Rel +INTDIR=.\x86Rel + +ALL : "$(OUTDIR)\mapi32.dll" + +CLEAN : + -@erase "$(INTDIR)\maindll.obj" + -@erase "$(INTDIR)\mapi32.obj" + -@erase "$(INTDIR)\mapi32.res" + -@erase "$(INTDIR)\mapiipc.obj" + -@erase "$(INTDIR)\mapimem.obj" + -@erase "$(INTDIR)\mapismem.obj" + -@erase "$(INTDIR)\mapiutl.obj" + -@erase "$(INTDIR)\nsstrseq.obj" + -@erase "$(INTDIR)\trace.obj" + -@erase "$(INTDIR)\xpapi.obj" + -@erase "$(OUTDIR)\mapi32.dll" + -@erase "$(OUTDIR)\mapi32.exp" + -@erase "$(OUTDIR)\mapi32.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /Gz /MT /W3 /GX /O2 /I ".." /I ".\mapi" /I "..\mapi" /D "NDEBUG" /D "NSCPMAPIDLL" /D "WIN32" /D "_WINDOWS" /D "STRICT" /YX /c +CPP_PROJ=/nologo /Gz /MT /W3 /GX /O2 /I ".." /I ".\mapi" /I "..\mapi" /D\ + "NDEBUG" /D "NSCPMAPIDLL" /D "WIN32" /D "_WINDOWS" /D "STRICT"\ + /Fp"$(INTDIR)/mapi32.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\x86Rel/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/mapi32.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/mapi32.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)/mapi32.pdb"\ + /machine:I386 /def:".\mapi32.def" /out:"$(OUTDIR)/mapi32.dll"\ + /implib:"$(OUTDIR)/mapi32.lib" +DEF_FILE= \ + ".\mapi32.def" +LINK32_OBJS= \ + "$(INTDIR)\maindll.obj" \ + "$(INTDIR)\mapi32.obj" \ + "$(INTDIR)\mapi32.res" \ + "$(INTDIR)\mapiipc.obj" \ + "$(INTDIR)\mapimem.obj" \ + "$(INTDIR)\mapismem.obj" \ + "$(INTDIR)\mapiutl.obj" \ + "$(INTDIR)\nsstrseq.obj" \ + "$(INTDIR)\trace.obj" \ + "$(INTDIR)\xpapi.obj" + +"$(OUTDIR)\mapi32.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "mapi32 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "x86Dbg" +# PROP Intermediate_Dir "x86Dbg" +# PROP Target_Dir "" +OUTDIR=.\x86Dbg +INTDIR=.\x86Dbg + +ALL : "$(OUTDIR)\mapi32.dll" + +CLEAN : + -@erase "$(INTDIR)\maindll.obj" + -@erase "$(INTDIR)\mapi32.obj" + -@erase "$(INTDIR)\mapi32.res" + -@erase "$(INTDIR)\mapiipc.obj" + -@erase "$(INTDIR)\mapimem.obj" + -@erase "$(INTDIR)\mapismem.obj" + -@erase "$(INTDIR)\mapiutl.obj" + -@erase "$(INTDIR)\nsstrseq.obj" + -@erase "$(INTDIR)\trace.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(INTDIR)\xpapi.obj" + -@erase "$(OUTDIR)\mapi32.dll" + -@erase "$(OUTDIR)\mapi32.exp" + -@erase "$(OUTDIR)\mapi32.ilk" + -@erase "$(OUTDIR)\mapi32.lib" + -@erase "$(OUTDIR)\mapi32.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /Zi /Od /I ".." /I ".\mapi" /I "..\mapi" /D "_DEBUG" /D "NSCPMAPIDLL" /D "WIN32" /D "_WINDOWS" /D "STRICT" /YX /c +CPP_PROJ=/nologo /Gz /MTd /W3 /Gm /GX /Zi /Od /I ".." /I ".\mapi" /I "..\mapi"\ + /D "_DEBUG" /D "NSCPMAPIDLL" /D "WIN32" /D "_WINDOWS" /D "STRICT"\ + /Fp"$(INTDIR)/mapi32.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\x86Dbg/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/mapi32.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/mapi32.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)/mapi32.pdb" /debug\ + /machine:I386 /def:".\mapi32.def" /out:"$(OUTDIR)/mapi32.dll"\ + /implib:"$(OUTDIR)/mapi32.lib" +DEF_FILE= \ + ".\mapi32.def" +LINK32_OBJS= \ + "$(INTDIR)\maindll.obj" \ + "$(INTDIR)\mapi32.obj" \ + "$(INTDIR)\mapi32.res" \ + "$(INTDIR)\mapiipc.obj" \ + "$(INTDIR)\mapimem.obj" \ + "$(INTDIR)\mapismem.obj" \ + "$(INTDIR)\mapiutl.obj" \ + "$(INTDIR)\nsstrseq.obj" \ + "$(INTDIR)\trace.obj" \ + "$(INTDIR)\xpapi.obj" + +"$(OUTDIR)\mapi32.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "mapi32 - Win32 Release" +# Name "mapi32 - Win32 Debug" + +!IF "$(CFG)" == "mapi32 - Win32 Release" + +!ELSEIF "$(CFG)" == "mapi32 - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\mapi32.cpp +DEP_CPP_MAPI3=\ + "..\mapi\mapiutl.h"\ + "..\mapi\trace.h"\ + "..\mapismem.h"\ + "..\nscpmapi.h"\ + "..\nsstrseq.h"\ + ".\mapiipc.h"\ + ".\mapimem.h"\ + ".\port.h"\ + ".\xpapi.h"\ + + +"$(INTDIR)\mapi32.obj" : $(SOURCE) $(DEP_CPP_MAPI3) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\mapi32.def + +!IF "$(CFG)" == "mapi32 - Win32 Release" + +!ELSEIF "$(CFG)" == "mapi32 - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\trace.cpp +DEP_CPP_TRACE=\ + "..\mapi\trace.h"\ + + +"$(INTDIR)\trace.obj" : $(SOURCE) $(DEP_CPP_TRACE) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\mapi32.rc +DEP_RSC_MAPI32=\ + ".\resource.h"\ + + +"$(INTDIR)\mapi32.res" : $(SOURCE) $(DEP_RSC_MAPI32) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\mapiipc.cpp +DEP_CPP_MAPII=\ + "..\mapi\trace.h"\ + "..\mapismem.h"\ + "..\nscpmapi.h"\ + ".\mapiipc.h"\ + ".\port.h"\ + + +"$(INTDIR)\mapiipc.obj" : $(SOURCE) $(DEP_CPP_MAPII) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\mapimem.cpp +DEP_CPP_MAPIM=\ + "..\mapi\mapiutl.h"\ + "..\mapi\trace.h"\ + "..\nscpmapi.h"\ + "..\nsstrseq.h"\ + ".\mapimem.h"\ + ".\xpapi.h"\ + + +"$(INTDIR)\mapimem.obj" : $(SOURCE) $(DEP_CPP_MAPIM) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\xpapi.cpp +DEP_CPP_XPAPI=\ + "..\mapi\mapiutl.h"\ + "..\mapi\trace.h"\ + ".\xpapi.h"\ + + +"$(INTDIR)\xpapi.obj" : $(SOURCE) $(DEP_CPP_XPAPI) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\ns\cmd\winfe\nsstrseq.cpp +DEP_CPP_NSSTR=\ + "..\nsstrseq.h"\ + + +"$(INTDIR)\nsstrseq.obj" : $(SOURCE) $(DEP_CPP_NSSTR) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\ns\cmd\winfe\mapismem.cpp +DEP_CPP_MAPIS=\ + "..\mapismem.h"\ + + +"$(INTDIR)\mapismem.obj" : $(SOURCE) $(DEP_CPP_MAPIS) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\mapiutl.cpp +DEP_CPP_MAPIU=\ + "..\mapi\mapiutl.h"\ + "..\mapi\trace.h"\ + "..\nscpmapi.h"\ + ".\mapiipc.h"\ + ".\port.h"\ + ".\xpapi.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mapiutl.obj" : $(SOURCE) $(DEP_CPP_MAPIU) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\maindll.cpp + +"$(INTDIR)\maindll.obj" : $(SOURCE) "$(INTDIR)" + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/mozilla/cmd/winfe/mapi/mapi32.rc b/mozilla/cmd/winfe/mapi/mapi32.rc new file mode 100644 index 00000000000..604b90b6dea --- /dev/null +++ b/mozilla/cmd/winfe/mapi/mapi32.rc @@ -0,0 +1,173 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +/* -*- 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. + */ +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +ID_DIALOG_MAPI DIALOGEX 0, 0, 186, 111 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Netscape MAPI Support" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,41,95,50,14 + PUSHBUTTON "Cancel",IDCANCEL,104,95,50,14 + GROUPBOX "Diagnostic Information",IDC_STATIC,2,2,182,91 + CTEXT "This window will contain MAPI relative\ninformation for Netscape Communicator", + IDC_STATIC,11,14,159,30 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + ID_DIALOG_MAPI, DIALOG + BEGIN + LEFTMARGIN, 2 + RIGHTMARGIN, 184 + TOPMARGIN, 2 + BOTTOMMARGIN, 109 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 4,5,0,1 + PRODUCTVERSION 4,5,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "Simple MAPI DLL\0" + VALUE "CompanyName", "Netscape Communications Corporation\0" + VALUE "FileDescription", "mapi32\0" + VALUE "FileVersion", "4, 5, 0, 1\0" + VALUE "InternalName", "mapi32\0" + VALUE "LegalCopyright", "Copyright © 1997\0" + VALUE "LegalTrademarks", "Netscape and Netscape Navigator are registered trademarks of Netscape Communications Corporation.\0" + VALUE "OriginalFilename", "mapi32.dll\0" + VALUE "ProductName", "Netscape Communications Simple MAPI\0" + VALUE "ProductVersion", "4, 5, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + ID_COMPOSITION_HEADER "Composition" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/cmd/winfe/mapi/mapiipc.cpp b/mozilla/cmd/winfe/mapi/mapiipc.cpp new file mode 100644 index 00000000000..da66e765a66 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/mapiipc.cpp @@ -0,0 +1,230 @@ +/* -*- 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. + */ +// +// MAPI IPC Routines +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// +#include +#include +#include // Should live in Communicator + +#include "resource.h" +#include "mapiipc.h" +#include "mapismem.h" +#include "trace.h" + +#ifndef WIN32 +#include +#endif + +// +// Necessary variables... +// +static LONG instanceCount = 0; +HWND hWndMAPI = NULL; +char szClassName[] = "NetscapeMAPIClient"; +char szWindowName[] = "NetscapeMAPI"; + +// +// External declares... +// +extern HINSTANCE hInstance; + +void +ProcessCommand(HWND hWnd, int id, HWND hCtl, UINT codeNotify) +{ + switch (id) + { + case IDOK: + case IDCANCEL: + { + ShowWindow(hWnd, SW_HIDE); + } + + default: + ; + } +} + +BOOL CALLBACK LOADDS +MyDlgProc(HWND hWndMain, UINT wMsg, WPARAM wParam, LPARAM lParam) +{ + switch (wMsg) + { + case WM_INITDIALOG: + { + hWndMAPI = hWndMain; + } + break; + + case WM_CLOSE: +// DestroyWindow(hWndMain); + break; + + case WM_DESTROY: + hWndMain = NULL; + break; + + case WM_COMMAND: + HANDLE_WM_COMMAND(hWndMAPI, wParam, lParam, ProcessCommand); + break; + + default: + return FALSE; + } + + return TRUE; +} + +BOOL +InitInstance(HINSTANCE hInstance) +{ + // + // Create a main window for this application instance. + // + /* RICHIE - TRY SOME CHANGES!!! + hWndMAPI = CreateDialog((HINSTANCE) hInstance, + MAKEINTRESOURCE(ID_DIALOG_QAHOOK), + (HWND) NULL, (DLGPROC) MyDlgProc); + ******/ + hWndMAPI = CreateWindow( + szClassName, // pointer to registered class name + szWindowName, // pointer to window name + WS_CHILD, // window style + -10, // horizontal position of window + -10, // vertical position of window + 1, // window width + 1, // window height + GetDesktopWindow(), // handle to parent or owner window + NULL, // handle to menu or child-window identifier + hInstance, // handle to application instance + NULL // pointer to window-creation data + ); + if (!hWndMAPI) + return FALSE; + else + return TRUE; +} + +BOOL +InitApp(void) +{ +#ifdef WIN32 + WNDCLASS wc; + wc.style = 0; + wc.lpfnWndProc = DefDlgProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = DLGWINDOWEXTRA; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(ID_ICON_APP)); + wc.hCursor = LoadCursor(0, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszMenuName = NULL; + wc.lpszClassName = szClassName; + + if(!RegisterClass(&wc)) + return FALSE; +#endif + + return TRUE; +} // end InitApp + +BOOL +InitDLL(void) +{ + if (hWndMAPI != NULL) + return TRUE; + + if (!InitApp()) + { + return FALSE; + } + + if (!InitInstance(hInstance)) + { + return FALSE; + } + +// ShowWindow(hWndMAPI, SW_SHOW); Just for jollies + return(TRUE); +} + +//************************************************************* +//* Calls exposed for rest of DLL... +//************************************************************* +// +// Purpose: Open the API +// Return: 1 on success +// 0 on failure +// +DWORD nsMAPI_OpenAPI(void) +{ + if (instanceCount > 0) + { + return(1); + } + + ++instanceCount; + return(1); +} + +// +// Purpose: Close the API +// +void nsMAPI_CloseAPI(void) +{ + --instanceCount; + if (instanceCount <= 0) + { + instanceCount = 0; + } + + return; +} + +// +// Send the actual request to Communicator +// +LRESULT +SendMAPIRequest(HWND hWnd, + DWORD mapiRequestID, + MAPIIPCType *ipcInfo) +{ +LRESULT returnVal = 0; +COPYDATASTRUCT cds; + + if (!InitDLL()) + { + return 0; + } + + cds.dwData = mapiRequestID; + cds.cbData = sizeof(MAPIIPCType); + cds.lpData = ipcInfo; + + // Make the call into Communicator + returnVal = SendMessage(hWnd, WM_COPYDATA, (WPARAM) hWndMAPI, (LPARAM) &cds); + + // Now kill the window... + DestroyWindow(hWndMAPI); + hWndMAPI = NULL; + UnregisterClass(szClassName, hInstance); + + return returnVal; +} diff --git a/mozilla/cmd/winfe/mapi/mapiipc.h b/mozilla/cmd/winfe/mapi/mapiipc.h new file mode 100644 index 00000000000..07e794b0433 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/mapiipc.h @@ -0,0 +1,44 @@ +/* -*- 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. + */ +#ifndef __MAPIIPC_HPP__ +#define __MAPIIPC_HPP__ + +#include "port.h" +#include + +//******************************************************** +// Open and close functions for API +//******************************************************** +// Open the API +// Return: 1 on success, 0 on failure +// +DWORD nsMAPI_OpenAPI(void); + +// +// Purpose: Close the API +// +void nsMAPI_CloseAPI(void); + +// +// Send the actual request to Communicator +// +LRESULT SendMAPIRequest(HWND hWnd, + DWORD mapiRequestID, + MAPIIPCType *ipcInfo); + +#endif // __MAPIIPC_HPP__ diff --git a/mozilla/cmd/winfe/mapi/mapimem.cpp b/mozilla/cmd/winfe/mapi/mapimem.cpp new file mode 100644 index 00000000000..65f18023ec0 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/mapimem.cpp @@ -0,0 +1,344 @@ +/* -*- 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. + */ +// +// mem.cpp +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// This implements various memory management functions for use with +// MAPI features of Communicator +// +#include +#include +#include +#include "mapimem.h" +#include // lives in communicator winfe +#include "nsstrseq.h" +#include "trace.h" +#include "mapiutl.h" +#include "xpapi.h" + +LPSTR +CheckNullString(LPSTR inStr) +{ + static UCHAR str[1]; + + str[0] = '\0'; + if (inStr == NULL) + return((LPSTR)str); + else + return(inStr); +} + +void +FreeMAPIFile(lpMapiFileDesc pv) +{ + if (!pv) + return; + + if (pv->lpszPathName != NULL) + free(pv->lpszPathName); + + if (pv->lpszFileName != NULL) + free(pv->lpszFileName); +} + +void +FreeMAPIMessage(lpMapiMessage pv) +{ + ULONG i; + + if (!pv) + return; + + if (pv->lpszSubject != NULL) + free(pv->lpszSubject); + + if (pv->lpszNoteText) + free(pv->lpszNoteText); + + if (pv->lpszMessageType) + free(pv->lpszMessageType); + + if (pv->lpszDateReceived) + free(pv->lpszDateReceived); + + if (pv->lpszConversationID) + free(pv->lpszConversationID); + + if (pv->lpOriginator) + FreeMAPIRecipient(pv->lpOriginator); + + for (i=0; inRecipCount; i++) + { + if (&(pv->lpRecips[i]) != NULL) + { + FreeMAPIRecipient(&(pv->lpRecips[i])); + } + } + + if (pv->lpRecips != NULL) + { + free(pv->lpRecips); + } + + for (i=0; inFileCount; i++) + { + if (&(pv->lpFiles[i]) != NULL) + { + FreeMAPIFile(&(pv->lpFiles[i])); + } + } + + if (pv->lpFiles != NULL) + { + free(pv->lpFiles); + } + + free(pv); + pv = NULL; +} + +void +FreeMAPIRecipient(lpMapiRecipDesc pv) +{ + if (!pv) + return; + + if (pv->lpszName != NULL) + free(pv->lpszName); + + if (pv->lpszAddress != NULL) + free(pv->lpszAddress); + + if (pv->lpEntryID != NULL) + free(pv->lpEntryID); +} + +// +// This routine will take an lpMapiMessage structure and "flatten" it into +// one contiguous chunk of memory that can be easily passed around. After this +// is done, "extract" routines will be written to get complicated string routines +// out of the chunk of memory at the end. +// +LPVOID +FlattenMAPIMessageStructure(lpMapiMessage msg, DWORD *totalSize) +{ + MAPISendMailType *mailPtr; + LPSTR *strArray; + DWORD strCount = 0; + DWORD currentString = 0; + DWORD arrayBufSize = 0; + DWORD i; + + *totalSize = 0; + if (!msg) + return(NULL); + + // + // Allocate the initial structure to hold all of the mail info. + // + *totalSize = sizeof(MAPISendMailType); + mailPtr = (MAPISendMailType *) malloc(sizeof(MAPISendMailType)); + if (!mailPtr) + return(NULL); + memset(mailPtr, 0, sizeof(MAPISendMailType)); + + // + // First, assign all of the easy numeric values... + // + mailPtr->MSG_flFlags = msg->flFlags; // unread,return receipt + mailPtr->MSG_nRecipCount = msg->nRecipCount; // Number of recipients + mailPtr->MSG_nFileCount = msg->nFileCount; // # of file attachments + if (msg->lpOriginator != NULL) + { + mailPtr->MSG_ORIG_ulRecipClass = msg->lpOriginator->ulRecipClass; // Recipient class - MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG + } + + // + // Now, figure out how many string pointers we need... + // + strCount = 4; // These are the 4 KNOWN strings up front for a message + strCount += 2; // This is for the originator name and address + + strCount += msg->nRecipCount * 3; // Name, address & class (cc, bcc) for each recipient + strCount += msg->nFileCount * 2; // filename and display name for each attachment + + // + // Now allocate a new string sequence...add one entry for NULL at the end + // + arrayBufSize = sizeof(LPSTR) * (strCount + 1); + +#ifdef WIN16 // Check for max mem allocation... + if ((sizeof(MAPISendMailType) + arrayBufSize) > 64000) + { + free(mailPtr); + return NULL; + } +#endif + + // + // Allocate a buffer for the string pointers and if this fails, + // cleanup and return. + // + strArray = (LPSTR *)malloc( (size_t) arrayBufSize); + if (!strArray) + { + free(mailPtr); + return NULL; + } + + memset(strArray, 0, (size_t) arrayBufSize); // Set the array to NULL + strArray[currentString++] = CheckNullString(msg->lpszSubject); // Message Subject + strArray[currentString++] = CheckNullString(msg->lpszNoteText); // Message Text + strArray[currentString++] = CheckNullString(msg->lpszDateReceived); // in YYYY/MM/DD HH:MM format + strArray[currentString++] = CheckNullString(msg->lpszConversationID); // conversation thread ID + + if (msg->lpOriginator) + { + strArray[currentString++] = CheckNullString(msg->lpOriginator[0].lpszName); + strArray[currentString++] = CheckNullString(msg->lpOriginator[0].lpszAddress); + } + else + { + strArray[currentString++] = CheckNullString(NULL); + strArray[currentString++] = CheckNullString(NULL); + } + + // + // Assign pointers for the Name and address of each recipient + // + LPSTR toString = "1"; + LPSTR ccString = "2"; + LPSTR bccString = "3"; + + for (i=0; inRecipCount; i++) + { + // rhp - need message class + if (msg->lpRecips[i].ulRecipClass == MAPI_BCC) + strArray[currentString++] = CheckNullString(bccString); + else if (msg->lpRecips[i].ulRecipClass == MAPI_CC) + strArray[currentString++] = CheckNullString(ccString); + else + strArray[currentString++] = CheckNullString(toString); + + strArray[currentString++] = CheckNullString(msg->lpRecips[i].lpszName); + strArray[currentString++] = CheckNullString(msg->lpRecips[i].lpszAddress); + } + + BYTE szNewFileName[_MAX_PATH]; + + for (i=0; inFileCount; i++) + { + char *namePtr; + // have to copy/create temp files here of office won't work... + + if ( + (msg->lpFiles[i].lpszFileName != NULL) && + (*msg->lpFiles[i].lpszFileName != '\0') + ) + { + namePtr = (char *)msg->lpFiles[i].lpszFileName; + } + else + { + namePtr = (char *)msg->lpFiles[i].lpszPathName; + } + + if (GetTempMailNameWithExtension((char *)szNewFileName, namePtr) == 0) + { + free(strArray); + free(mailPtr); + return NULL; + } + + if (!XP_CopyFile((char *)msg->lpFiles[i].lpszPathName, (char *)szNewFileName, TRUE)) + { + free(strArray); + free(mailPtr); + return NULL; + } + + strArray[currentString++] = CheckNullString((char *)strdup(szNewFileName)); + strArray[currentString++] = CheckNullString(msg->lpFiles[i].lpszFileName); + + AddTempFile((LPSTR) szNewFileName); +// strArray[currentString++] = CheckNullString(msg->lpFiles[i].lpszPathName); +// strArray[currentString++] = CheckNullString(msg->lpFiles[i].lpszFileName); + } + + if (currentString != strCount) + { + TRACE("MAPI PROBLEM!!!!!! FlattenMAPIMessageStructure() currentString != strCount\n"); + } + + strArray[strCount] = NULL; // terminate at the end + NSstringSeq strSeq = NSStrSeqNew(strArray); + if (!strSeq) + { + free(strArray); + free(mailPtr); + return NULL; + } + + // + // Now we need to copy the structure into a big, contiguous chunk of memory + // + LONG totalArraySize = NSStrSeqSize(strSeq); + LONG totalMemSize = sizeof(MAPISendMailType) + totalArraySize; + +#ifdef WIN16 + if (totalMemSize > 64000) + { + free(strArray); + NSStrSeqDelete(strSeq); + free(mailPtr); + return NULL; + } +#endif + + MAPISendMailType *newMailPtr = (MAPISendMailType *)malloc((size_t)totalMemSize); + if (!newMailPtr) + { + free(strArray); + NSStrSeqDelete(strSeq); + free(mailPtr); + return NULL; + } + + memset(newMailPtr, 0, (size_t) totalMemSize); + // + // Finally do the copy... + // + memcpy(newMailPtr, mailPtr, sizeof(MAPISendMailType)); + memcpy(newMailPtr->dataBuf, strSeq, (size_t) totalArraySize); + *totalSize = totalMemSize; + + // + // Cleanup and scram... + // + if (strArray) + free(strArray); + + if (strSeq) + NSStrSeqDelete(strSeq); + + if (mailPtr) + free(mailPtr); + + return(newMailPtr); +} diff --git a/mozilla/cmd/winfe/mapi/mapimem.h b/mozilla/cmd/winfe/mapi/mapimem.h new file mode 100644 index 00000000000..6cc302a4875 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/mapimem.h @@ -0,0 +1,57 @@ +/* -*- 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. + */ +#ifndef __MY_MEM_HPP__ +#define __MY_MEM_HPP__ + +#ifndef MAPI_OLE // Because MSFT doesn't do this for us :-( +#include +#endif + +// +// Needed for turning NULL's into ""'s for string sequence routines... +// +LPSTR CheckNullString(LPSTR inStr); + +// +// Memory allocation functions... +// + +// +// This will free an lpMapiMessage structure allocated by this DLL +// +void FreeMAPIMessage(lpMapiMessage pv); + +// +// This will free an lpMapiRecipDesc structure allocated by this DLL +// +void FreeMAPIRecipient(lpMapiRecipDesc pv); + +// +// Frees a mapi file object... +// +void FreeMAPIFile(lpMapiFileDesc pv); + +// +// This routine will take an lpMapiMessage structure and "flatten" it into +// one contiguous chunk of memory that can be easily passed around. +// +LPVOID FlattenMAPIMessageStructure(lpMapiMessage msg, DWORD *totalSize); + + + +#endif // __MY_MEM_HPP__ \ No newline at end of file diff --git a/mozilla/cmd/winfe/mapi/mapiutl.cpp b/mozilla/cmd/winfe/mapi/mapiutl.cpp new file mode 100644 index 00000000000..202a251c5c5 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/mapiutl.cpp @@ -0,0 +1,985 @@ +/* -*- 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. + */ +// +// Various utils needed for the MAPI functions +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// +#include +#include +#include +#include +#include "xpapi.h" +#include "trace.h" +#include "mapiipc.h" +#include "mapiutl.h" +#include "resource.h" + +#define ONE_SEC 20 +#define STARTUP "Start" +#define STARTUP_TIME 20 +#define EXIT "Exit" +#define EXIT_TIME 10 + +// +// Global variables +// +BOOL gLoggingEnabled = FALSE; + +DWORD +GetPauseTime(LPSTR attrib) +{ + DWORD val = 0; + + if (!GetConfigInfoNum(szMapiSection, attrib, &val, HKEY_LOCAL_MACHINE)) + { + if (lstrcmp(attrib, STARTUP) == 0) + val = STARTUP_TIME; + else if (lstrcmp(attrib, EXIT) == 0) + val = EXIT_TIME; + else + val = STARTUP_TIME; + } + + return val; +} + +void +FlushIt(void) +{ + /* get the next message, if any */ + MSG msg; + BOOL ret; + + /* if we got one, process it */ + while ((ret = PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) == TRUE) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } +} + +#ifdef WIN16 + +void +Win16Sleep(DWORD sleepTime) +{ + MSG msg; + BOOL ret; + DWORD startTick = GetTickCount(); + + while ( (GetTickCount() - startTick) < sleepTime ) + { + ret = (BOOL)PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); + if (ret) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else + { + Yield(); + } + } +} + +#endif + +void +SetLoggingEnabled(BOOL val) +{ + gLoggingEnabled = val; +} + +// Log File +void +LogString(LPCSTR pStr1) +{ + // Off of the declaration line... + LPCSTR pStr2 = NULL; + BOOL useStr1 = TRUE; + + if (gLoggingEnabled) + { + char tempPath[_MAX_PATH] = ""; + if (getenv("TEMP")) + { + lstrcpy((LPSTR) tempPath, getenv("TEMP")); // environmental variable + } + + int len = lstrlen(tempPath); + if ((len > 1) && tempPath[len - 1] != '\\') + { + lstrcat(tempPath, "\\"); + } + lstrcat(tempPath, szMapiLog); + HFILE hFile = _lopen(tempPath, OF_WRITE); + if (hFile == HFILE_ERROR) + { + hFile = _lcreat(tempPath, 0); + } + if (hFile != HFILE_ERROR) + { + _llseek(hFile, 0, SEEK_END); // seek to the end of the file + LPCSTR pTemp = useStr1 ? pStr1 : pStr2; + _lwrite(hFile, pTemp, lstrlen(pTemp)); + _lclose(hFile); + } + } +} + +void +BuildMemName(LPSTR name, ULONG winSeed) +{ + static DWORD id = 0; + + if (id == 0) + { + // Seed the random-number generator with current time so that + // the numbers will be different every time we run. + srand( (unsigned)time( NULL ) ); + id = rand(); + } + + wsprintf(name, "MAPI_IPC_SMEM-%d", (winSeed + id++)); + TRACE("Shared Memory Name = [%s]\n", name); +} + +DWORD +ValidateFile(LPCSTR szFile) +{ + struct _stat buf; + int result; + + result = _stat( szFile, &buf ); + if (result != 0) + return(1); + + if (!(buf.st_mode & S_IREAD)) + return(2); + + return(0); +} + +// +// return of zero is ok +// 1 = MAPI_E_ATTACHMENT_NOT_FOUND +// 2 = MAPI_E_ATTACHMENT_OPEN_FAILURE +// +DWORD +SanityCheckAttachmentFiles(lpMapiMessage lpMessage) +{ + ULONG i; + DWORD rc; + + for (i=0; inFileCount; i++) + { + if ((rc = ValidateFile(lpMessage->lpFiles[i].lpszPathName)) != 0) + { + return(rc); + } + } + + return(0); +} + +DWORD +GetFileCount(LPSTR pFiles, LPSTR delimChar) +{ + DWORD count = 1; + if ((!pFiles) || (!*pFiles)) + return(0); + + for (DWORD i=0; i= strlen(pFiles)) // Got to the end of string! + return(FALSE); + + lstrcpy(fName, (LPSTR)pFiles + loc); + // + // Truncate at 2nd delimiter + // + for (DWORD i=0; i tag + if ( (i+strlen(endTag)) < len) + { + if (strncmp(endTag, ptr, strlen(endTag)) == 0) + { + break; + } + } + + // If we are in HTML, check for a ">"... + if (inHTML) + { + if (*ptr == '>') + { + inHTML = FALSE; + } + continue; + } + + // Check for NEW HTML... + if (*ptr == '<') + { + inHTML = TRUE; + continue; + } + + if (CheckForInlineHTML(ptr, len, &i, newBuf, &realLen)) + continue; + + newBuf[realLen++] = *ptr; + // Tack on a line feed if we hit a CR... + if ( *ptr == 0x0D ) + { + newBuf[realLen++] = 0x0A; + } + } + + // terminate the buffer - reallocate and move on... + newBuf[realLen++] = '\0'; + newBuf = (LPSTR) realloc(newBuf, (size_t) realLen); + + // check if the realloc worked and if so, free old memory and + // return...if not, just return the original buffer + if (!newBuf) + { + return(noteText); + } + else + { + free(noteText); + return(newBuf); + } +} + +// +// RICHIE - this is a temporary fix for now to get rid of +// html stuff within the text of a message - if there was a +// valid noteText buffer coming into this call, we need to +// free it on the way out. +// +LPSTR +StripHTML(LPSTR noteText) +{ + char *newBuf; + LPSTR signTag = "This is a cryptographically signed message in MIME format."; + LPSTR mimeTag = "This is a multi-part message in MIME format."; + + DWORD i; + DWORD realLen = 0; + DWORD totalCR = 0; + + // do sanity checking... + if ((!noteText) || (!(*noteText))) + return(noteText); + + // more sanity checking... + DWORD len = strlen(noteText) + 1; + if (len <= 0) + return(noteText); + + // Get the number of CR's in this message and add room for + // the LF's + for (i=0; i= MAXTRY) + return(1); + goto TRYAGAIN; + } + + return res; +} + +#define kMaxTempFiles 10 +#define kMaxListLength (10 * _MAX_PATH) + +void GetTempFiles(LPSTR pBuf, int lenBuf) +{ + if (!GetConfigInfoStr(szMapiSection, szTempFiles, pBuf, lenBuf, HKEY_CURRENT_USER)) + { + *pBuf = 0; + } +} + +void WriteTempFiles(LPSTR pBuf) +{ + SetConfigInfoStr(szMapiSection, szTempFiles, pBuf, HKEY_CURRENT_USER); + /* HKEY_ROOT); - permission problem */ +} + +void AddTempFile(LPCSTR pFileName) +{ + char files[kMaxListLength]; + + GetTempFiles(files, sizeof(files)); + if ((lstrlen(files) + lstrlen(pFileName) + 2) >= sizeof(files)) + { + return; + } + if (lstrlen(files) != 0) + { + lstrcat(files, ";"); + } + lstrcat(files, pFileName); + WriteTempFiles(files); +} + +void DeleteFirstTempFile(LPSTR pFiles) +{ + if (!*pFiles) + return; + LPSTR pTemp = strchr(pFiles, ';'); + if (pTemp) + { + *pTemp = 0; + } + + _unlink(pFiles); + if (pTemp) + { + memmove(pFiles, pTemp + 1, lstrlen(pTemp + 1) + 1); + } + else + { + *pFiles = 0; + } +} + +void +RemoveAllTempFiles(void) +{ + char files[kMaxListLength]; + GetTempFiles(files, sizeof(files)); + + while (*files) + { + DeleteFirstTempFile(files); + } + WriteTempFiles(files); +} + +void CheckAgeTempFiles(void) +{ + char files[kMaxListLength]; + GetTempFiles(files, sizeof(files)); + int i = 0; + LPSTR pTemp = files; + while (TRUE) + { + pTemp = strchr(pTemp, ';'); + if (!pTemp) + break; + ++pTemp; + ++i; + } + if (i >= 4) + { + DeleteFirstTempFile(files); + WriteTempFiles(files); + } +} + +// Need this to make sure that we can kill all temp files... +// Enum all windows and check title for "Composition"... +BOOL foundItRunning = FALSE; + +BOOL CALLBACK +EnumWindowsProc(HWND hwnd, // handle to parent window + LPARAM lParam) // application-defined value +{ + UINT msg = RegisterWindowMessage(MAPI_CUSTOM_COMPOSE_MSG); + + // Need to do this to avoid SendMessage() causing recursion + DWORD otherID; + DWORD myID = GetCurrentProcessId(); + (void) GetWindowThreadProcessId(hwnd, &otherID); + + if (myID == otherID) + return TRUE; + + LONG rc = SendMessage(hwnd, msg, 0, 0); + + if (rc == MAPI_CUSTOM_RET_CODE) + { + foundItRunning = TRUE; + return FALSE; + } + + return TRUE; +} + +BOOL +CompositionWindowRunning(void) +{ + foundItRunning = FALSE; + if (Is_16_OR_32_BIT_CommunitorRunning() == 0) + return FALSE; + + (void) EnumWindows(EnumWindowsProc, NULL); + return (foundItRunning); +} + +void +CleanupMAPITempFiles(void) +{ + if (!CompositionWindowRunning()) + { + RemoveAllTempFiles(); // if Communicator not running, clean up all the temp files + } + else + { + CheckAgeTempFiles(); + } +} + +#define EXITING -10 //multi-instance code return values +#define RUNNING 10 + +const UINT NEAR msg_IPCStatus = RegisterWindowMessage("NetscapeIPCMsg"); +const UINT NEAR msg_ExitStatus = RegisterWindowMessage("ExitingNetscape"); + +HWND +GetTheValidWindow(void) +{ + HWND hWnd = NULL; + DWORD waitTime = GetPauseTime(STARTUP); + DWORD timeCount = 0; + + while ( ((hWnd = FindWindow("aHiddenFrameClass", NULL)) != NULL) && + (timeCount < ( (ONE_SEC * waitTime) / 2) ) ) + { + if (SendMessage(hWnd, msg_IPCStatus, 0, 0) == 19) + { + if (SendMessage(hWnd, msg_ExitStatus, 0, 0) == EXITING) + return NULL; + else + { + return hWnd; + } + } + else + { + timeCount++; + } + + FlushIt(); + Sleep(50); + } + + return NULL; +} + +// +// Find Communicator and return an HWND, if not, start Communicator, +// then find an HWND +// +HWND +GetCommunicatorIPCWindow(BOOL justBail) +{ + HWND hWnd = NULL; + DWORD timeCount = 0; + + hWnd = GetTheValidWindow(); + if (hWnd != NULL) + return hWnd; + + if (justBail) + return NULL; + + char szPath[_MAX_PATH] = ""; + DWORD nMAPIERROR; + + if ((nMAPIERROR = XP_GetInstallLocation(szPath, _MAX_PATH)) != SUCCESS_SUCCESS) + return(NULL); + + TRACE("STARTING COMMUNICATOR\n"); + if (!XP_CallProcess(szPath, " -MAPICLIENT")) + { + TRACE("FAILED TO COMMUNICATOR\n"); + return(NULL); + } + + DWORD waitTime = GetPauseTime(STARTUP); + + TRACE("WAIT FOR COMMUNICATOR TO START UP!\n"); + TRACE("WAITING %d SECONDS FOR COMMUNICATOR\n", waitTime); + while ( (Is_16_OR_32_BIT_CommunitorRunning() == 0) && + (timeCount < (ONE_SEC * waitTime) ) ) + { +#ifdef WIN32 + FlushIt(); + Sleep(50); +#else + Win16Sleep(50); +#endif + timeCount++; + } + + return(GetTheValidWindow()); +} diff --git a/mozilla/cmd/winfe/mapi/mapiutl.h b/mozilla/cmd/winfe/mapi/mapiutl.h new file mode 100644 index 00000000000..2d46b118809 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/mapiutl.h @@ -0,0 +1,67 @@ +/* -*- 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. + */ +#ifndef __UTILS_ +#define __UTILS_ +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef MAPI_OLE // Because MSFT doesn't do this for us :-( +#include +#endif + +// +// Utility functions... +// +void SetLoggingEnabled(BOOL val); // Set a logging enabled flag +void LogString(LPCSTR pStr1); // Log a string to a file... +void BuildMemName(LPSTR name, ULONG winSeed); // Shared memory name +HWND GetCommunicatorIPCWindow(BOOL justBail); // Get the IPC window we will use... +DWORD SanityCheckAttachmentFiles(lpMapiMessage lpMessage); // Check attachments +DWORD ValidateFile(LPCSTR szFile); // Is this a valid file - 0=Yes 1 = NOT_FOUND 2 = OPEN_FAILURE + +DWORD GetFileCount(LPSTR pFiles, LPSTR delimChar); // Get File count from string of file1;file2, etc.. +BOOL ExtractFile(LPSTR pFiles, LPSTR delimChar, DWORD fIndex, LPSTR fName); // Extract a filename from a string + +LPVOID LoadBlobToMemory(LPSTR fName); // Load the blob into memory! +LONG GetTempAttachmentName(LPSTR fName); // Get a temp file name and put it in fName + +UINT GetTempMailNameWithExtension(LPSTR szTempFileName, LPSTR origName); +void CleanupMAPITempFiles(void); +void AddTempFile(LPCSTR pFileName); + +// +// RICHIE - this is a temporary fix for now to get rid of +// html stuff within the text of a message - if there was a +// valid noteText buffer coming into this call, we need to +// free it on the way out. +// +LPSTR StripHTML(LPSTR noteText); + +// +// Write a buffer to disk +// Return 0 on success -1 on failure +// +LONG WriteMemoryBufferToDisk(LPSTR fName, LONG bufSize, LPSTR buf); + +#ifdef __cplusplus +} +#endif + +#endif // __UTILS_ \ No newline at end of file diff --git a/mozilla/cmd/winfe/mapi/port.h b/mozilla/cmd/winfe/mapi/port.h new file mode 100644 index 00000000000..f8ae3537b07 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/port.h @@ -0,0 +1,284 @@ +/* -*- 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. + */ +// + +#ifndef PORT_H +#define PORT_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*****************************************************************\ + * * + * PORT.H * + * * + * Win16/Win32 portability stuff * + * * + * A.Sokolsky * + * 3.10.94 distilled into this header * + * * +\*****************************************************************/ + +/* + * calling conventions + */ +#include + + +#ifndef CDECL +#define CDECL __cdecl +#endif // CDECL + +#ifndef PASCAL +#define PASCAL __pascal +#endif // PASCAL + +#ifdef FASTCALL +#error FASTCALL defined +#endif // FASTCALL + + +#ifdef NDEBUG +#define FASTCALL __fastcall +#else +#define FASTCALL PASCAL +#endif // NDEBUG + + + +#ifndef HWND2DWORD +# ifdef WIN32 +# define HWND2DWORD(X_hWnd) ( (DWORD)(X_hWnd) ) +# else // WIN16 +# define HWND2DWORD(X_hWnd) ( (DWORD)MAKELONG(((WORD)(X_hWnd)), 0) ) +# endif +#endif // HWND2DWORD + + +/* + * WIN16 - WIN32 compatibility stuff + */ + +#ifdef WIN32 + +# define DLLEXPORT __declspec( dllexport ) +# define EXPORT +# define LOADDS +# define HUGE +# ifndef FAR +# define FAR +# endif // FAR +# ifndef NEAR +# define NEAR +# endif // NEAR +# ifdef UNICODE +# define SIZEOF(x) (sizeof(x)/sizeof(WCHAR)) +# else +# define SIZEOF(x) sizeof(x) +# endif + +#else // !WIN32 == WIN16 + +# define DLLEXPORT +# define EXPORT __export +# define LOADDS __loadds +# define HUGE __huge +# ifndef FAR +# define FAR __far +# define NEAR __near +# endif // FAR +# define CONST const +# define SIZEOF(x) sizeof(x) +# define CHAR char +# define TCHAR char +# define WCHAR char +# ifndef LPTSTR +# define LPTSTR LPSTR +# endif +# ifndef LPCTSTR +# define LPCTSTR LPCSTR +# endif +# define UNREFERENCED_PARAMETER(x) x; +# ifndef TEXT +# define TEXT(x) x +# endif +# define GetWindowTextW GetWindowText +# define lstrcpyW lstrcpy + +# define BN_DBLCLK BN_DOUBLECLICKED // ~~MRJ needed for custom control. +// ~~MRJ begin Win95 backward compat section +# define LPWSTR LPSTR +# define LPCWSTR LPCSTR + +// button check state for WIN16 +#ifndef BST_UNCHECKED +#define BST_UNCHECKED 0x0000 +#endif + +#ifndef BST_CHECKED +#define BST_CHECKED 0x0001 +#endif + + +#ifndef WIN95_COMPAT +# define WIN95_COMPAT +#endif + +// ~~MRJ end Win95 compat section. + +// critical section API stubs +typedef DWORD CRITICAL_SECTION; +typedef CRITICAL_SECTION FAR * LPCRITICAL_SECTION; +#ifdef __cplusplus +inline void InitializeCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void DeleteCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void EnterCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void LeaveCriticalSection(LPCRITICAL_SECTION lpSection) {} +#endif // __cplusplus + +// Added for nssock16 ---Neeti +#ifndef ZeroMemory +#include +#define ZeroMemory(PTR, SIZE) memset(PTR, 0, SIZE) +#endif // ZeroMemory + +#endif // WIN16 + +/* + * unix - windows compatibility stuff + */ +typedef DWORD u_int32; +typedef WORD u_int16; +typedef BYTE u_int8; +#ifdef WIN32 +typedef short int Bool16; +#else // WIN16 +typedef BOOL Bool16; +#endif // WIN16 + +/* + * Cross Platform Compatibility + */ +#ifndef UNALIGNED +# ifdef _M_ALPHA +# define UNALIGNED __unaligned +# else // !_M_ALPHA +# define UNALIGNED +# endif // !_M_ALPHA +#endif // UNALIGNED + +// +// RICHIE - for the Alpha port +// +#ifdef _M_ALPHA +# undef pascal +# undef PASCAL +# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) +# define pascal __stdcall +# define PASCAL __stdcall +# else +# define PASCAL +# endif +#endif + + +/* + * Useful Types + */ +typedef char HUGE *HPSTR; +typedef const char HUGE *HPCSTR; +typedef unsigned char HUGE *HPBYTE; +typedef WORD HUGE *HPWORD; +typedef UINT FAR *LPUINT; +typedef BOOL (CALLBACK *USERABORTPROC)(); +typedef BOOL (CALLBACK *PROGRESSPROC)(UINT uPos, UINT uRange); +typedef int INT; // ~~MRJ a function needed this defined. +typedef MINMAXINFO FAR *LPMINMAXINFO; // ~~MRJ + +// +// stuff missing from windows.h +// +#ifndef MAKEWORD +#define MAKEWORD(low, high) ((WORD)(((BYTE)(low)) | (((WORD)((BYTE)(high))) << 8))) +#endif // MAKEWORD + +#ifdef WIN32 +# ifndef hmemcpy +# define hmemcpy memcpy +# endif // !defined(hmemcpy) +# define _fmemset memset + +# include + +#ifdef __cplusplus + +inline BOOL IsGDIObject(HGDIOBJ hObj) { return (hObj != 0); } +inline void *_halloc(long num, unsigned int size) { return malloc(num * size); } +inline void _hfree( void *memblock ) { free(memblock); } +/* +inline BOOL IsInstance(HINSTANCE hInst) { +# ifdef WIN32 + return (hInst != 0); +# else // WIN16 + return (hInst > HINSTANCE_ERROR); +# endif +} +*/ + +#endif // __cplusplus + + WINUSERAPI HANDLE WINAPI LoadImageA(HINSTANCE, LPCSTR, UINT, int, int, UINT); + +#endif // WIN32 + +#ifdef __cplusplus +inline BOOL IsInstance(HINSTANCE hInst) { +# ifdef WIN32 + return (hInst != 0); +# else // WIN16 + return (hInst > HINSTANCE_ERROR); +# endif +} +inline void SetWindowSmallIcon(HINSTANCE hInst, HWND hWnd, UINT uIconResourceId) { +#ifdef WIN32 +# ifndef WM_SETICON +# define WM_SETICON 0x0080 +# endif // WM_SETICON +# ifndef IMAGE_ICON +# define IMAGE_ICON 1 +# endif + assert(IsWindow(hWnd)); + HICON hIcon = (HICON)LoadImageA(hInst, MAKEINTRESOURCE(uIconResourceId), IMAGE_ICON, + 16, 16, 0); + if(NULL != hIcon) { + SendMessage(hWnd, WM_SETICON, FALSE, (LPARAM)hIcon); + } else { + HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(uIconResourceId)); + assert(hIcon != 0); + SendMessage(hWnd, WM_SETICON, FALSE, (LPARAM)hIcon); + } +#endif // WIN32 +} +#endif // __cplusplus + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* PORT_H */ diff --git a/mozilla/cmd/winfe/mapi/resource.h b/mozilla/cmd/winfe/mapi/resource.h new file mode 100644 index 00000000000..1f0a5530618 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/resource.h @@ -0,0 +1,36 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by mapi32.rc +// +/* -*- 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. + */ +#define ID_COMPOSITION_HEADER 1 +#define ID_DIALOG_QAHOOK 101 +#define ID_DIALOG_MAPI 101 +#define ID_ICON_APP 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mozilla/cmd/winfe/mapi/smem.cpp b/mozilla/cmd/winfe/mapi/smem.cpp new file mode 100644 index 00000000000..84aec2d2d07 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/smem.cpp @@ -0,0 +1,153 @@ +/* -*- 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. + */ +// +// smem.cpp - This deals with all shared memory functions needed for +// the MAPI component of Communicator +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// +#include +#include + +#include "mapismem.h" + +#ifndef ZeroMemory +#include +#define ZeroMemory(PTR, SIZE) memset(PTR, 0, SIZE) +#endif // ZeroMemory + +// +// *create new* shared memory chunk +// once this is created, use the pointer +// to the segment to to store data +// e.g.: +// lpString = "string for communicator"; +// lstrcpy((LPSTR)pData->m_buf[0], lpString); +// +CSharedMem * +NSCreateSharedMemory(DWORD memSize, LPCTSTR memName, HANDLE *hSharedMemory) +{ +#ifdef WIN32 + + BOOL bExistedBefore; + CSharedMem *pData; + + LPCTSTR szObjectName = memName; + DWORD dwSize = sizeof(CSharedMem) + memSize; + *hSharedMemory = CreateFileMapping( + (HANDLE)0xFFFFFFFF,0,PAGE_READWRITE,0,dwSize,szObjectName); + if(*hSharedMemory == 0) + { + return NULL; + } + bExistedBefore = (GetLastError() == ERROR_ALREADY_EXISTS); + if(bExistedBefore) + { + return NULL; + } + + pData = (CSharedMem *)MapViewOfFile( + *hSharedMemory, FILE_MAP_ALL_ACCESS, 0, 0, 0); + if(pData == NULL) + { + return NULL; + } + + ZeroMemory(pData, dwSize); + pData->m_dwSize = memSize; + + return pData; +#else + CSharedMem *sMemChunk = NULL; + DWORD dwSize = memSize = (sizeof(CSharedMem) + memSize); + + if (sMemChunk != NULL) + return(sMemChunk); + + sMemChunk = (CSharedMem *) GlobalAllocPtr(GMEM_MOVEABLE, dwSize); + ZeroMemory(sMemChunk, (size_t) dwSize); + sMemChunk->m_dwSize = dwSize; // Missing in Communicator code! + return(sMemChunk); + +#endif // WIN32 +} + +// +// *open existing* shared memory chunk +// once you have the pointer to the new segment +// use this pointer to access data, e.g.: +// +CSharedMem * +NSOpenExistingSharedMemory(LPCTSTR memName, HANDLE *hSharedMemory) +{ +#ifdef WIN32 + CSharedMem *pData; + DWORD dwSize; + + LPCTSTR szObjectName = memName; + *hSharedMemory = OpenFileMapping( + PAGE_READWRITE,FALSE,szObjectName); + if(*hSharedMemory == 0) + { + return NULL; + } + + pData = (CSharedMem *)MapViewOfFile( + *hSharedMemory,FILE_MAP_ALL_ACCESS,0,0,0); + if(pData == NULL) + { + return NULL; + } + + dwSize = pData->m_dwSize; + return pData; +#else + + return(NULL); // In Win16, this is really meaningless... + +#endif +} + +// +// to close shared memory segment +// +void +NSCloseSharedMemory(CSharedMem *pData, HANDLE hSharedMemory) +{ +#ifdef WIN32 + if(pData != 0) + { + UnmapViewOfFile(pData); + pData = 0; + } + + if(hSharedMemory != 0) + { + CloseHandle(hSharedMemory); + hSharedMemory = 0; + } +#else + + if (pData != NULL) + { + GlobalFreePtr(pData); + pData = NULL; + } + +#endif // WIN32 +} \ No newline at end of file diff --git a/mozilla/cmd/winfe/mapi/trace.cpp b/mozilla/cmd/winfe/mapi/trace.cpp new file mode 100644 index 00000000000..bd6af1c25ac --- /dev/null +++ b/mozilla/cmd/winfe/mapi/trace.cpp @@ -0,0 +1,56 @@ +/* -*- 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. + */ + +#include +#include +#include +#include +#include "trace.h" + +#ifdef _DEBUG + +#ifndef WIN16 +void CDECL AfxTrace(LPCTSTR lpszFormat, ...) +#else +void CDECL AfxTrace(LPCSTR lpszFormat, ...) +#endif +{ + va_list args; + va_start(args, lpszFormat); + + int nBuf; + TCHAR szBuffer[512]; + + nBuf = _vstprintf(szBuffer, lpszFormat, args); + va_end(args); + +// MessageBox(GetDesktopWindow(), +// szBuffer, +// "Debug Output", +// MB_ICONINFORMATION); + + OutputDebugString(szBuffer); + return; +} + +BOOL AfxAssertFailedLine(LPCSTR lpszFileName, int nLine) +{ + return TRUE; +} + +#endif diff --git a/mozilla/cmd/winfe/mapi/trace.h b/mozilla/cmd/winfe/mapi/trace.h new file mode 100644 index 00000000000..393b230fceb --- /dev/null +++ b/mozilla/cmd/winfe/mapi/trace.h @@ -0,0 +1,63 @@ +/* -*- 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. + */ + +#include + +#ifdef _DEBUG +BOOL AfxAssertFailedLine(LPCSTR lpszFileName, int nLine); + +#ifndef WIN16 +void CDECL AfxTrace(LPCTSTR lpszFormat, ...); +#else +void CDECL AfxTrace(LPCSTR lpszFormat, ...); +#endif + +#define TRACE ::AfxTrace +#define THIS_FILE __FILE__ +#define ASSERT(f) \ + do \ + { \ + if (!(f) && AfxAssertFailedLine(THIS_FILE, __LINE__)) \ + AfxDebugBreak(); \ + } while (0) \ + +#define VERIFY(f) ASSERT(f) +#define TRACE_FN(name) LogFn __logFn(name) +class LogFn +{ +public: + LogFn(LPCSTR pFnName) {m_pFnName = pFnName; TRACE("--%s: In--\n", pFnName);} + ~LogFn() {TRACE("--%s: Out--\n", m_pFnName);} +private: + LPCSTR m_pFnName; +}; +#else +// NDEBUG +#define ASSERT(f) ((void)0) +#define VERIFY(f) ((void)(f)) +#define ASSERT_VALID(pOb) ((void)0) +#define DEBUG_ONLY(f) ((void)0) +#ifdef WIN32 +inline void CDECL AfxTrace(LPCTSTR, ...) { } +#else +inline void CDECL AfxTrace(LPCSTR, ...) { } +#endif +#define TRACE 1 ? (void)0 : ::AfxTrace +#define TRACE_FN(name) +#endif // _DEBUG + diff --git a/mozilla/cmd/winfe/mapi/xpapi.cpp b/mozilla/cmd/winfe/mapi/xpapi.cpp new file mode 100644 index 00000000000..89501fef195 --- /dev/null +++ b/mozilla/cmd/winfe/mapi/xpapi.cpp @@ -0,0 +1,331 @@ +/* -*- 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. + */ + +// +// XPAPI.CPP +// API implementation file for mapi16.dll and mapi32.dll +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// +#include +#include +#include +#include "xpapi.h" +#include "mapiutl.h" +#include "trace.h" + +WORD LOAD_DS XP_CallProcess(LPCSTR pPath, LPCSTR pCmdLine) +{ + WORD wReturn = 0; +#ifndef WIN16 + STARTUPINFO startupInfo; + PROCESS_INFORMATION processInfo; + + memset(&startupInfo, 0, sizeof(startupInfo)); + startupInfo.cb = sizeof(startupInfo); + if (wReturn = CreateProcess(pPath, (LPTSTR)pCmdLine, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_PROCESS_GROUP, NULL, NULL, &startupInfo, &processInfo)) + { + WaitForInputIdle(processInfo.hProcess, 120000); + } +#else + // char szMsg[80]; + char szExecute[512]; + lstrcpy(szExecute, pPath); + lstrcat(szExecute, " "); + lstrcat(szExecute, pCmdLine); + wReturn = WinExec(szExecute,SW_SHOW); + + if (wReturn < 32) + { + wReturn = 0; + } +#endif + return wReturn; +} + +HKEY LOAD_DS RegOpenParent(LPCSTR pSection, HKEY hRootKey, REGSAM access) +{ + HKEY hKey; +#ifndef WIN16 + if (RegOpenKeyEx(hRootKey, pSection, 0, access, &hKey) != ERROR_SUCCESS) + { + return(NULL); + } +#else + if (RegOpenKey(hRootKey, pSection, &hKey) != ERROR_SUCCESS) + { + return(NULL); + } +#endif + return(hKey); +} + +HKEY LOAD_DS RegCreateParent(LPCSTR pSection, HKEY hMasterKey) +{ + HKEY hKey; + if (RegCreateKey(hMasterKey, pSection, &hKey) != ERROR_SUCCESS) + { + return(NULL); + } + return(hKey); +} + +BOOL LOAD_DS GetConfigInfoStr(LPCSTR pSection, LPCSTR pKey, LPSTR pBuf, int lenBuf, HKEY hMasterKey) +{ + HKEY hKey; + hKey = RegOpenParent(pSection, hMasterKey, KEY_QUERY_VALUE); + if (!hKey) + { + return(FALSE); + } + + DWORD len = (DWORD)lenBuf; +#ifndef WIN16 + BOOL retVal = (RegQueryValueEx(hKey, pKey, NULL, NULL, (LPBYTE)pBuf, &len) == ERROR_SUCCESS); +#else + BOOL retVal = (RegQueryValue(hKey, pKey, pBuf, (long far*)&len) == ERROR_SUCCESS); +#endif + RegCloseKey(hKey); + return(retVal); +} + +BOOL LOAD_DS GetConfigInfoNum(LPCSTR pSection, LPCSTR pKey, DWORD* pVal, HKEY hMasterKey) +{ + HKEY hKey; + hKey = RegOpenParent(pSection, hMasterKey, KEY_QUERY_VALUE); + if (!hKey) + { + return(FALSE); + } + + DWORD len = sizeof(DWORD); +#ifndef WIN16 + BOOL retVal = (RegQueryValueEx(hKey, pKey, NULL, NULL, (LPBYTE)pVal, &len) == ERROR_SUCCESS); +#else + BOOL retVal = (RegQueryValue(hKey, pKey, (char far*)pVal, (long far*)&len) == ERROR_SUCCESS); +#endif + RegCloseKey(hKey); + return(retVal); +} + +BOOL LOAD_DS SetConfigInfoStr(LPCSTR pSection, LPCSTR pKey, LPSTR pStr, HKEY hMasterKey) +{ + HKEY hKey; + hKey = RegCreateParent(pSection, hMasterKey); + if (!hKey) + { + return(FALSE); + } +#ifndef WIN16 + BOOL retVal = (RegSetValueEx(hKey, pKey, 0, REG_SZ, (LPBYTE)pStr, lstrlen(pStr) + 1) == ERROR_SUCCESS); +#else + BOOL retVal = (RegSetValue(hKey, pKey, REG_SZ, pStr, lstrlen(pStr) + 1) == ERROR_SUCCESS); +#endif + RegCloseKey(hKey); + return(retVal); +} + + +BOOL LOAD_DS XP_GetInstallDirectory(LPCSTR pcurVersionSection, LPCSTR pInstallDirKey, LPSTR path, UINT nSize, HKEY hKey) +{ +#ifdef WIN32 + if (!GetConfigInfoStr(pcurVersionSection, pInstallDirKey, path, nSize, hKey)) + { + return FALSE; + } + else + { + return TRUE; + } +#else + if ( 0 < GetPrivateProfileString(pcurVersionSection, pInstallDirKey,"ERROR", path, nSize, szNetscapeINI)) + { + return TRUE; + } + else + { + return FALSE; + } +#endif +} + + +BOOL LOAD_DS XP_GetVersionInfoString(LPCSTR pNavigatorSection, LPCSTR pCurrentVersionKey, LPSTR pcurVersionStr, UINT nSize, HKEY hKey) +{ +#ifdef WIN32 + if (!GetConfigInfoStr(pNavigatorSection, pCurrentVersionKey, pcurVersionStr, nSize, HKEY_LOCAL_MACHINE)) + { + return FALSE; + } + else + { + return TRUE; + } +#else + if ( 0 < GetPrivateProfileString(pNavigatorSection, pCurrentVersionKey,"ERROR", pcurVersionStr, nSize, szNetscapeINI)) + { + return TRUE; + } + else + { + return FALSE; + } +#endif + +} + +DWORD LOAD_DS XP_GetInstallLocation(LPSTR pPath, UINT nSize) +{ +char curVersionStr[256]; +char curVersionSection[256]; + + if (!pPath) + { + TRACE("PATH ARG IS NULL\n"); + return MAPI_E_LOGON_FAILURE; + } + +#ifdef WIN32 + if (!XP_GetVersionInfoString(szNavigatorSection, szCurrentVersionKey, curVersionStr, + sizeof(curVersionStr), HKEY_LOCAL_MACHINE)) + { + TRACE("FAILED TO GET XP_GetVersionInfoString() to WORK\n"); + return (MAPI_E_LOGON_FAILURE); + } + + wsprintf(curVersionSection, szNavigatorCurVersionSection, curVersionStr); + + if (!XP_GetInstallDirectory(curVersionSection, szInstallDirKey, pPath, + nSize, HKEY_LOCAL_MACHINE)) + { + TRACE("FAILED TO GET XP_GetInstallDirectory() to WORK\n"); + return (MAPI_E_ACCESS_DENIED); + + } + + lstrcat(pPath, "\\"); + lstrcat(pPath, "Program\\netscape.exe"); + + return SUCCESS_SUCCESS; +#else + if (32 == Is_16_OR_32_BIT_CommunitorRunning()) + { + if (!GetConfigInfoStr("snews\\shell\\open", "command", curVersionStr, sizeof(curVersionStr), HKEY_CLASSES_ROOT)) + { + TRACE("FAILED TO DO GetConfigInfoStr() to WORK\n"); + return (MAPI_E_ACCESS_DENIED); + } + else + { + char *pFind = strstr(curVersionStr,"-h"); + + if (pFind) + { + *pFind=0; + lstrcpy(pPath,curVersionStr); + } + else + { + TRACE("FINDING -h FAILED TO WORK\n"); + return (MAPI_E_ACCESS_DENIED); + } + } + + return SUCCESS_SUCCESS; + } + else //setup up to start navstart since we are a sixteen bit DLL. + { + if (!XP_GetVersionInfoString(szNavigatorSection, szCurrentVersionKey, curVersionStr, sizeof(curVersionStr), HKEY_LOCAL_MACHINE)) + { + TRACE("VERSION INFO STRING FAILED\n"); + return (MAPI_E_LOGON_FAILURE); + } + + wsprintf(curVersionSection, szNavigatorCurVersionSection, curVersionStr); + + if (!XP_GetInstallDirectory(curVersionSection, szInstallDirKey, pPath,nSize, HKEY_LOCAL_MACHINE)) + { + TRACE("GETINSTALLDIRECTORY FAILED\n"); + return (MAPI_E_ACCESS_DENIED); + } + + lstrcat(pPath, "\\"); + lstrcat(pPath, "NAVSTART.EXE"); + return SUCCESS_SUCCESS; + } +#endif +} + +int LOAD_DS Is_16_OR_32_BIT_CommunitorRunning() +{ + if (FindWindow("AfxFrameOrView", NULL) && !FindWindow("aHiddenFrameClass", NULL)) + return(16); + else if (FindWindow("aHiddenFrameClass", NULL)) + return(32); + else + return 0; +} + +BOOL LOAD_DS +XP_CopyFile(LPCSTR lpExistingFile, LPCSTR lpNewFile, BOOL bFailifExist) +{ +#ifdef WIN32 + return CopyFile(lpExistingFile, lpNewFile, bFailifExist); +#else + HFILE hReadFrom; + if ( ((hReadFrom = _lopen(lpExistingFile, OF_SHARE_DENY_WRITE)) != HFILE_ERROR) && !bFailifExist) + { + //HFILE hWriteTo; + FILE *hWriteTo; + if ( (hWriteTo = fopen(lpNewFile, "wb")) != NULL) + { + int cbRead; + int nCount =0; + int fileNo = _fileno(hWriteTo); + PBYTE pbBuf; + // Allocate a buffer for file I/O. + pbBuf = (PBYTE) LocalAlloc(LMEM_FIXED, 2048); + // Copy the input file to the temporary file. + do + { + cbRead = _lread(hReadFrom, pbBuf, 2048); + if ( nCount = fwrite(pbBuf, sizeof(char), cbRead, hWriteTo) > -1) + { + LocalFree((HLOCAL) pbBuf); + _lclose(hReadFrom); + fclose(hWriteTo); + //XP_RemoveFile(lpNewFile); + _unlink(lpNewFile); + return 0; + } + + } + while (cbRead != 0); + // Free the buffer and close the files. + LocalFree((HLOCAL) pbBuf); + _lclose(hReadFrom); + fclose(hWriteTo); + return _fileno(hWriteTo); + } + else + return 0; //Failed to open the destination file + } + else + return 0; //Fail if exist was turned on +#endif +} diff --git a/mozilla/cmd/winfe/mapi/xpapi.h b/mozilla/cmd/winfe/mapi/xpapi.h new file mode 100644 index 00000000000..7b946ae50ef --- /dev/null +++ b/mozilla/cmd/winfe/mapi/xpapi.h @@ -0,0 +1,120 @@ +/* -*- 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. + */ + +// +// Various routines for MAPI functions. +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// +#ifndef __XPAPI_H +#define __XPAPI_H + +#ifdef WIN16 + +#include +#include +#include +#include +#else +#include +#endif + +#ifdef WIN16 +extern "C" { +#ifndef MAPI_OLE // Because MSFT doesn't do this for us :-( +#include +#endif +} +#else +//#include +#endif + + +#ifdef WIN32 +#define MAPI_IMPLEMENT(param) param PASCAL +#define LOAD_DS +#else +#define LOAD_DS __loadds +#define MAPI_IMPLEMENT(param) extern "C" param FAR PASCAL + +#endif + +#ifdef WIN16 +#define _MAX_PATH 260 /* max. length of full pathname*/ +#define MAPI_E_LOGON_FAILURE 3 +#define MAPI_E_ACCESS_DENIED 6 +#define INVALID_HANDLE_VALUE (HANDLE)-1 +#define KEY_QUERY_VALUE 0x0001 +#define HKEY_LOCAL_MACHINE ((HKEY)0x80000002) +#define HKEY_ROOT HKEY_CLASSES_ROOT +#else +#define HKEY_ROOT ((HKEY)0x80000002) +#endif + +// +// registry keys +// +#ifdef WIN32 +static char szNavigatorSection[] = "Software\\Netscape\\Netscape Navigator"; +static char szNavigatorCurVersionSection[] = "Software\\Netscape\\Netscape Navigator\\%s\\Main"; +static char szCurrentVersionKey[] = "CurrentVersion"; +static char szInstallDirKey[] = "Install Directory"; +static char szMapiSection[] = "Software\\Netscape\\Netscape Navigator\\MAPI"; +static char szTempFiles[] = "TempFiles"; +static char szMapiLog[] = "NSMAPI32.LOG"; +#else +//32 bit key strings for trying to read the 32bit registry +static char szNavigatorSection32[] = "Software\\Netscape\\Netscape Navigator"; +static char szNavigatorCurVersionSection32[] = "Software\\Netscape\\Netscape Navigator\\%s\\Main"; +static char szMapiSection32[] = "Software\\Netscape\\Netscape Navigator\\MAPI"; + +// ini section and key strings +static char szNetscapeINI[] = "nscp.ini"; +static char szNavigatorSection[] = "Netscape Navigator"; +static char szNavigatorCurVersionSection[] = "Netscape Navigator-%s"; +static char szCurrentVersionKey[] = "CurrentVersion"; +static char szInstallDirKey[] = "Install Directory"; +static char szMapiSection[] = "MAPI"; +static char szTempFiles[] = "TempFiles"; +static char szExeName[] = "NAVSTART.EXE"; +static char szMapiLog[] = "NSMAPI16.LOG"; +#endif + +//Since REGSAM is just an ACCESS_MASK which is just a DWORD and it's not +//declared in win16 we'll make one hear for the purpose of keeping parameters +//the same even though the access rights don't get used for win16. + +typedef DWORD REGSAM; + + +// XP declarations + +int LOAD_DS Is_16_OR_32_BIT_CommunitorRunning(); +WORD LOAD_DS XP_CallProcess(LPCSTR pPath, LPCSTR pCmdLine); +HKEY LOAD_DS RegOpenParent(LPCSTR pSection, HKEY hRootKey, REGSAM access); +HKEY LOAD_DS RegCreateParent(LPCSTR pSection, HKEY hMasterKey); +BOOL LOAD_DS GetConfigInfoStr(LPCSTR pSection, LPCSTR pKey, LPSTR pBuf, int lenBuf, HKEY hMasterKey); +BOOL LOAD_DS GetConfigInfoNum(LPCSTR pSection, LPCSTR pKey, DWORD* pVal, HKEY hMasterKey); +BOOL LOAD_DS SetConfigInfoStr(LPCSTR pSection, LPCSTR pKey, LPSTR pStr, HKEY hMasterKey); + +BOOL LOAD_DS XP_GetInstallDirectory(LPCSTR pcurVersionSection, LPCSTR pInstallDirKey, LPSTR path, UINT nSize, HKEY hKey); +BOOL LOAD_DS XP_GetVersionInfoString(LPCSTR pNavigatorSection, LPCSTR pCurrentVersionKey, LPSTR pcurVersionStr, UINT nSize, HKEY hKey); +DWORD LOAD_DS XP_GetInstallLocation(LPSTR pPath, UINT nSize); +BOOL LOAD_DS XP_CopyFile(LPCSTR lpExistingFile, LPCSTR lpNewFile, BOOL bFailifExist); + +#endif // __XPAPI_H \ No newline at end of file diff --git a/mozilla/cmd/winfe/mapihook.cpp b/mozilla/cmd/winfe/mapihook.cpp index 68295f09109..4522b1d8897 100644 --- a/mozilla/cmd/winfe/mapihook.cpp +++ b/mozilla/cmd/winfe/mapihook.cpp @@ -65,6 +65,7 @@ LONG ProcessMAPIResolveName(MAPIResolveNameType *nameInfo); LONG ProcessMAPIDetails(MAPIDetailsType *detailInfo); LONG ProcessMAPIReadMail(MAPIReadMailType *readInfo); LONG ProcessMAPIAddress(MAPIAddressType *addrInfo); +LONG ProcessMAPI_NSCP_SynchronizeClient(MAPI_NSCP_SynchronizeClientType *syncInfo); // // This will store the CFrameWnd we startup for MAPI and if we do start @@ -386,7 +387,29 @@ LONG ProcessNetscapeMAPIHook(WPARAM wParam, LPARAM lParam) addrInfo->ipcWorked = 1; // Set the worked flag return(ProcessMAPIAddress(addrInfo)); } - + + ////////////////////////////////////////////////////////////////////// + // MAPI_NSCP_SynchronizeClient + ////////////////////////////////////////////////////////////////////// + case NSCP_MAPI_NSCP_SynchronizeClient: + { + MAPI_NSCP_SynchronizeClientType *syncInfo; + +#ifdef WIN32 + syncInfo = (MAPI_NSCP_SynchronizeClientType *) &(sMem->m_buf[0]); +#else + syncInfo = (MAPI_NSCP_SynchronizeClientType *) ipcInfo->lpsmem; +#endif + + if (!syncInfo) + { + return(MAPI_E_FAILURE); + } + + syncInfo->ipcWorked = 1; // Set the worked flag + return(ProcessMAPI_NSCP_SynchronizeClient(syncInfo)); + } + case NSCP_MAPIFree: // This should never hit Communicator, but if it does #ifdef WIN16 return(SUCCESS_SUCCESS); // Just return @@ -999,10 +1022,10 @@ ProcessMAPIDetails(MAPIDetailsType *detailInfo) } // Now, convert the stuff to real values for the API... + extern MWContext *GetUsableContext(void); ABID id = atoi((const char *) idString); - AB_ContainerInfo *container = AB_MAPI_ConvertToContainer(containerString); MSG_Pane *personPane = NULL; - extern MWContext *GetUsableContext(void); + AB_ContainerInfo *container = AB_MAPI_ConvertToContainer(GetUsableContext(), containerString); // Need to first create a person entry pane and then call // FE_ShowPropertySheetAB2 on that pane - return 0 is problem @@ -1562,3 +1585,27 @@ ProcessMAPIAddress(MAPIAddressType *addrInfo) NSStrSeqDelete(strSeq); return(SUCCESS_SUCCESS); } + + +// +// This is for synchronizing the client from an external application via +// the MAPI interface. +// +LONG +ProcessMAPI_NSCP_SynchronizeClient(MAPI_NSCP_SynchronizeClientType *syncInfo) +{ + extern void WFE_MAPISynchronize(CWnd *pParent); + MSG msg; + + WFE_MAPISynchronize(NULL); + while (theApp.m_bSynchronizing) + { + // get the next message if any... + if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) + { + (void) theApp.NSPumpMessage(); + } + } + + return SUCCESS_SUCCESS; +} diff --git a/mozilla/cmd/winfe/mapimail.cpp b/mozilla/cmd/winfe/mapimail.cpp index 5ca72cc9ef7..dad6cea5116 100644 --- a/mozilla/cmd/winfe/mapimail.cpp +++ b/mozilla/cmd/winfe/mapimail.cpp @@ -1,19 +1,20 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- 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 + * Version 1.0 (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 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. + * 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 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. + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1997 + * Netscape Communications Corporation. All Rights Reserved. */ // // More MAPI Hooks for Communicator @@ -21,6 +22,8 @@ // November 1997 // #include "stdafx.h" + +#include "rosetta.h" #include "template.h" #include "msgcom.h" #include "wfemsg.h" @@ -100,6 +103,12 @@ CString csDefault; return(MAPI_E_FAILURE); } + // Check on HTML compose...only do this if the window is shown! + XP_Bool htmlCompose; + PREF_GetBoolPref("mail.html_compose", &htmlCompose); + if (!winShowFlag) + htmlCompose = FALSE; + // // Now, we must build the fields object... // @@ -110,8 +119,15 @@ CString csDefault; // up... if ((!subject) || !(*subject)) { - csDefault.LoadString(IDS_COMPOSE_DEFAULTNOSUBJECT); - subject = csDefault.GetBuffer(2); + if (sendMailPtr->MSG_nFileCount > 0) + { + subject = NSStrSeqGet(mailInfoSeq, 6 + (sendMailPtr->MSG_nRecipCount * 3) + 1); + } + else + { + csDefault.LoadString(IDS_COMPOSE_DEFAULTNOSUBJECT); + subject = csDefault.GetBuffer(2); + } } TRACE("MAPI: ProcessMAPISendMail() Subject = [%s]\n", subject); @@ -157,11 +173,7 @@ CString csDefault; lstrcat(ptr, (LPSTR) tempString); } - BOOL bEncrypt = FALSE; - BOOL bSign = FALSE; - - PREF_GetBoolPref("mail.crypto_sign_outgoing_mail", &bSign); - PREF_GetBoolPref("mail.encrypt_outgoing_mail", &bEncrypt); + HG27129 MSG_CompositionFields *fields = MSG_CreateCompositionFields(real_addr, real_addr, toString, @@ -171,8 +183,7 @@ CString csDefault; "", subject, "", "", "", "", "", - bEncrypt, - bSign); + HG21198); if (!fields) { return(MAPI_E_FAILURE); @@ -181,8 +192,16 @@ CString csDefault; // RICHIE // INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(pOldContext); // int16 win_csid = INTL_GetCSIWinCSID(csi); - - pDocument = (CGenericDoc*)theApp.m_TextComposeTemplate->OpenDocumentFile(NULL, NULL, /*win_csid RICHIE*/ winShowFlag); + if (htmlCompose) + { + pDocument = (CGenericDoc*)theApp.m_ComposeTemplate->OpenDocumentFile(NULL, + NULL, winShowFlag); + } + else + { + pDocument = (CGenericDoc*)theApp.m_TextComposeTemplate->OpenDocumentFile(NULL, + NULL, winShowFlag); + } if ( !pDocument ) { return(MAPI_E_FAILURE); @@ -217,6 +236,20 @@ CString csDefault; WFE_MSGGetMaster()) ); } + else + { + pCompose->SetMsgPane(MSG_CreateCompositionPaneNoInit( + context, // pContext->GetContext(), + g_MsgPrefs.m_pMsgPrefs, + WFE_MSGGetMaster())); + + // Set the callbacks for askHTML and Recipients dialogs + MSG_SetCompositionPaneCallbacks( pCompose->GetMsgPane(), &Callbacks, 0); + if (pCompose->GetMsgPane()) + { + MSG_SetHTMLMarkup(pCompose->GetMsgPane(), TRUE); + } + } ASSERT(pCompose->GetMsgPane()); MSG_SetFEData(pCompose->GetMsgPane(),(void *)pCompose); @@ -241,6 +274,7 @@ CString csDefault; // rhp - Deal with addressing the brute force way! This is a // "fix" for bad behavior when creating these windows and not // showing them on the desktop. + if (!winShowFlag) // Hack to fix the window not being mapped { pCompose->AppendAddress(MSG_TO_HEADER_MASK, ""); @@ -248,17 +282,42 @@ CString csDefault; pCompose->AppendAddress(MSG_BCC_HEADER_MASK, ""); } - // Always do plain text composition! - pCompose->CompleteComposeInitialization(); - - // Do this so we don't get popups on "empty" messages - if ( (!pInitialText) || (!(*pInitialText)) ) - pInitialText = " "; - - const char * pBody = pInitialText ? pInitialText : MSG_GetCompBody(pCompose->GetMsgPane()); - if (pBody) + if (!pCompose->UseHtml()) { - FE_InsertMessageCompositionText(context,pBody,TRUE); + // Do this so we don't get popups on "empty" messages + if ( (!pInitialText) || (!(*pInitialText)) ) + pInitialText = " "; + + // IF we are doing plain text composition! + pCompose->CompleteComposeInitialization(); + + const char * pBody = pInitialText ? pInitialText : MSG_GetCompBody(pCompose->GetMsgPane()); + if (pBody) + { + FE_InsertMessageCompositionText(context,pBody,TRUE); + } + } + else + { + // Gotta be more than just spaces! - rhp - fixes some bugs with Office + if ( (pInitialText) && (*pInitialText) ) + { + char *tmp = (char *)pInitialText; + + while (*tmp == ' ') + tmp++; + + if (*tmp) + pCompose->SetInitialText(pInitialText); + } + // Gotta be more than just spaces! - rhp - fixes some bugs with Office + + URL_Struct * pUrl = NET_CreateURLStruct(EDT_NEW_DOC_URL,NET_DONT_RELOAD); + if (pUrl != NULL) + { + pContext->GetUrl(pUrl, FO_CACHE_AND_PRESENT); + pContext->GetContext()->bIsComposeWindow = TRUE; + } } // @@ -362,12 +421,7 @@ CGenericDoc *pDocument; // // Now, build the fields object w/o much info... // - BOOL bEncrypt = FALSE; - BOOL bSign = FALSE; - - PREF_GetBoolPref("mail.crypto_sign_outgoing_mail", &bSign); - PREF_GetBoolPref("mail.encrypt_outgoing_mail", &bEncrypt); - + HG26726 MSG_CompositionFields *fields = MSG_CreateCompositionFields(real_addr, real_addr, NULL, "", "", @@ -375,17 +429,28 @@ CGenericDoc *pDocument; "", "", "", "", "", "", "", - bEncrypt, - bSign); + HG21892); if (!fields) { return(MAPI_E_FAILURE); } + // Check on HTML compose... + XP_Bool htmlCompose; + PREF_GetBoolPref("mail.html_compose", &htmlCompose); + // RICHIE - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(pOldContext); // int16 win_csid = INTL_GetCSIWinCSID(csi); - - pDocument = (CGenericDoc*)theApp.m_TextComposeTemplate->OpenDocumentFile(NULL, NULL, /*RICHIE win_csid,*/ TRUE); + if (htmlCompose) + { + pDocument = (CGenericDoc*)theApp.m_ComposeTemplate->OpenDocumentFile(NULL, + NULL, TRUE); + } + else + { + pDocument = (CGenericDoc*)theApp.m_TextComposeTemplate->OpenDocumentFile(NULL, + NULL, TRUE); + } if ( !pDocument ) { // cleanup fields object @@ -418,6 +483,20 @@ CGenericDoc *pDocument; g_MsgPrefs.m_pMsgPrefs, fields, WFE_MSGGetMaster())); } + else + { + pCompose->SetMsgPane(MSG_CreateCompositionPaneNoInit( + context, // pContext->GetContext(), + g_MsgPrefs.m_pMsgPrefs, + WFE_MSGGetMaster())); + + // Set the callbacks for askHTML and Recipients dialogs + MSG_SetCompositionPaneCallbacks( pCompose->GetMsgPane(), &Callbacks, 0); + if (pCompose->GetMsgPane()) + { + MSG_SetHTMLMarkup(pCompose->GetMsgPane(), TRUE); + } + } ASSERT(pCompose->GetMsgPane()); MSG_SetFEData(pCompose->GetMsgPane(),(void *)pCompose); @@ -443,8 +522,20 @@ CGenericDoc *pDocument; pBar->CreateAddressingBlock(); } - // Always do plain text composition! - pCompose->CompleteComposeInitialization(); + if (!pCompose->UseHtml()) + { + // If doing plain text composition! + pCompose->CompleteComposeInitialization(); + } + else + { + URL_Struct * pUrl = NET_CreateURLStruct(EDT_NEW_DOC_URL,NET_DONT_RELOAD); + if (pUrl != NULL) + { + pContext->GetUrl(pUrl, FO_CACHE_AND_PRESENT); + pContext->GetContext()->bIsComposeWindow = TRUE; + } + } // // Finally deal with the attachments... @@ -583,6 +674,12 @@ BOOL winShowFlag = FALSE; return(MAPI_E_FAILURE); } + // Check on HTML compose... + XP_Bool htmlCompose; + PREF_GetBoolPref("mail.html_compose", &htmlCompose); + if (!winShowFlag) + htmlCompose = FALSE; + // Don't allow a compose window to be created if the user hasn't // specified an email address const char *real_addr = FE_UsersMailAddress(); @@ -658,11 +755,10 @@ BOOL winShowFlag = FALSE; lstrcat(ptr, (LPSTR) tempString); } - BOOL bEncrypt = FALSE; - BOOL bSign = FALSE; + BOOL bxxx = FALSE; + BOOL bxxx2 = FALSE; - PREF_GetBoolPref("mail.crypto_sign_outgoing_mail", &bSign); - PREF_GetBoolPref("mail.encrypt_outgoing_mail", &bEncrypt); + MSG_CompositionFields *fields = MSG_CreateCompositionFields(real_addr, real_addr, toString, @@ -672,8 +768,8 @@ BOOL winShowFlag = FALSE; "", subject, "", "", "", "", "", - bEncrypt, - bSign); + bxxx, + bxxx2); if (!fields) { return(MAPI_E_FAILURE); @@ -683,7 +779,16 @@ BOOL winShowFlag = FALSE; // INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(pOldContext); // int16 win_csid = INTL_GetCSIWinCSID(csi); - pDocument = (CGenericDoc*)theApp.m_TextComposeTemplate->OpenDocumentFile(NULL, NULL, /*win_csid RICHIE*/ winShowFlag); + if (htmlCompose) + { + pDocument = (CGenericDoc*)theApp.m_ComposeTemplate->OpenDocumentFile(NULL, + NULL, winShowFlag); + } + else + { + pDocument = (CGenericDoc*)theApp.m_TextComposeTemplate->OpenDocumentFile(NULL, + NULL, winShowFlag); + } if ( !pDocument ) { return(MAPI_E_FAILURE); @@ -718,6 +823,20 @@ BOOL winShowFlag = FALSE; WFE_MSGGetMaster()) ); } + else + { + pCompose->SetMsgPane(MSG_CreateCompositionPaneNoInit( + context, // pContext->GetContext(), + g_MsgPrefs.m_pMsgPrefs, + WFE_MSGGetMaster())); + + // Set the callbacks for askHTML and Recipients dialogs + MSG_SetCompositionPaneCallbacks( pCompose->GetMsgPane(), &Callbacks, 0); + if (pCompose->GetMsgPane()) + { + MSG_SetHTMLMarkup(pCompose->GetMsgPane(), TRUE); + } + } ASSERT(pCompose->GetMsgPane()); MSG_SetFEData(pCompose->GetMsgPane(),(void *)pCompose); @@ -749,17 +868,41 @@ BOOL winShowFlag = FALSE; pCompose->AppendAddress(MSG_BCC_HEADER_MASK, ""); } - // Always do plain text composition! - pCompose->CompleteComposeInitialization(); - - // Do this so we don't get popups on "empty" messages - if ( (!pInitialText) || (!(*pInitialText)) ) - pInitialText = " "; - - const char * pBody = pInitialText ? pInitialText : MSG_GetCompBody(pCompose->GetMsgPane()); - if (pBody) + if (!pCompose->UseHtml()) { - FE_InsertMessageCompositionText(context,pBody,TRUE); + // Do this so we don't get popups on "empty" messages + if ( (!pInitialText) || (!(*pInitialText)) ) + pInitialText = " "; + + // If doing plain text composition! + pCompose->CompleteComposeInitialization(); + + const char * pBody = pInitialText ? pInitialText : MSG_GetCompBody(pCompose->GetMsgPane()); + if (pBody) + { + FE_InsertMessageCompositionText(context,pBody,TRUE); + } + } + else + { + // Gotta be more than just spaces! - rhp - fixes some bugs with Office + if ( (pInitialText) && (*pInitialText) ) + { + char *tmp = (char *)pInitialText; + + while (*tmp == ' ') + tmp++; + if (*tmp) + pCompose->SetInitialText(pInitialText); + } + // Gotta be more than just spaces! - rhp - fixes some bugs with Office + + URL_Struct * pUrl = NET_CreateURLStruct(EDT_NEW_DOC_URL,NET_DONT_RELOAD); + if (pUrl != NULL) + { + pContext->GetUrl(pUrl, FO_CACHE_AND_PRESENT); + pContext->GetContext()->bIsComposeWindow = TRUE; + } } // diff --git a/mozilla/cmd/winfe/mapitest/main.cpp b/mozilla/cmd/winfe/mapitest/main.cpp new file mode 100644 index 00000000000..ebd5740af19 --- /dev/null +++ b/mozilla/cmd/winfe/mapitest/main.cpp @@ -0,0 +1,220 @@ +/* -*- 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. + */ +// +#include +#include +#include +#include +#ifndef MAPI_OLE // Because MSFT doesn't do this for us :-( +#include +#endif + +#include "port.h" +#include "resource.h" + +#ifndef WM_PAINTICON +#define WM_PAINTICON 0x26 +#endif // WM_PAINTICON + +/* + * Forward Declarations... + */ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow); +BOOL CALLBACK LOADDS MyDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam); +extern void ProcessCommand(HWND hWnd, int id, HWND hCtl, UINT codeNotify); +BOOL OpenMAPI(void); +void CloseMAPI(void); + +/* + * Global variables + */ +HINSTANCE hInst; +HWND hWnd; + +#ifdef WIN16 +HICON hIconApp; +#endif + +char NEAR szAppName[] = "Netscape QA Helper"; +char NEAR szShortAppName[] = "QAHelper"; +char szClassName[] = "Netscape_QAHelper_Class_Name"; + +void +AppCleanup(void) +{ + extern void DoMAPILogoff(HWND hWnd); + static BOOL isDone = FALSE; + + if (isDone) + return; + + extern LHANDLE mapiSession; + + if (mapiSession != 0) + { + DoMAPILogoff(hWnd); + } + + CloseMAPI(); + isDone = TRUE; +} + +BOOL +InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + /* Create a main window for this application instance. */ + hWnd = CreateDialog((HINSTANCE) hInstance, + MAKEINTRESOURCE(ID_DIALOG), + (HWND) NULL, (DLGPROC) MyDlgProc); + + if (!hWnd) + return FALSE; + else + return TRUE; +} + +BOOL InitApp(void) +{ +#ifndef WIN16 + WNDCLASS wc; + wc.style = 0; + wc.lpfnWndProc = DefDlgProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = DLGWINDOWEXTRA; + wc.hInstance = hInst; + wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_APP)); + wc.hCursor = LoadCursor(0, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszMenuName = NULL; + wc.lpszClassName = szClassName; + + if(!RegisterClass(&wc)) + return FALSE; + +#else + hIconApp = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_APP)); +#endif + + return TRUE; +} // end InitApp + +// Win Main +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + hInst = hInstance; + + if (!InitApp()) + { + return FALSE; + } + + if (!InitInstance(hInstance, nCmdShow)) + { + return FALSE; + } + + if (!OpenMAPI()) + { + return FALSE; + } + + ShowWindow(hWnd, SW_SHOW); + + // Start the application + while ((GetMessage(&msg, (HWND) NULL, (UINT) NULL, (UINT) NULL))) + { + if(IsDialogMessage(hWnd, &msg)) + continue; + + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return(msg.wParam); +} + +BOOL CALLBACK LOADDS +MyDlgProc(HWND hWndMain, UINT wMsg, WPARAM wParam, LPARAM lParam) +{ + switch (wMsg) + { + case WM_INITDIALOG: + { + hWnd = hWndMain; + SetDlgItemText(hWnd, ID_EDIT_ROW, "0"); + } + break; + + case WM_CLOSE: + { + DestroyWindow(hWnd); + break; + } + + case WM_DESTROY: + { + AppCleanup(); + +#ifndef WIN16 + UnregisterClass(szClassName, hInst); +#else + // Destroy the 16 bit windows icon + if(hIconApp != 0) + DestroyIcon(hIconApp); +#endif + + PostQuitMessage(0); + break; + } + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, ProcessCommand); + break; + + case WM_QUERYDRAGICON: +#ifdef WIN16 + return (BOOL)hIconApp; +#endif + + case WM_PAINTICON: +#ifdef WIN16 + SetClassWord(hWnd, GCW_HICON, 0); + + // fall trough + case WM_PAINT: + { + if(!IsIconic(hWnd)) + return FALSE; + PAINTSTRUCT ps; + HDC hDC = BeginPaint(hWnd, &ps); + SetMapMode(hDC, MM_TEXT); + DrawIcon(hDC, 2, 2, hIconApp); + EndPaint(hWnd, &ps); + break; + } +#endif //WIN16 + break; // RICHIE - if this is not here NT 3.51 Pukes!!!! + + default: + return FALSE; + } + + //~~av return (DefWindowProc(hWnd, wMsg, wParam, lParam)); + return TRUE; +} diff --git a/mozilla/cmd/winfe/mapitest/mapimail.cpp b/mozilla/cmd/winfe/mapitest/mapimail.cpp new file mode 100644 index 00000000000..05f889424ea --- /dev/null +++ b/mozilla/cmd/winfe/mapitest/mapimail.cpp @@ -0,0 +1,753 @@ +/* -*- 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. + */ +// +#include +#include +#include +#include +#include + +#include "port.h" +#include "resource.h" + +// +// Variables... +// +extern HINSTANCE m_hInstMapi; +extern LHANDLE mapiSession; + +// +// Forward declarations... +// +void DoMAPIFreeBuffer(HWND hWnd, LPVOID buf, BOOL alert); +extern void ShowMessage(HWND hWnd, LPSTR msg); +void DoMAPISendMail(HWND hWnd); +void DoMAPISendDocuments(HWND hWnd); +void DoMAPISaveMail(HWND hWnd); +void DoMAPIAddress(HWND hWnd); +extern void SetFooter(LPSTR msg); +extern LPSTR GetMAPIError(LONG errorCode); + +void +ProcessMailCommand(HWND hWnd, int id, HWND hCtl, UINT codeNotify) +{ + switch (id) + { + case IDCANCEL: + EndDialog(hWnd, 0); + break; + + case ID_BUTTON_MAPISENDMAIL: + DoMAPISendMail(hWnd); + break; + + case ID_BUTTON_MAPISENDDOCUMENTS: + DoMAPISendDocuments(hWnd); + break; + + case ID_BUTTON_MAPISAVEMAIL: + DoMAPISaveMail(hWnd); + break; + + case ID_BUTTON_MAPIADDRESS: + DoMAPIAddress(hWnd); + break; + + default: + break; + } +} + +BOOL CALLBACK LOADDS +MailDlgProc(HWND hWndMain, UINT wMsg, WPARAM wParam, LPARAM lParam) +{ + switch (wMsg) + { + case WM_INITDIALOG: + break; + + case WM_COMMAND: + HANDLE_WM_COMMAND(hWndMain, wParam, lParam, ProcessMailCommand); + break; + + default: + return FALSE; + } + + return TRUE; +} + +static LPSTR lpszDelimChar = ";"; + +void +TackItOn(LPSTR fileBuf, LPSTR nameBuf, LPSTR addOn) +{ + if (addOn[0] != '\0') + { + lstrcat(fileBuf, addOn); + lstrcat(fileBuf, lpszDelimChar); + + lstrcat(nameBuf, "NAMEOF.FILE"); + lstrcat(nameBuf, lpszDelimChar); + } +} + +void +DoMAPISendDocuments(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnMAPISendDocuments) (ULONG ulUIParam, + LPTSTR lpszDelimChar, LPTSTR lpszFullPaths, + LPTSTR lpszFileNames, ULONG ulReserved); + +#ifdef WIN16 + (FARPROC&) lpfnMAPISendDocuments = GetProcAddress(m_hInstMapi, "MAPISENDDOCUMENTS"); +#else + (FARPROC&) lpfnMAPISendDocuments = GetProcAddress(m_hInstMapi, "MAPISendDocuments"); +#endif + + if (!lpfnMAPISendDocuments) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + char msg[1024]; + char tempFileName[_MAX_PATH] = ""; + char lpszFullPaths[(_MAX_PATH + 1) * 4] = ""; + char lpszFileNames[(_MAX_PATH + 1) * 4] = ""; + + // Now get the names of the files to attach... + GetDlgItemText(hWnd, ID_EDIT_ATTACH1, tempFileName, sizeof(tempFileName)); + TackItOn(lpszFullPaths, lpszFileNames, tempFileName); + + GetDlgItemText(hWnd, ID_EDIT_ATTACH2, tempFileName, sizeof(tempFileName)); + TackItOn(lpszFullPaths, lpszFileNames, tempFileName); + + GetDlgItemText(hWnd, ID_EDIT_ATTACH3, tempFileName, sizeof(tempFileName)); + TackItOn(lpszFullPaths, lpszFileNames, tempFileName); + + GetDlgItemText(hWnd, ID_EDIT_ATTACH4, tempFileName, sizeof(tempFileName)); + TackItOn(lpszFullPaths, lpszFileNames, tempFileName); + + LONG rc = (*lpfnMAPISendDocuments) + ( (ULONG) hWnd, + lpszDelimChar, + lpszFullPaths, + lpszFileNames, + 0); + + if (rc == SUCCESS_SUCCESS) + { + ShowMessage(hWnd, "Success with MAPISendDocuments"); + SetFooter("MAPISendDocuments success"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from MAPISendDocuments\nError=[%s]", + rc, GetMAPIError(rc)); + ShowMessage(hWnd, msg); + SetFooter("MAPISendDocuments failed"); + } +} + +void +FreeMAPIFile(lpMapiFileDesc pv) +{ + if (!pv) + return; + + if (pv->lpszPathName != NULL) + free(pv->lpszPathName); + + if (pv->lpszFileName != NULL) + free(pv->lpszFileName); +} + +void +FreeMAPIRecipient(lpMapiRecipDesc pv) +{ + if (!pv) + return; + + if (pv->lpszName != NULL) + free(pv->lpszName); + + if (pv->lpszAddress != NULL) + free(pv->lpszAddress); + + if (pv->lpEntryID != NULL) + free(pv->lpEntryID); +} + +void +FreeMAPIMessage(lpMapiMessage pv) +{ + ULONG i; + + if (!pv) + return; + + if (pv->lpszSubject != NULL) + free(pv->lpszSubject); + + if (pv->lpszNoteText) + free(pv->lpszNoteText); + + if (pv->lpszMessageType) + free(pv->lpszMessageType); + + if (pv->lpszDateReceived) + free(pv->lpszDateReceived); + + if (pv->lpszConversationID) + free(pv->lpszConversationID); + + if (pv->lpOriginator) + FreeMAPIRecipient(pv->lpOriginator); + + for (i=0; inRecipCount; i++) + { + if (&(pv->lpRecips[i]) != NULL) + { + FreeMAPIRecipient(&(pv->lpRecips[i])); + } + } + + if (pv->lpRecips != NULL) + { + free(pv->lpRecips); + } + + for (i=0; inFileCount; i++) + { + if (&(pv->lpFiles[i]) != NULL) + { + FreeMAPIFile(&(pv->lpFiles[i])); + } + } + + if (pv->lpFiles != NULL) + { + free(pv->lpFiles); + } + + free(pv); + pv = NULL; +} + +void +DoMAPISendMail(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnMAPISendMail) (LHANDLE lhSession, ULONG ulUIParam, + lpMapiMessage lpMessage, FLAGS flFlags, ULONG ulReserved); + +#ifdef WIN16 + (FARPROC&) lpfnMAPISendMail = GetProcAddress(m_hInstMapi, "MAPISENDMAIL"); +#else + (FARPROC&) lpfnMAPISendMail = GetProcAddress(m_hInstMapi, "MAPISendMail"); +#endif + + if (!lpfnMAPISendMail) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + FLAGS flFlags = 0; + char msg[512]; + char file1[_MAX_PATH] = ""; + char file2[_MAX_PATH] = ""; + char file3[_MAX_PATH] = ""; + char file4[_MAX_PATH] = ""; + char toAddr[128]; + char ccAddr[128]; + char bccAddr[128]; + char subject[128]; + char noteText[4096]; + char dateReceived[128] = "N/A"; + char threadID[128] = "N/A";; + char origName[128] = "N/A";; + char origAddress[128] = "N/A";; + + GetDlgItemText(hWnd, ID_EDIT_TOADDRESS, toAddr, sizeof(toAddr)); + GetDlgItemText(hWnd, ID_EDIT_CCADDRESS, ccAddr, sizeof(ccAddr)); + GetDlgItemText(hWnd, ID_EDIT_BCCADDRESS, bccAddr, sizeof(bccAddr)); + GetDlgItemText(hWnd, ID_EDIT_SUBJECT, subject, sizeof(subject)); + GetDlgItemText(hWnd, ID_EDIT_NOTETEXT, noteText, sizeof(noteText)); + + // Do the one flag we support for this call... + if (BST_CHECKED == Button_GetCheck(GetDlgItem(hWnd, ID_CHECK_SHOWDIALOG))) + { + flFlags |= MAPI_DIALOG; + } + + // Build the message to send off... + lpMapiMessage msgPtr = (MapiMessage *)malloc(sizeof(MapiMessage)); + if (msgPtr == NULL) + { + return; + } + + memset(msgPtr, 0, sizeof(MapiMessage)); + + // + // At this point, we need to populate the structure of information + // we are passing in via the *lppMessage + // + + // Set all of the general information first! + msgPtr->lpszSubject = strdup(subject); + msgPtr->lpszNoteText = strdup(noteText); + msgPtr->lpszDateReceived = strdup(dateReceived); + msgPtr->lpszConversationID = strdup(threadID); + msgPtr->flFlags = flFlags; + + // Now deal with the recipients of this message + DWORD realRecips = 0; + if (toAddr[0] != '\0') ++realRecips; + if (ccAddr[0] != '\0') ++realRecips; + if (bccAddr[0] != '\0') ++realRecips; + + msgPtr->lpRecips = (lpMapiRecipDesc) malloc((size_t) (sizeof(MapiRecipDesc) * realRecips)); + if (!msgPtr->lpRecips) + { + FreeMAPIMessage(msgPtr); + return; + } + + msgPtr->nRecipCount = realRecips; + memset(msgPtr->lpRecips, 0, (size_t) (sizeof(MapiRecipDesc) * msgPtr->nRecipCount)); + + DWORD rCount = 0; + if (toAddr[0] != '\0') + { + msgPtr->lpRecips[rCount].lpszName = strdup(toAddr); + msgPtr->lpRecips[rCount].lpszAddress = strdup(toAddr); + msgPtr->lpRecips[rCount].ulRecipClass = MAPI_TO; + rCount++; + } + + if (ccAddr[0] != '\0') + { + msgPtr->lpRecips[rCount].lpszName = strdup(ccAddr); + msgPtr->lpRecips[rCount].lpszAddress = strdup(ccAddr); + msgPtr->lpRecips[rCount].ulRecipClass = MAPI_CC; + rCount++; + } + + if (bccAddr[0] != '\0') + { + msgPtr->lpRecips[rCount].lpszName = strdup(bccAddr); + msgPtr->lpRecips[rCount].lpszAddress = strdup(bccAddr); + msgPtr->lpRecips[rCount].ulRecipClass = MAPI_BCC; + rCount++; + } + + // Now get the names of the files to attach... + GetDlgItemText(hWnd, ID_EDIT_ATTACH1, file1, sizeof(file1)); + GetDlgItemText(hWnd, ID_EDIT_ATTACH2, file2, sizeof(file2)); + GetDlgItemText(hWnd, ID_EDIT_ATTACH3, file3, sizeof(file3)); + GetDlgItemText(hWnd, ID_EDIT_ATTACH4, file4, sizeof(file4)); + + DWORD realFiles = 0; + if (file1[0] != '\0') ++realFiles; + if (file2[0] != '\0') ++realFiles; + if (file3[0] != '\0') ++realFiles; + if (file4[0] != '\0') ++realFiles; + + // Now deal with the list of attachments! Since the nFileCount should be set + // correctly, this loop will automagically be correct + // + msgPtr->nFileCount = realFiles; + if (realFiles > 0) + { + msgPtr->lpFiles = (lpMapiFileDesc) malloc((size_t) (sizeof(MapiFileDesc) * realFiles)); + if (!msgPtr->lpFiles) + { + FreeMAPIMessage(msgPtr); + return; + } + + memset(msgPtr->lpFiles, 0, (size_t) (sizeof(MapiFileDesc) * msgPtr->nFileCount)); + } + + rCount = 0; + if (file1[0] != '\0') + { + msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file1); + msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file1); + ++rCount; + } + + if (file2[0] != '\0') + { + msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file2); + msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file2); + ++rCount; + } + + if (file3[0] != '\0') + { + msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file3); + msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file3); + ++rCount; + } + + if (file4[0] != '\0') + { + msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file4); + msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file4); + ++rCount; + } + + // Finally, make the call... + LONG rc = (*lpfnMAPISendMail) + (mapiSession, + (ULONG) hWnd, + msgPtr, + flFlags, + 0); + + if (rc == SUCCESS_SUCCESS) + { + ShowMessage(hWnd, "Success with MAPISendMail"); + SetFooter("MAPISendMail success"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from MAPISendMail\nError=[%s]", + rc, GetMAPIError(rc)); + ShowMessage(hWnd, msg); + SetFooter("MAPISendMail failed"); + } + + // Now cleanup and move on... + FreeMAPIMessage(msgPtr); +} + +void +DoMAPISaveMail(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnMAPISaveMail) (LHANDLE lhSession, ULONG ulUIParam, + lpMapiMessage lpMessage, FLAGS flFlags, ULONG ulReserved, + LPTSTR lpszMessageID); + +#ifdef WIN16 + (FARPROC&) lpfnMAPISaveMail = GetProcAddress(m_hInstMapi, "MAPISAVEMAIL"); +#else + (FARPROC&) lpfnMAPISaveMail = GetProcAddress(m_hInstMapi, "MAPISaveMail"); +#endif + + if (!lpfnMAPISaveMail) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + FLAGS flFlags = 0; + char msg[512]; + char file1[_MAX_PATH] = ""; + char file2[_MAX_PATH] = ""; + char file3[_MAX_PATH] = ""; + char file4[_MAX_PATH] = ""; + char toAddr[128]; + char ccAddr[128]; + char bccAddr[128]; + char subject[128]; + char noteText[4096]; + char dateReceived[128] = "N/A"; + char threadID[128] = "N/A";; + char origName[128] = "N/A";; + char origAddress[128] = "N/A";; + + GetDlgItemText(hWnd, ID_EDIT_TOADDRESS, toAddr, sizeof(toAddr)); + GetDlgItemText(hWnd, ID_EDIT_CCADDRESS, ccAddr, sizeof(ccAddr)); + GetDlgItemText(hWnd, ID_EDIT_BCCADDRESS, bccAddr, sizeof(bccAddr)); + GetDlgItemText(hWnd, ID_EDIT_SUBJECT, subject, sizeof(subject)); + GetDlgItemText(hWnd, ID_EDIT_NOTETEXT, noteText, sizeof(noteText)); + + // Build the message to send off... + lpMapiMessage msgPtr = (MapiMessage *)malloc(sizeof(MapiMessage)); + if (msgPtr == NULL) + { + return; + } + + memset(msgPtr, 0, sizeof(MapiMessage)); + + // + // At this point, we need to populate the structure of information + // we are passing in via the *lppMessage + // + + // Set all of the general information first! + msgPtr->lpszSubject = strdup(subject); + msgPtr->lpszNoteText = strdup(noteText); + msgPtr->lpszDateReceived = strdup(dateReceived); + msgPtr->lpszConversationID = strdup(threadID); + msgPtr->flFlags = flFlags; + + // Now deal with the recipients of this message + DWORD realRecips = 0; + if (toAddr[0] != '\0') ++realRecips; + if (ccAddr[0] != '\0') ++realRecips; + if (bccAddr[0] != '\0') ++realRecips; + + msgPtr->lpRecips = (lpMapiRecipDesc) malloc((size_t) (sizeof(MapiRecipDesc) * realRecips)); + if (!msgPtr->lpRecips) + { + FreeMAPIMessage(msgPtr); + return; + } + + msgPtr->nRecipCount = realRecips; + memset(msgPtr->lpRecips, 0, (size_t) (sizeof(MapiRecipDesc) * msgPtr->nRecipCount)); + + DWORD rCount = 0; + if (toAddr[0] != '\0') + { + msgPtr->lpRecips[rCount].lpszName = strdup(toAddr); + msgPtr->lpRecips[rCount].lpszAddress = strdup(toAddr); + msgPtr->lpRecips[rCount].ulRecipClass = MAPI_TO; + rCount++; + } + + if (ccAddr[0] != '\0') + { + msgPtr->lpRecips[rCount].lpszName = strdup(ccAddr); + msgPtr->lpRecips[rCount].lpszAddress = strdup(ccAddr); + msgPtr->lpRecips[rCount].ulRecipClass = MAPI_CC; + rCount++; + } + + if (bccAddr[0] != '\0') + { + msgPtr->lpRecips[rCount].lpszName = strdup(bccAddr); + msgPtr->lpRecips[rCount].lpszAddress = strdup(bccAddr); + msgPtr->lpRecips[rCount].ulRecipClass = MAPI_BCC; + rCount++; + } + + // Now get the names of the files to attach... + GetDlgItemText(hWnd, ID_EDIT_ATTACH1, file1, sizeof(file1)); + GetDlgItemText(hWnd, ID_EDIT_ATTACH2, file2, sizeof(file2)); + GetDlgItemText(hWnd, ID_EDIT_ATTACH3, file3, sizeof(file3)); + GetDlgItemText(hWnd, ID_EDIT_ATTACH4, file4, sizeof(file4)); + + DWORD realFiles = 0; + if (file1[0] != '\0') ++realFiles; + if (file2[0] != '\0') ++realFiles; + if (file3[0] != '\0') ++realFiles; + if (file4[0] != '\0') ++realFiles; + + // Now deal with the list of attachments! Since the nFileCount should be set + // correctly, this loop will automagically be correct + // + msgPtr->nFileCount = realFiles; + if (realFiles > 0) + { + msgPtr->lpFiles = (lpMapiFileDesc) malloc((size_t) (sizeof(MapiFileDesc) * realFiles)); + if (!msgPtr->lpFiles) + { + FreeMAPIMessage(msgPtr); + return; + } + + memset(msgPtr->lpFiles, 0, (size_t) (sizeof(MapiFileDesc) * msgPtr->nFileCount)); + } + + rCount = 0; + if (file1[0] != '\0') + { + msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file1); + msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file1); + ++rCount; + } + + if (file2[0] != '\0') + { + msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file2); + msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file2); + ++rCount; + } + + if (file3[0] != '\0') + { + msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file3); + msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file3); + ++rCount; + } + + if (file4[0] != '\0') + { + msgPtr->lpFiles[rCount].lpszPathName = strdup((LPSTR)file4); + msgPtr->lpFiles[rCount].lpszFileName = strdup((LPSTR)file4); + ++rCount; + } + + // Finally, make the call... + LONG rc = (*lpfnMAPISaveMail) + (mapiSession, + (ULONG) hWnd, + msgPtr, + flFlags, + 0, NULL); + + if (rc == SUCCESS_SUCCESS) + { + ShowMessage(hWnd, "Success with MAPISaveMail"); + SetFooter("MAPISaveMail success"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from MAPISaveMail\nError=[%s]", + rc, GetMAPIError(rc)); + ShowMessage(hWnd, msg); + SetFooter("MAPISaveMail failed"); + } + + // Now cleanup and move on... + FreeMAPIMessage(msgPtr); +} + +void +DoMAPIAddress(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnMAPIAddress) + (LHANDLE lhSession, + ULONG ulUIParam, + LPSTR lpszCaption, + ULONG nEditFields, + LPSTR lpszLabels, + ULONG nRecips, + lpMapiRecipDesc lpRecips, + FLAGS flFlags, + ULONG ulReserved, + LPULONG lpnNewRecips, + lpMapiRecipDesc FAR *lppNewRecips); + + +#ifdef WIN16 + (FARPROC&) lpfnMAPIAddress = GetProcAddress(m_hInstMapi, "MAPIADDRESS"); +#else + (FARPROC&) lpfnMAPIAddress = GetProcAddress(m_hInstMapi, "MAPIAddress"); +#endif + + if (!lpfnMAPIAddress) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + DWORD i; + FLAGS flFlags = 0; + DWORD addrCount = 0; + char msg[512]; + char toAddr[128]; + char ccAddr[128]; + char bccAddr[128]; + + GetDlgItemText(hWnd, ID_EDIT_TOADDRESS, toAddr, sizeof(toAddr)); + GetDlgItemText(hWnd, ID_EDIT_CCADDRESS, ccAddr, sizeof(ccAddr)); + GetDlgItemText(hWnd, ID_EDIT_BCCADDRESS, bccAddr, sizeof(bccAddr)); + + if (toAddr[0]) ++addrCount; + if (ccAddr[0]) ++addrCount; + if (bccAddr[0]) ++addrCount; + + lpMapiRecipDesc lpRecips = (lpMapiRecipDesc) malloc((size_t) (sizeof(MapiRecipDesc) * addrCount)); + if (!lpRecips) + { + return; + } + + memset(lpRecips, 0, (size_t) (sizeof(MapiRecipDesc) * addrCount)); + + DWORD rCount = 0; + if (toAddr[0] != '\0') + { + lpRecips[rCount].lpszName = strdup("To Address Name"); + lpRecips[rCount].lpszAddress = strdup(toAddr); + lpRecips[rCount].ulRecipClass = MAPI_TO; + rCount++; + } + + if (ccAddr[0] != '\0') + { + lpRecips[rCount].lpszName = strdup("CC Address Name"); + lpRecips[rCount].lpszAddress = strdup(ccAddr); + lpRecips[rCount].ulRecipClass = MAPI_CC; + rCount++; + } + + if (bccAddr[0] != '\0') + { + lpRecips[rCount].lpszName = strdup("BCC Address Name"); + lpRecips[rCount].lpszAddress = strdup(bccAddr); + lpRecips[rCount].ulRecipClass = MAPI_BCC; + rCount++; + } + + ULONG newRecips; + lpMapiRecipDesc lpNewRecips; + + // Finally, make the call... + LONG rc = (*lpfnMAPIAddress) + (mapiSession, + 0, + "MAPI Test Address Picker", + 0, + NULL, + rCount, + lpRecips, + 0, + 0, + &newRecips, + &lpNewRecips); + if (rc == SUCCESS_SUCCESS) + { + for (i=0; i +#include +#include + +#ifndef MAPI_OLE // Because MSFT doesn't do this for us :-( +#include +#endif + +#include "port.h" +#include "resource.h" + +// +// Variables... +// +extern HINSTANCE hInst; +HINSTANCE m_hInstMapi; +LHANDLE mapiSession = 0; + +// +// Forward declarations... +// +void LoadNSCPVersionFunc(HWND hWnd); +void DoMAPILogon(HWND hWnd); +void DoMAPILogoff(HWND hWnd); +void DoMAPIFreeBuffer(HWND hWnd, LPVOID buf, BOOL alert); +void DoMAPISendMail(HWND hWnd); +void DoMAPISendDocuments(HWND hWnd); +void DoMAPIFindNext(HWND hWnd); +void DoMAPIReadMail(HWND hWnd); +void DoMAPIDeleteMail(HWND hWnd); +void DoMAPIDetails(HWND hWnd); +void DoMAPIResolveName(HWND hWnd); +void DoMAPIResolveNameFreeBuffer(HWND hWnd); +void SetFooter(LPSTR msg); +void DoMAPI_NSCP_Sync(HWND hWnd); +LPSTR GetMAPIError(LONG errorCode); +extern void DisplayMAPIReadMail(HWND hWnd, lpMapiMessage msgPtr); +lpMapiMessage GetMessage(HWND hWnd, LPSTR id); + +void +SetFooter(LPSTR msg) +{ + extern HWND hWnd; + + SetDlgItemText(hWnd, ID_STATIC_RESULT, msg); +} + +char FAR * +GetMAPIError(LONG errorCode) +{ + static char FAR msg[128]; + + switch (errorCode) { + case MAPI_E_FAILURE: + lstrcpy(msg, "General MAPI Failure"); + break; + + case MAPI_E_INSUFFICIENT_MEMORY: + strcpy(msg, "Insufficient Memory"); + break; + + case MAPI_E_LOGIN_FAILURE: + strcpy(msg, "Login Failure"); + break; + + case MAPI_E_TOO_MANY_SESSIONS: + strcpy(msg, "Too many MAPI sessions"); + break; + + case MAPI_E_INVALID_SESSION: + strcpy(msg, "Invalid Session!"); + break; + + case MAPI_E_INVALID_MESSAGE: + strcpy(msg, "Message identifier was bad!"); + break; + + case MAPI_E_NO_MESSAGES: + strcpy(msg, "No messages were found!"); + break; + + case MAPI_E_ATTACHMENT_WRITE_FAILURE: + strcpy(msg, "Attachment write failure!"); + break; + + case MAPI_E_DISK_FULL: + strcpy(msg, "Attachment write failure! DISK FULL"); + break; + + case MAPI_E_AMBIGUOUS_RECIPIENT: + strcpy(msg, "Recipient requested is not a unique address list entry."); + break; + + case MAPI_E_UNKNOWN_RECIPIENT: + strcpy(msg, "Recipient requested does not exist."); + break; + + case MAPI_E_NOT_SUPPORTED: + strcpy(msg, "Not supported by messaging system"); + break; + + case SUCCESS_SUCCESS: + strcpy(msg, "Success on MAPI operation"); + break; + + case MAPI_E_INVALID_RECIPS: + strcpy(msg, "Recipient specified in the lpRecip parameter was\nunknown. No dialog box was displayed."); + break; + + case MAPI_E_ATTACHMENT_OPEN_FAILURE: + strcpy(msg, "One or more files could not be located. No message was sent."); + break; + + case MAPI_E_ATTACHMENT_NOT_FOUND: + strcpy(msg, "The specified attachment was not found. No message was sent."); + break; + + case MAPI_E_BAD_RECIPTYPE: + strcpy(msg, "The type of a recipient was not MAPI_TO, MAPI_CC, or MAPI_BCC. No message was sent."); + break; + + default: + strcpy(msg, "Unknown MAPI Return Code"); + break; + } + + return((LPSTR) &(msg[0])); +} + +void +ShowMessage(HWND hWnd, LPSTR msg) +{ + MessageBox(hWnd, msg, "Info Message", MB_ICONINFORMATION); +} + +BOOL +OpenMAPI(void) +{ +#ifdef WIN16 + m_hInstMapi = LoadLibrary("Y:\\ns\\cmd\\winfe\\mapi\\MAPI.DLL"); +#else + m_hInstMapi = LoadLibrary("Y:\\ns\\cmd\\winfe\\mapi\\x86Dbg\\MAPI32.DLL"); + //m_hInstMapi = LoadLibrary("MAPI32.DLL"); +#endif + + if (!m_hInstMapi) + { + ShowMessage(NULL, "Error Loading the MAPI DLL...Probably not found!"); + return(FALSE); + } + + return(TRUE); +} + +void +CloseMAPI(void) +{ + if(m_hInstMapi) + { + FreeLibrary(m_hInstMapi); + } +} + +void +ProcessCommand(HWND hWnd, int id, HWND hCtl, UINT codeNotify) +{ + switch (id) + { + case ID_BUTTON_SYNC: + DoMAPI_NSCP_Sync(hWnd); + break; + + case ID_BUTTON_NSCPVERSION: + LoadNSCPVersionFunc(hWnd); + break; + + case ID_BUTTON_LOGON: + DoMAPILogon(hWnd); + break; + + case ID_BUTTON_LOGOFF: + DoMAPILogoff(hWnd); + break; + + case ID_BUTTON_FINDNEXT: + case ID_MENU_MAPIFINDNEXT: + DoMAPIFindNext(hWnd); + break; + + case ID_BUTTON_READMAIL: + case ID_MENU_MAPIREADMAIL: + DoMAPIReadMail(hWnd); + break; + + case ID_BUTTON_MAIL: + { + extern CALLBACK LOADDS + MailDlgProc(HWND hWndMain, UINT wMsg, WPARAM wParam, LPARAM lParam); + + DialogBox(hInst, MAKEINTRESOURCE(ID_DIALOG_MAIL), hWnd, + (DLGPROC)MailDlgProc); + } + break; + + case ID_BUTTON_DELETEMAIL: + case ID_MENU_MAPIDELETEMAIL: + DoMAPIDeleteMail(hWnd); + break; + + case ID_MENU_MYEXIT: + DestroyWindow(hWnd); + break; + + case ID_BUTTON_CLEAR: + case ID_MENU_CLEARRESULTS: + ListBox_ResetContent(GetDlgItem(hWnd, ID_LIST_RESULT)); + break; + + case ID_BUTTON_FREEBUFFER: + DoMAPIResolveNameFreeBuffer(hWnd); + break; + + case ID_BUTTON_RESOLVENAME: + DoMAPIResolveName(hWnd); + break; + + case ID_BUTTON_DETAILS: + DoMAPIDetails(hWnd); + break; + + case ID_MENU_MYABOUT: + MessageBox(hWnd, + "Netscape MAPI Test Harness\nWritten by: Rich Pizzarro (rhp@netscape.com)", + "About", + MB_ICONINFORMATION); + break; + + default: + break; + } +} + +void +DoMAPILogon(HWND hWnd) +{ + char msg[1024]; + char user[128] = ""; + char pw[128] = ""; + + // Get Address of MAPI function... + ULONG (FAR PASCAL *lpfnMAPILogon)(ULONG, LPSTR, LPSTR, FLAGS, ULONG, LPLHANDLE); + +#ifdef WIN16 + (FARPROC&) lpfnMAPILogon = GetProcAddress(m_hInstMapi, "MAPILOGON"); +#else + (FARPROC&) lpfnMAPILogon = GetProcAddress(m_hInstMapi, "MAPILogon"); +#endif + + if (!lpfnMAPILogon) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + GetDlgItemText(hWnd, ID_EDIT_USERNAME, user, sizeof(user)); + GetDlgItemText(hWnd, ID_EDIT_PW, pw, sizeof(pw)); + + LONG rc = (*lpfnMAPILogon)((ULONG) hWnd, user, pw, + MAPI_FORCE_DOWNLOAD | MAPI_NEW_SESSION, 0, &mapiSession); + if (rc == SUCCESS_SUCCESS) + { + wsprintf(msg, "Success with session = %d", mapiSession); + ShowMessage(hWnd, msg); + SetFooter("Logon success"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from Logon\nError=[%s]", + rc, GetMAPIError(rc)); + ShowMessage(hWnd, msg); + SetFooter("Logon failed"); + } +} + +void +DoMAPILogoff(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnMAPILogoff) ( LHANDLE lhSession, ULONG ulUIParam, + FLAGS flFlags, ULONG ulReserved); + +#ifdef WIN16 + (FARPROC&) lpfnMAPILogoff = GetProcAddress(m_hInstMapi, "MAPILOGOFF"); +#else + (FARPROC&) lpfnMAPILogoff = GetProcAddress(m_hInstMapi, "MAPILogoff"); +#endif + + if (!lpfnMAPILogoff) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + char msg[1024]; + LONG rc = (*lpfnMAPILogoff)(mapiSession, (ULONG) hWnd, 0, 0); + if (rc == SUCCESS_SUCCESS) + { + wsprintf(msg, "Successful logoff"); + ShowMessage(hWnd, msg); + SetFooter(msg); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from Logoff\nError=[%s]", + rc, GetMAPIError(rc)); + + ShowMessage(hWnd, msg); + SetFooter("Logoff failed"); + } + + mapiSession = 0; +} + +void +DoMAPIFreeBuffer(HWND hWnd, LPVOID buf, BOOL alert) +{ + ULONG (FAR PASCAL *lpfnMAPIFreeBuffer) (LPVOID lpBuffer); + +#ifdef WIN16 + (FARPROC&) lpfnMAPIFreeBuffer = GetProcAddress(m_hInstMapi, "MAPIFREEBUFFER"); +#else + (FARPROC&) lpfnMAPIFreeBuffer = GetProcAddress(m_hInstMapi, "MAPIFreeBuffer"); +#endif + + if (!lpfnMAPIFreeBuffer) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + char msg[1024]; + LONG rc = (*lpfnMAPIFreeBuffer)(buf); +#ifdef WIN32 + if (rc == S_OK) +#else + if (rc == SUCCESS_SUCCESS) +#endif + { + wsprintf(msg, "Successful Free Buffer Operation"); + if (alert) + ShowMessage(hWnd, msg); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from Logoff", rc); + ShowMessage(hWnd, msg); + } +} + +void +DoMAPIFindNext(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnMAPIFindNext) (LHANDLE lhSession, ULONG ulUIParam, + LPTSTR lpszMessageType, LPTSTR lpszSeedMessageID, FLAGS flFlags, + ULONG ulReserved, LPTSTR lpszMessageID); + +#ifdef WIN16 + (FARPROC&) lpfnMAPIFindNext = GetProcAddress(m_hInstMapi, "MAPIFINDNEXT"); +#else + (FARPROC&) lpfnMAPIFindNext = GetProcAddress(m_hInstMapi, "MAPIFindNext"); +#endif + + if (!lpfnMAPIFindNext) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + // Clear the list before we start... + ListBox_ResetContent(GetDlgItem(hWnd, ID_LIST_RESULT)); + + char msg[1024]; + char messageID[512]; + LONG rc; +#ifdef WIN32 + FLAGS flags = MAPI_GUARANTEE_FIFO | MAPI_LONG_MSGID | MAPI_UNREAD_ONLY; +#else + FLAGS flags = MAPI_GUARANTEE_FIFO | MAPI_UNREAD_ONLY; +#endif + + while ( (rc = (*lpfnMAPIFindNext) (mapiSession, + (ULONG) hWnd, + NULL, + NULL, + flags, + 0, + messageID)) == SUCCESS_SUCCESS) + { + // + + lpMapiMessage mapiMsg = GetMessage(hWnd, messageID); + if (mapiMsg != NULL) + { + wsprintf(msg, "%s: \"%s\" Sender: %s", + messageID, + mapiMsg->lpszSubject, + mapiMsg->lpOriginator->lpszName); + DoMAPIFreeBuffer(hWnd, mapiMsg, FALSE); + } + else + { + lstrcpy(msg, messageID); + } + + ListBox_InsertString(GetDlgItem(hWnd, ID_LIST_RESULT), 0, msg); + } + + wsprintf(msg, "Enumeration ended: Return code %d from MAPIFindNext\nCondition=[%s]", + rc, GetMAPIError(rc)); + ShowMessage(hWnd, msg); + SetFooter("Enumeration ended"); +} + +void +DoMAPIReadMail(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnMAPIReadMail) (LHANDLE lhSession, ULONG ulUIParam, + LPTSTR lpszMessageID, FLAGS flFlags, ULONG ulReserved, + lpMapiMessage FAR * lppMessage); + +#ifdef WIN16 + (FARPROC&) lpfnMAPIReadMail = GetProcAddress(m_hInstMapi, "MAPIREADMAIL"); +#else + (FARPROC&) lpfnMAPIReadMail = GetProcAddress(m_hInstMapi, "MAPIReadMail"); +#endif + + if (!lpfnMAPIReadMail) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + char msg[1024]; + char lpszMessageID[512]; + lpMapiMessage lpMessage = NULL; + FLAGS flFlags = 0; + + DWORD selected = ListBox_GetCurSel(GetDlgItem(hWnd, ID_LIST_RESULT)); + if (selected == LB_ERR) + { + ShowMessage(hWnd, "You need to select a valid message. Make sure\nyou have done a MAPIFindNext and selected\none of the resulting messages."); + return; + } + + ListBox_GetText(GetDlgItem(hWnd, ID_LIST_RESULT), selected, lpszMessageID); + + // Do the various flags for this call... + if (BST_CHECKED == Button_GetCheck(GetDlgItem(hWnd, IDC_CHECK_BODYASFILE))) + { + flFlags |= MAPI_BODY_AS_FILE; + } + + if (BST_CHECKED == Button_GetCheck(GetDlgItem(hWnd, IDC_CHECK_ENVELOPEONLY))) + { + flFlags |= MAPI_ENVELOPE_ONLY; + } + + if (BST_CHECKED == Button_GetCheck(GetDlgItem(hWnd, IDC_CHECK_PEEK))) + { + flFlags |= MAPI_PEEK; + } + + if (BST_CHECKED == Button_GetCheck(GetDlgItem(hWnd, IDC_CHECK_SUPPRESSATTACH))) + { + flFlags |= MAPI_SUPPRESS_ATTACH; + } + + char *ptr = strchr( (const char *) lpszMessageID, ':'); + if (ptr) *ptr = '\0'; + + LONG rc = (*lpfnMAPIReadMail) + (mapiSession, + (ULONG) hWnd, + lpszMessageID, + flFlags, + 0, + &lpMessage); + + // Deal with error up front and return if need be... + if (rc != SUCCESS_SUCCESS) + { + wsprintf(msg, "FAILURE: Return code %d from MAPIReadMail\nError=[%s]", + rc, GetMAPIError(rc)); + + ShowMessage(hWnd, msg); + SetFooter("ReadMail failed"); + return; + } + + // Now display the message and then return... + DisplayMAPIReadMail(hWnd, lpMessage); + DoMAPIFreeBuffer(hWnd, lpMessage, TRUE); +} + +void +DoMAPIDeleteMail(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnMAPIDeleteMail) (LHANDLE lhSession, ULONG ulUIParam, + LPTSTR lpszMessageID, FLAGS flFlags, ULONG ulReserved); + +#ifdef WIN16 + (FARPROC&) lpfnMAPIDeleteMail = GetProcAddress(m_hInstMapi, "MAPIDELETEMAIL"); +#else + (FARPROC&) lpfnMAPIDeleteMail = GetProcAddress(m_hInstMapi, "MAPIDeleteMail"); +#endif + + if (!lpfnMAPIDeleteMail) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + char msg[1024]; + char lpszMessageID[512]; + lpMapiMessage lpMessage = NULL; + + DWORD selected = ListBox_GetCurSel(GetDlgItem(hWnd, ID_LIST_RESULT)); + if (selected == LB_ERR) + { + ShowMessage(hWnd, "You need to select a valid message. Make sure\nyou have done a MAPIFindNext and selected\none of the resulting messages."); + return; + } + + ListBox_GetText(GetDlgItem(hWnd, ID_LIST_RESULT), selected, lpszMessageID); + + char *ptr = strchr( (const char *) lpszMessageID, ':'); + if (ptr) *ptr = '\0'; + + LONG rc = (*lpfnMAPIDeleteMail) + (mapiSession, + (ULONG) hWnd, + lpszMessageID, + 0, + 0); + + // Deal with the return code... + if (rc == SUCCESS_SUCCESS) + { + wsprintf(msg, "Successful deletion"); + ShowMessage(hWnd, msg); + SetFooter(msg); + + // If it worked, refresh the list... + ShowMessage(hWnd, "The message list will now be refreshed\nsince one message was deleted."); + DoMAPIFindNext(hWnd); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from MAPIDeleteMail\nError=[%s]", + rc, GetMAPIError(rc)); + + ShowMessage(hWnd, msg); + SetFooter("Logoff failed"); + } +} + +// This is for the name lookup stuff... +lpMapiRecipDesc lpRecip = NULL; + +void +DoMAPIResolveName(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnMAPIResolveName) (LHANDLE lhSession, ULONG ulUIParam, + LPTSTR lpszName, FLAGS flFlags, ULONG ulReserved, + lpMapiRecipDesc FAR * lppRecip); + +#ifdef WIN16 + (FARPROC&) lpfnMAPIResolveName = GetProcAddress(m_hInstMapi, "MAPIRESOLVENAME"); +#else + (FARPROC&) lpfnMAPIResolveName = GetProcAddress(m_hInstMapi, "MAPIResolveName"); +#endif + + if (!lpfnMAPIResolveName) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + if (lpRecip != NULL) + { + ShowMessage(hWnd, "We need to free memory from a previous call..."); + DoMAPIFreeBuffer(hWnd, lpRecip, TRUE); + lpRecip = NULL; + } + + char userName[512]; + char msg[1024]; + FLAGS flFlags = 0; // We support none... + + GetDlgItemText(hWnd, IDC_EDIT_RESOLVENAME, userName, sizeof(userName)); + LONG rc = (*lpfnMAPIResolveName) + (mapiSession, + (ULONG) hWnd, + userName, + flFlags, + 0, + &lpRecip); + + // Deal with error up front and return if need be... + if (rc != SUCCESS_SUCCESS) + { + wsprintf(msg, "FAILURE: Return code %d from DoMAPIResolveName\nError=[%s]", + rc, GetMAPIError(rc)); + + ShowMessage(hWnd, msg); + SetFooter("DoMAPIResolveName failed"); + return; + } + + // If we get here, we should probably show the information that we + // got back + wsprintf(msg, "Received information for %s\nName=[%s]\nAddress=[%s]\nID=[%s]", + userName, lpRecip->lpszName, lpRecip->lpszAddress, (LPSTR) lpRecip->lpEntryID); + ShowMessage(hWnd, msg); +} + +void +DoMAPIResolveNameFreeBuffer(HWND hWnd) +{ + if (lpRecip == NULL) + { + ShowMessage(hWnd, "There is no memory allocated from MAPIResolveName()\nto be freed. Request ignored."); + } + else + { + DoMAPIFreeBuffer(hWnd, lpRecip, TRUE); + lpRecip = NULL; + } +} + +void +DoMAPIDetails(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnMAPIDetails) (LHANDLE lhSession, ULONG ulUIParam, + lpMapiRecipDesc lpRecip, FLAGS flFlags, ULONG ulReserved); + +#ifdef WIN16 + (FARPROC&) lpfnMAPIDetails = GetProcAddress(m_hInstMapi, "MAPIDetails"); +#else + (FARPROC&) lpfnMAPIDetails = GetProcAddress(m_hInstMapi, "MAPIDetails"); +#endif + + if (!lpfnMAPIDetails) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + char msg[1024]; + FLAGS flFlags = 0; // We really don't support these... + + LONG rc = (*lpfnMAPIDetails) + (mapiSession, + (ULONG) hWnd, + lpRecip, + flFlags, + 0); + + if (rc == SUCCESS_SUCCESS) + { + + wsprintf(msg, "MAPIDetails call succeeded"); + ShowMessage(hWnd, msg); + SetFooter(msg); + } + else + { + + wsprintf(msg, "FAILURE: Return code %d from MAPIDetails\nError=[%s]", + rc, GetMAPIError(rc)); + + if (lpRecip == NULL) + { + lstrcat(msg, "\nNOTE: There is no valid pointer from a MAPIResolveName()\ncall to show details about."); + } + + ShowMessage(hWnd, msg); + SetFooter("MAPIDetails failed"); + } +} + +lpMapiMessage +GetMessage(HWND hWnd, LPSTR id) +{ + ULONG (FAR PASCAL *lpfnMAPIReadMail) (LHANDLE lhSession, ULONG ulUIParam, + LPTSTR lpszMessageID, FLAGS flFlags, ULONG ulReserved, + lpMapiMessage FAR * lppMessage); + +#ifdef WIN16 + (FARPROC&) lpfnMAPIReadMail = GetProcAddress(m_hInstMapi, "MAPIREADMAIL"); +#else + (FARPROC&) lpfnMAPIReadMail = GetProcAddress(m_hInstMapi, "MAPIReadMail"); +#endif + + if (!lpfnMAPIReadMail) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return NULL; + } + + char msg[1024]; + lpMapiMessage lpMessage = NULL; + FLAGS flFlags = 0; + + flFlags |= MAPI_ENVELOPE_ONLY; + LONG rc = (*lpfnMAPIReadMail) + (mapiSession, + (ULONG) hWnd, + id, + flFlags, + 0, + &lpMessage); + + // Deal with error up front and return if need be... + if (rc != SUCCESS_SUCCESS) + { + wsprintf(msg, "FAILURE: Return code %d from MAPIReadMail\nError=[%s]", + rc, GetMAPIError(rc)); + + ShowMessage(hWnd, msg); + SetFooter("ReadMail failed"); + return NULL; + } + + return(lpMessage); +} + +void +LoadNSCPVersionFunc(HWND hWnd) +{ + ULONG (FAR PASCAL *lpfnLoadNSCPVersion) ( void ); + +#ifdef WIN16 + (FARPROC&) lpfnLoadNSCPVersion = GetProcAddress(m_hInstMapi, "MAPIGETNERSCAPEVERSION"); +#else + (FARPROC&) lpfnLoadNSCPVersion = GetProcAddress(m_hInstMapi, "MAPIGetNetscapeVersion"); +#endif + + if (!lpfnLoadNSCPVersion) + { + ShowMessage(hWnd, "Unable to locate MAPIGetNetscapeVersion() function."); + } + else + { + ShowMessage(hWnd, "MAPIGetNetscapeVersion() function was FOUND!"); + } + return; +} + +void +DoMAPI_NSCP_Sync(HWND hWnd) +{ +ULONG (FAR PASCAL *lpfnNSCPSync) ( LHANDLE lhSession, + ULONG ulReserved ); +#ifdef WIN16 + (FARPROC&) lpfnNSCPSync = GetProcAddress(m_hInstMapi, "MAPI_NSCP_SYNCHRONIZECLIENT"); +#else + (FARPROC&) lpfnNSCPSync = GetProcAddress(m_hInstMapi, "MAPI_NSCP_SynchronizeClient"); +#endif + + if (!lpfnNSCPSync) + { + ShowMessage(hWnd, "Unable to locate MAPI function."); + return; + } + + LONG rc = (*lpfnNSCPSync) (mapiSession, 0); + + char msg[256]; + + // Deal with error up front and return if need be... + if (rc != SUCCESS_SUCCESS) + { + wsprintf(msg, "FAILURE: Return code %d from MAPI_NSCP_SynchronizeClient\nError=[%s]", + rc, GetMAPIError(rc)); + + ShowMessage(hWnd, msg); + SetFooter("MAPI_NSCP_SynchronizeClient failed"); + return; + } + else + { + wsprintf(msg, "Success for MAPI_NSCP_SynchronizeClient"); + ShowMessage(hWnd, msg); + SetFooter("MAPI_NSCP_SynchronizeClient success"); + } +} diff --git a/mozilla/cmd/winfe/mapitest/mtest32.mak b/mozilla/cmd/winfe/mapitest/mtest32.mak new file mode 100644 index 00000000000..57b6676c189 --- /dev/null +++ b/mozilla/cmd/winfe/mapitest/mtest32.mak @@ -0,0 +1,286 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# Insert copyright and license here 1997 +# ** DO NOT EDIT ** +/* -*- 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. + */ +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=mtest32 - Win32 Debug +!MESSAGE No configuration specified. Defaulting to mtest32 - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "mtest32 - Win32 Release" && "$(CFG)" !=\ + "mtest32 - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "mtest32.mak" CFG="mtest32 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "mtest32 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "mtest32 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "mtest32 - Win32 Debug" +CPP=cl.exe +RSC=rc.exe +MTL=mktyplib.exe + +!IF "$(CFG)" == "mtest32 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "x86Rel" +# PROP Intermediate_Dir "x86Rel" +# PROP Target_Dir "" +OUTDIR=.\x86Rel +INTDIR=.\x86Rel + +ALL : "$(OUTDIR)\mtest32.exe" + +CLEAN : + -@erase "$(INTDIR)\main.obj" + -@erase "$(INTDIR)\mapimail.obj" + -@erase "$(INTDIR)\mapiproc.obj" + -@erase "$(INTDIR)\mtest32.res" + -@erase "$(INTDIR)\readmail.obj" + -@erase "$(OUTDIR)\mtest32.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /Gz /W3 /GX /O2 /I "..\qahook" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /Gz /ML /W3 /GX /O2 /I "..\qahook" /D "WIN32" /D "NDEBUG" /D\ + "_WINDOWS" /Fp"$(INTDIR)/mtest32.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\x86Rel/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/mtest32.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/mtest32.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/mtest32.pdb" /machine:I386 /out:"$(OUTDIR)/mtest32.exe" +LINK32_OBJS= \ + "$(INTDIR)\main.obj" \ + "$(INTDIR)\mapimail.obj" \ + "$(INTDIR)\mapiproc.obj" \ + "$(INTDIR)\mtest32.res" \ + "$(INTDIR)\readmail.obj" + +"$(OUTDIR)\mtest32.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "mtest32 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "x86Dbg" +# PROP Intermediate_Dir "x86Dbg" +# PROP Target_Dir "" +OUTDIR=.\x86Dbg +INTDIR=.\x86Dbg + +ALL : "$(OUTDIR)\mtest32.exe" + +CLEAN : + -@erase "$(INTDIR)\main.obj" + -@erase "$(INTDIR)\mapimail.obj" + -@erase "$(INTDIR)\mapiproc.obj" + -@erase "$(INTDIR)\mtest32.res" + -@erase "$(INTDIR)\readmail.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\mtest32.exe" + -@erase "$(OUTDIR)\mtest32.ilk" + -@erase "$(OUTDIR)\mtest32.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /Gz /W3 /Gm /GX /Zi /Od /I "..\qahook" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /Gz /MLd /W3 /Gm /GX /Zi /Od /I "..\qahook" /D "WIN32" /D\ + "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/mtest32.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\x86Dbg/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/mtest32.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/mtest32.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /nologo /subsystem:windows /incremental:yes\ + /pdb:"$(OUTDIR)/mtest32.pdb" /debug /machine:I386 /out:"$(OUTDIR)/mtest32.exe" +LINK32_OBJS= \ + "$(INTDIR)\main.obj" \ + "$(INTDIR)\mapimail.obj" \ + "$(INTDIR)\mapiproc.obj" \ + "$(INTDIR)\mtest32.res" \ + "$(INTDIR)\readmail.obj" + +"$(OUTDIR)\mtest32.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "mtest32 - Win32 Release" +# Name "mtest32 - Win32 Debug" + +!IF "$(CFG)" == "mtest32 - Win32 Release" + +!ELSEIF "$(CFG)" == "mtest32 - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\mtest32.rc +DEP_RSC_MTEST=\ + ".\nscicon.ico"\ + + +"$(INTDIR)\mtest32.res" : $(SOURCE) $(DEP_RSC_MTEST) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\mapiproc.cpp +DEP_CPP_MAPIP=\ + ".\port.h"\ + + +"$(INTDIR)\mapiproc.obj" : $(SOURCE) $(DEP_CPP_MAPIP) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\main.cpp +DEP_CPP_MAIN_=\ + ".\port.h"\ + + +"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\mapimail.cpp +DEP_CPP_MAPIM=\ + ".\port.h"\ + + +"$(INTDIR)\mapimail.obj" : $(SOURCE) $(DEP_CPP_MAPIM) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\readmail.cpp +DEP_CPP_READM=\ + ".\port.h"\ + + +"$(INTDIR)\readmail.obj" : $(SOURCE) $(DEP_CPP_READM) "$(INTDIR)" + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/mozilla/cmd/winfe/mapitest/mtest32.rc b/mozilla/cmd/winfe/mapitest/mtest32.rc new file mode 100644 index 00000000000..756b1b95cb8 --- /dev/null +++ b/mozilla/cmd/winfe/mapitest/mtest32.rc @@ -0,0 +1,261 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" +/* -*- 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. + */ +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +ID_DIALOG DIALOG DISCARDABLE 0, 0, 344, 229 +STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Netscape MAPI Test Harness" +MENU ID_MENU +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Open/Close",IDC_STATIC,4,4,336,27 + LTEXT "User:",IDC_STATIC,9,17,18,11 + EDITTEXT ID_EDIT_USERNAME,28,15,41,12,ES_AUTOHSCROLL + LTEXT "Password:",IDC_STATIC,74,17,38,11 + EDITTEXT ID_EDIT_PW,112,15,41,12,ES_PASSWORD | ES_AUTOHSCROLL + PUSHBUTTON "MAPILogon",ID_BUTTON_LOGON,157,13,46,14 + PUSHBUTTON "MAPILogoff",ID_BUTTON_LOGOFF,209,13,46,14 + GROUPBOX "Mail Operations",IDC_STATIC,4,36,336,142 + PUSHBUTTON "MAPIFindNext",ID_BUTTON_FINDNEXT,17,50,57,14 + PUSHBUTTON "MAPIDeleteMail",ID_BUTTON_DELETEMAIL,80,50,57,14 + PUSHBUTTON "Clear Results",ID_BUTTON_CLEAR,143,50,57,14 + PUSHBUTTON "Send Mail",ID_BUTTON_MAIL,206,50,57,14 + LISTBOX ID_LIST_RESULT,9,66,325,56,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | + WS_TABSTOP + GROUPBOX "User Information",IDC_STATIC,4,181,336,28 + PUSHBUTTON "MAPIResolveName",ID_BUTTON_RESOLVENAME,9,192,68,14 + EDITTEXT IDC_EDIT_RESOLVENAME,82,192,130,14,ES_AUTOHSCROLL + PUSHBUTTON "MAPIDetails",ID_BUTTON_DETAILS,219,192,48,14 + LTEXT "",ID_STATIC_RESULT,4,214,336,13,SS_SUNKEN + PUSHBUTTON "MAPIReadMail",ID_BUTTON_READMAIL,34,142,57,14 + CONTROL "MAPI_BODY_AS_FILE - Body as attachment", + IDC_CHECK_BODYASFILE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,121,125,188,9 + CONTROL "MAPI_ENVELOPE_ONLY - Header information only", + IDC_CHECK_ENVELOPEONLY,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,121,138,188,9 + CONTROL "MAPI_PEEK - Don't mark message as read",IDC_CHECK_PEEK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,121,151,188,9 + CONTROL "MAPI_SUPPRESS_ATTACH - Suppress attachments", + IDC_CHECK_SUPPRESSATTACH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,121,164,188,9 + PUSHBUTTON "<- MAPIFreeBuffer",ID_BUTTON_FREEBUFFER,272,192,63,14 + PUSHBUTTON "MAPIGetNSCPVersion",ID_BUTTON_NSCPVERSION,261,13,76,14 + PUSHBUTTON "Synchronize",ID_BUTTON_SYNC,269,50,57,14 +END + +ID_DIALOG_MAIL DIALOG DISCARDABLE 0, 0, 285, 246 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Composition" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Address Information",IDC_STATIC,4,4,275,55 + LTEXT "To:",IDC_STATIC,21,19,12,8 + EDITTEXT ID_EDIT_TOADDRESS,36,16,239,13,ES_AUTOHSCROLL + EDITTEXT ID_EDIT_CCADDRESS,36,30,239,13,ES_AUTOHSCROLL + EDITTEXT ID_EDIT_BCCADDRESS,36,44,239,13,ES_AUTOHSCROLL + LTEXT "Subject:",IDC_STATIC,5,65,29,9 + EDITTEXT ID_EDIT_SUBJECT,36,63,239,13,ES_AUTOHSCROLL + EDITTEXT ID_EDIT_NOTETEXT,4,78,271,72,ES_MULTILINE | + ES_AUTOHSCROLL + GROUPBOX "Attachments",IDC_STATIC,4,153,275,39 + EDITTEXT ID_EDIT_ATTACH1,16,162,122,13,ES_AUTOHSCROLL + EDITTEXT ID_EDIT_ATTACH2,16,176,122,13,ES_AUTOHSCROLL + EDITTEXT ID_EDIT_ATTACH3,147,162,122,13,ES_AUTOHSCROLL + EDITTEXT ID_EDIT_ATTACH4,147,175,122,13,ES_AUTOHSCROLL + PUSHBUTTON "MAPISendMail",ID_BUTTON_MAPISENDMAIL,70,204,58,14 + PUSHBUTTON "Cancel",IDCANCEL,50,225,84,14 + PUSHBUTTON "MAPISendDocuments",ID_BUTTON_MAPISENDDOCUMENTS,132,204, + 79,14 + CONTROL "Show Dialog",ID_CHECK_SHOWDIALOG,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,207,55,9 + LTEXT "cc:",IDC_STATIC,22,32,12,8 + LTEXT "bcc:",IDC_STATIC,18,47,15,8 + GROUPBOX "Send Operations",IDC_STATIC,4,196,275,26 + PUSHBUTTON "MAPISaveMail",ID_BUTTON_MAPISAVEMAIL,215,204,57,14 + PUSHBUTTON "MAPIAddress",ID_BUTTON_MAPIADDRESS,150,225,84,14 +END + +ID_DIALOG_READMAIL DIALOG DISCARDABLE 0, 0, 269, 266 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Mail Message" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Subject:",IDC_STATIC,5,71,27,9 + EDITTEXT IDC_EDIT_SUBJECT,36,69,229,12,ES_AUTOHSCROLL | + ES_READONLY + LISTBOX IDC_LIST_ATTACHMENTS,4,211,261,37,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_EDIT_BODYTEXT,4,113,261,85,ES_MULTILINE | + ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | + ES_WANTRETURN + LISTBOX IDC_LIST_RECIPIENTS,4,29,261,36,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "Recipients:",IDC_STATIC,4,19,43,9 + LTEXT "Attachments:",IDC_STATIC,4,202,43,9 + EDITTEXT IDC_EDIT_DATETIME,36,83,229,12,ES_AUTOHSCROLL | + ES_READONLY + LTEXT "Date:",IDC_STATIC,13,84,19,9 + PUSHBUTTON "OK",ID_OK,114,249,42,13 + EDITTEXT IDC_EDIT_THREAD,36,97,229,12,ES_AUTOHSCROLL | + ES_READONLY + LTEXT "Thread:",IDC_STATIC,6,99,25,9 + LTEXT "From:",IDC_STATIC,4,6,19,9 + EDITTEXT IDC_EDIT_FROM,27,4,238,12,ES_AUTOHSCROLL | ES_READONLY +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + ID_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 340 + VERTGUIDE, 9 + VERTGUIDE, 309 + TOPMARGIN, 4 + BOTTOMMARGIN, 227 + HORZGUIDE, 206 + END + + ID_DIALOG_MAIL, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 281 + TOPMARGIN, 4 + BOTTOMMARGIN, 239 + END + + ID_DIALOG_READMAIL, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 265 + TOPMARGIN, 4 + BOTTOMMARGIN, 262 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +ID_ICON_APP ICON DISCARDABLE "nscicon.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +ID_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "MAPI&FindNext", ID_MENU_MAPIFINDNEXT + MENUITEM "MAPI&ReadMail", ID_MENU_MAPIREADMAIL + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_MENU_MYEXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "MAPI&DeleteMail", ID_MENU_MAPIDELETEMAIL + MENUITEM "&Clear Results", ID_MENU_CLEARRESULTS + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", ID_MENU_MYABOUT + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/cmd/winfe/mapitest/nscicon.ico b/mozilla/cmd/winfe/mapitest/nscicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..ff147cebbd68d2cd0217165b14eab942e92944fb GIT binary patch literal 1718 zcma)+F-u%Q5P;|61rN128!N%YB4|C8t-Zm<+HS}{uu1VM>p(!*&LRn<2#D=#u1XQN z)+T~rAxI$F9av1hndhBG3}o+Sc4u~X=G)o#o=8t#$Z$B6Xlp%@H}v0R^>d1um~5J^Lo<}oXha_qo_}$V5yCHAp=7>okGd`gZ7YJzhZ8m5hSeUm zZLDjbY28$8IU2@vXR|tuNl%n$nQoep6yueZ-o>oRXr@Tht4J_KQ^b&hRK%H6q+5G2 zTiNSR>NH>-jru*`8fwH0HOUUmFzYn>Ig*pf%V02&g@pxKTwIi;r6pNjUY6C> zRaswOmz|v*+1lEY&CN~O*w~Qfz03Bt%SSmC|5fGt>2Eo`x{?oHzme$48NyVQaxUdu z%DI&D#xV`QF);jw-|)xL3;u$?U=;iXf0U!*ulOteilgFpY{&MRnH8-BR{|-Ulp1Dw zl)|7eC=3ciBEg_AC=3dN!jPCSC=3dN!k{oDIt&Vf!k{oH4C?scP&hO=c*dYg3PT$# z28+RxM~1~nZX_~-8Z21`CXIo?Vz6Xc;4nB04uiws$Wp;!Fc=I5LzK?oFc=Jm8qYgA zOGuvXhn?k(>Oe*A!m2DaxeH8%q=f_prb6z*WFbf)cOiFPN9M*){zCpj{Ae0jCOK@BP#H8?m}UN@U6EESdtL?vN905~#AgqVMVQ?56 z20|nFVQ?561_!{&UkT=HbQT#g4BO!Fj2&xCUdw0M-QAVFy*=6A-lfI zIXgR(^Ye4Lyu6g_>ub5ay_NBJEH`&9pAHXsj~l8R??80KODp1r=`t7XE?W+#R=CnL z8Qk|1v)h&W@i3=DvAgU3L+8qe<;gJDd*pZs_u$O96ZT1xzwjR&pqtP0OqZlJUJ<#N W + + +#ifndef CDECL +#define CDECL __cdecl +#endif // CDECL + +#ifndef PASCAL +#define PASCAL __pascal +#endif // PASCAL + +#ifdef FASTCALL +#error FASTCALL defined +#endif // FASTCALL + + +#ifdef NDEBUG +#define FASTCALL __fastcall +#else +#define FASTCALL PASCAL +#endif // NDEBUG + + + +#ifndef HWND2DWORD +# ifdef WIN32 +# define HWND2DWORD(X_hWnd) ( (DWORD)(X_hWnd) ) +# else // WIN16 +# define HWND2DWORD(X_hWnd) ( (DWORD)MAKELONG(((WORD)(X_hWnd)), 0) ) +# endif +#endif // HWND2DWORD + + +/* + * WIN16 - WIN32 compatibility stuff + */ + +#ifdef WIN32 + +# define DLLEXPORT __declspec( dllexport ) +# define EXPORT +# define LOADDS +# define HUGE +# ifndef FAR +# define FAR +# endif // FAR +# ifndef NEAR +# define NEAR +# endif // NEAR +# ifdef UNICODE +# define SIZEOF(x) (sizeof(x)/sizeof(WCHAR)) +# else +# define SIZEOF(x) sizeof(x) +# endif + +#else // !WIN32 == WIN16 + +# define DLLEXPORT +# define EXPORT __export +# define LOADDS __loadds +# define HUGE __huge +# ifndef FAR +# define FAR __far +# define NEAR __near +# endif // FAR +# define CONST const +# define SIZEOF(x) sizeof(x) +# define CHAR char +# define TCHAR char +# define WCHAR char +# ifndef LPTSTR +# define LPTSTR LPSTR +# endif +# ifndef LPCTSTR +# define LPCTSTR LPCSTR +# endif +# define UNREFERENCED_PARAMETER(x) x; +# ifndef TEXT +# define TEXT(x) x +# endif +# define GetWindowTextW GetWindowText +# define lstrcpyW lstrcpy + +# define BN_DBLCLK BN_DOUBLECLICKED // ~~MRJ needed for custom control. +// ~~MRJ begin Win95 backward compat section +# define LPWSTR LPSTR +# define LPCWSTR LPCSTR + +// button check state for WIN16 +#ifndef BST_UNCHECKED +#define BST_UNCHECKED 0x0000 +#endif + +#ifndef BST_CHECKED +#define BST_CHECKED 0x0001 +#endif + + +#ifndef WIN95_COMPAT +# define WIN95_COMPAT +#endif + +// ~~MRJ end Win95 compat section. + +// critical section API stubs +typedef DWORD CRITICAL_SECTION; +typedef CRITICAL_SECTION FAR * LPCRITICAL_SECTION; +#ifdef __cplusplus +inline void InitializeCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void DeleteCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void EnterCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void LeaveCriticalSection(LPCRITICAL_SECTION lpSection) {} +#endif // __cplusplus + +// Added for nssock16 ---Neeti +#ifndef ZeroMemory +#include +#define ZeroMemory(PTR, SIZE) memset(PTR, 0, SIZE) +#endif // ZeroMemory + +#endif // WIN16 + +/* + * unix - windows compatibility stuff + */ +typedef DWORD u_int32; +typedef WORD u_int16; +typedef BYTE u_int8; +#ifdef WIN32 +typedef short int Bool16; +#else // WIN16 +typedef BOOL Bool16; +#endif // WIN16 + +/* + * Cross Platform Compatibility + */ +#ifndef UNALIGNED +# ifdef _M_ALPHA +# define UNALIGNED __unaligned +# else // !_M_ALPHA +# define UNALIGNED +# endif // !_M_ALPHA +#endif // UNALIGNED + +// +// RICHIE - for the Alpha port +// +#ifdef _M_ALPHA +# undef pascal +# undef PASCAL +# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) +# define pascal __stdcall +# define PASCAL __stdcall +# else +# define PASCAL +# endif +#endif + + +/* + * Useful Types + */ +typedef char HUGE *HPSTR; +typedef const char HUGE *HPCSTR; +typedef unsigned char HUGE *HPBYTE; +typedef WORD HUGE *HPWORD; +typedef UINT FAR *LPUINT; +typedef BOOL (CALLBACK *USERABORTPROC)(); +typedef BOOL (CALLBACK *PROGRESSPROC)(UINT uPos, UINT uRange); +typedef int INT; // ~~MRJ a function needed this defined. +typedef MINMAXINFO FAR *LPMINMAXINFO; // ~~MRJ + +// +// stuff missing from windows.h +// +#ifndef MAKEWORD +#define MAKEWORD(low, high) ((WORD)(((BYTE)(low)) | (((WORD)((BYTE)(high))) << 8))) +#endif // MAKEWORD + +#ifdef WIN32 +# ifndef hmemcpy +# define hmemcpy memcpy +# endif // !defined(hmemcpy) +# define _fmemset memset + +# include + +#ifdef __cplusplus + +inline BOOL IsGDIObject(HGDIOBJ hObj) { return (hObj != 0); } +inline void *_halloc(long num, unsigned int size) { return malloc(num * size); } +inline void _hfree( void *memblock ) { free(memblock); } +/* +inline BOOL IsInstance(HINSTANCE hInst) { +# ifdef WIN32 + return (hInst != 0); +# else // WIN16 + return (hInst > HINSTANCE_ERROR); +# endif +} +*/ + +#endif // __cplusplus + + WINUSERAPI HANDLE WINAPI LoadImageA(HINSTANCE, LPCSTR, UINT, int, int, UINT); + +#endif // WIN32 + +#ifdef __cplusplus +inline BOOL IsInstance(HINSTANCE hInst) { +# ifdef WIN32 + return (hInst != 0); +# else // WIN16 + return (hInst > HINSTANCE_ERROR); +# endif +} +inline void SetWindowSmallIcon(HINSTANCE hInst, HWND hWnd, UINT uIconResourceId) { +#ifdef WIN32 +# ifndef WM_SETICON +# define WM_SETICON 0x0080 +# endif // WM_SETICON +# ifndef IMAGE_ICON +# define IMAGE_ICON 1 +# endif + assert(IsWindow(hWnd)); + HICON hIcon = (HICON)LoadImageA(hInst, MAKEINTRESOURCE(uIconResourceId), IMAGE_ICON, + 16, 16, 0); + if(NULL != hIcon) { + SendMessage(hWnd, WM_SETICON, FALSE, (LPARAM)hIcon); + } else { + HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(uIconResourceId)); + assert(hIcon != 0); + SendMessage(hWnd, WM_SETICON, FALSE, (LPARAM)hIcon); + } +#endif // WIN32 +} +#endif // __cplusplus + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* PORT_H */ diff --git a/mozilla/cmd/winfe/mapitest/readmail.cpp b/mozilla/cmd/winfe/mapitest/readmail.cpp new file mode 100644 index 00000000000..82cb54ba992 --- /dev/null +++ b/mozilla/cmd/winfe/mapitest/readmail.cpp @@ -0,0 +1,118 @@ +/* -*- 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. + */ +// +#include +#include + +#ifndef MAPI_OLE // Because MSFT doesn't do this for us :-( +#include +#endif + +#include "port.h" +#include "resource.h" + +// +// Variables... +// +extern HINSTANCE hInst; +extern HINSTANCE m_hInstMapi; +extern LHANDLE mapiSession; + +// +// Forward declarations... +// +extern void ShowMessage(HWND hWnd, LPSTR msg); +extern void SetFooter(LPSTR msg); +extern LPSTR GetMAPIError(LONG errorCode); +lpMapiMessage mailPtr = NULL; + +void +ProcessReadMailCommand(HWND hWnd, int id, HWND hCtl, UINT codeNotify) +{ + switch (id) + { + case ID_OK: + case IDCANCEL: + EndDialog(hWnd, 0); + break; + + default: + break; + } +} + +BOOL CALLBACK LOADDS +ReadMailDlgProc(HWND hWndMail, UINT wMsg, WPARAM wParam, LPARAM lParam) +{ + switch (wMsg) + { + case WM_INITDIALOG: + { + DWORD i; + // Do everything we need to display the message pointed to by + // mailPtr + if (!mailPtr) + break; + + // Start with the basics... + SetDlgItemText(hWndMail, IDC_EDIT_SUBJECT, mailPtr->lpszSubject); + SetDlgItemText(hWndMail, IDC_EDIT_DATETIME, mailPtr->lpszDateReceived); + SetDlgItemText(hWndMail, IDC_EDIT_THREAD, mailPtr->lpszConversationID); + SetDlgItemText(hWndMail, IDC_EDIT_BODYTEXT, mailPtr->lpszNoteText); + + char buf[1024]; + wsprintf(buf, "%s (%s)", mailPtr->lpOriginator->lpszName, + mailPtr->lpOriginator->lpszAddress); + SetDlgItemText(hWndMail, IDC_EDIT_FROM, buf); + + for (i=0; inRecipCount; i++) + { + wsprintf(buf, "%s (%s)", mailPtr->lpRecips[i].lpszName, + mailPtr->lpRecips[i].lpszAddress); + ListBox_InsertString(GetDlgItem(hWndMail, IDC_LIST_RECIPIENTS), + ListBox_GetCount(GetDlgItem(hWndMail, IDC_LIST_RECIPIENTS)), + buf); + } + + for (i=0; inFileCount; i++) + { + ListBox_InsertString(GetDlgItem(hWndMail, IDC_LIST_ATTACHMENTS), + ListBox_GetCount(GetDlgItem(hWndMail, IDC_LIST_ATTACHMENTS)), + mailPtr->lpFiles[i].lpszPathName); + } + } + break; + + case WM_COMMAND: + HANDLE_WM_COMMAND(hWndMail, wParam, lParam, ProcessReadMailCommand); + break; + + default: + return FALSE; + } + + return TRUE; +} + +void +DisplayMAPIReadMail(HWND hWnd, lpMapiMessage msgPtr) +{ + mailPtr = msgPtr; + DialogBox(hInst, MAKEINTRESOURCE(ID_DIALOG_READMAIL), hWnd, + (DLGPROC)ReadMailDlgProc); +} diff --git a/mozilla/cmd/winfe/mapitest/resource.h b/mozilla/cmd/winfe/mapitest/resource.h new file mode 100644 index 00000000000..e46437917be --- /dev/null +++ b/mozilla/cmd/winfe/mapitest/resource.h @@ -0,0 +1,104 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by mtest32.rc +// +/* -*- 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. + */ +#define ID_GUI_MESSAGE1 1 +#define ID_BUTTON_MAPIADDRESS 3 +#define ID_DIALOG 101 +#define ID_ICON_APP 102 +#define ID_MENU 104 +#define ID_DIALOG_MAIL 105 +#define ID_DIALOG_READMAIL 106 +#define ID_SETFROMEDIT 1000 +#define ID_SETTEXT 1001 +#define ID_GETROWS 1001 +#define ID_EDIT 1002 +#define ID_EDIT_HWND 1002 +#define ID_RESOURCETEXT 1003 +#define ID_GETTEXT 1003 +#define ID_STATIC_RESULT 1004 +#define ID_GETVISROWS 1005 +#define ID_GETWINID 1006 +#define ID_SETROWFOCUS 1007 +#define ID_GETROWFOCUS 1008 +#define ID_EDIT_ROW 1009 +#define ID_LIST_RESULT 1010 +#define ID_GETCOLCOUNT 1011 +#define ID_BUTTON_LOGON 1011 +#define ID_SETROWINVIEW 1012 +#define ID_BUTTON_LOGOFF 1012 +#define ID_GETNUMCHILDREN 1013 +#define ID_EDIT_USERNAME 1013 +#define ID_CLEARRESULTS 1014 +#define ID_EDIT_PW 1014 +#define ID_BUTTON_FINDNEXT 1015 +#define ID_BUTTON_CLEAR 1016 +#define ID_BUTTON_READMAIL 1017 +#define ID_BUTTON_DELETEMAIL 1018 +#define IDC_EDIT_RESOLVENAME 1019 +#define ID_BUTTON_MAPISENDMAIL 1020 +#define ID_BUTTON_NSCPVERSION 1020 +#define ID_BUTTON_RESOLVENAME 1021 +#define ID_BUTTON_MAPISENDDOCUMENTS 1021 +#define ID_EDIT_TOADDRESS 1022 +#define ID_EDIT_CCADDRESS 1023 +#define ID_BUTTON_DETAILS 1024 +#define ID_EDIT_BCCADDRESS 1024 +#define ID_EDIT_SUBJECT 1025 +#define ID_BUTTON_MAIL 1025 +#define ID_BUTTON_FREEBUFFER 1026 +#define ID_EDIT_NOTETEXT 1026 +#define ID_EDIT_ATTACH1 1027 +#define ID_BUTTON_SYNC 1027 +#define ID_EDIT_ATTACH2 1028 +#define IDC_CHECK_BODYASFILE 1028 +#define ID_EDIT_ATTACH3 1029 +#define IDC_CHECK_ENVELOPEONLY 1029 +#define IDC_LIST_ATTACHMENTS 1029 +#define ID_EDIT_ATTACH4 1030 +#define IDC_CHECK_PEEK 1030 +#define IDC_EDIT_BODYTEXT 1030 +#define IDC_CHECK_SUPPRESSATTACH 1031 +#define IDC_LIST_RECIPIENTS 1031 +#define ID_BUTTON_MAPISAVEMAIL 1031 +#define IDC_EDIT_SUBJECT 1032 +#define IDC_EDIT_DATETIME 1033 +#define ID_OK 1034 +#define IDC_EDIT_THREAD 1035 +#define ID_CHECK_SHOWDIALOG 1035 +#define IDC_EDIT_FROM 1036 +#define ID_MENU_MYEXIT 30001 +#define ID_MENU_CLEAR 30002 +#define ID_MENU_MYABOUT 30003 +#define ID_MENU_CLEARRESULTS 30004 +#define ID_MENU_MAPIDELETEMAIL 30005 +#define ID_MENU_MAPIFINDNEXT 30006 +#define ID_MENU_MAPIREADMAIL 30007 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 107 +#define _APS_NEXT_COMMAND_VALUE 30008 +#define _APS_NEXT_CONTROL_VALUE 1036 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mozilla/cmd/winfe/mkfiles32/mozilla.mak b/mozilla/cmd/winfe/mkfiles32/mozilla.mak index 982972548e7..2d09c31335c 100644 --- a/mozilla/cmd/winfe/mkfiles32/mozilla.mak +++ b/mozilla/cmd/winfe/mkfiles32/mozilla.mak @@ -15,7 +15,7 @@ # Copyright (C) 1998 Netscape Communications Corporation. All Rights # Reserved. -# +# # Mozilla makefile # Please use ns/client.mak for building. @@ -38,7 +38,7 @@ MOZ_SRC=y: !endif !if !defined(MOZ_OUT) -MOZ_OUT=. +MOZ_OUT=. !endif !if !defined(MOZ_INT) @@ -88,14 +88,14 @@ MOZ_NO_PATCHER=1 !IF "$(OS)" == "Windows_NT" NULL= -!ELSE +!ELSE NULL=nul -!ENDIF +!ENDIF CPP= \ !if "$(MOZ_BCPRO)" == "" - cl.exe + cl.exe !else bcompile.exe !endif @@ -134,7 +134,7 @@ PROD=16x86 # # Some will differ. -# +# # Using x86 for MOZ_MEDIUM # !ifdef MOZ_NAV_BUILD_PREFIX @@ -209,7 +209,6 @@ MOZ_STACK=33679 !if defined(MOZ_DEBUG) VERSTR=Dbg !if "$(MOZ_BITS)"=="32" -#CFLAGS_DEBUG=$(MOZ_DEBUG_FLAG) /Bd /DDEBUG /D_DEBUG $(MOZ_USERDEBUG)\ CFLAGS_DEBUG=$(MOZ_DEBUG_FLAG) /Bd /DDEBUG /D_DEBUG $(MOZ_USERDEBUG) /DCookieManagement /DSingleSignon\ !else CFLAGS_DEBUG=$(MOZ_DEBUG_FLAG) /Bd /DDEBUG /D_DEBUG $(MOZ_USERDEBUG)\ @@ -253,7 +252,8 @@ LINKFLAGS_DEBUG= \ # CFLAGS_DEFAULT=\ !if "$(MOZ_BITS)"=="32" - $(CFLAGS_DEBUG) + $(CFLAGS_DEBUG) \ + /I$(DEPTH)\dist\public\js /I$(DEPTH)\dist\public\security /I$(DEPTH)\dist\public\network /I$(DEPTH)\dist\public\htmldlgs /I$(DEPTH)\dist\public\libfont /I$(DEPTH)\dist\public\httpurl /I$(DEPTH)\dist\public\netcache /I$(DEPTH)\dist\public\jsdebug /I$(DEPTH)\dist\public\winfont !else $(CFLAGS_RELEASE) -DFORCE_PR_LOG !endif @@ -262,52 +262,47 @@ CFLAGS_DEFAULT=\ POLICY = moz40p3 -NEOFLAGS=/DqNeoThreads /DqNeoStandAlone /I$(DEPTH)\lib\libneo ^ - /I$(DEPTH)\lib\libneo\ibmpc ^ - /I$(DEPTH)\lib\libneo\ibmpc\alone - # # If you add a file in a new directory, you must add flags for that directory # -CFLAGS_LIBMSG_C= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/msgc.pch" /YX"msg.h" -CFLAGS_LIBMIME_C= $(CFLAGS_DEFAULT) +CFLAGS_LIBMIME_C= $(CFLAGS_DEFAULT) /I$(DEPTH)\dist\public\mime CFLAGS_LIBI18N_C= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/intlpriv.pch" /YX"intlpriv.h" CFLAGS_LIBIMG_C= $(CFLAGS_DEFAULT) /I$(DEPTH)\jpeg /Fp"$(OUTDIR)/xp.pch" /YX"xp.h" -CFLAGS_JTOOLS_C= $(CFLAGS_DEFAULT) +CFLAGS_JTOOLS_C= $(CFLAGS_DEFAULT) CFLAGS_LIBCNV_C= $(CFLAGS_DEFAULT) /I$(DEPTH)\jpeg /Fp"$(OUTDIR)/xp.pch" /YX"xp.h" -CFLAGS_JPEG_C= $(CFLAGS_DEFAULT) +CFLAGS_JPEG_C= $(CFLAGS_DEFAULT) CFLAGS_LAYOUT_C= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/layoutc.pch" /YX"xp.h" CFLAGS_LIBSTYLE_C= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/stylec.pch" /YX"xp.h" CFLAGS_LIBJAR_C= $(CFLAGS_DEFAULT) CFLAGS_LIBLAYER_C= $(CFLAGS_DEFAULT) CFLAGS_LIBMISC_C= $(CFLAGS_DEFAULT) +CFLAGS_LIBNET_C= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/netc.pch" /YX"mkutils.h" +CFLAGS_LIBNET_CPP= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/netcpp.pch" /YX"mkutils.h" +CFLAGS_LIBMSG_C= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/netc.pch" /YX"mkutils.h" +CFLAGS_LIBMSG_CPP= $(CFLAGS_DEFAULT) /I$(DEPTH)\dist\public\msg /I$(DEPTH)\lib\libaddr /I$(DEPTH)\lib\libmsg /Fp"$(OUTDIR)/netcpp.pch" /YX"mkutils.h" CFLAGS_LIBPARSE_C= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/pa_parse.pch" /YX"pa_parse.h" -CFLAGS_XP_C= $(CFLAGS_DEFAULT) -CFLAGS_LIBPICS_C= $(CFLAGS_DEFAULT) -CFLAGS_LIBPWCAC_C= $(CFLAGS_DEFAULT) -CFLAGS_XLATE_C= $(CFLAGS_DEFAULT) -CFLAGS_LIBDBM_C= $(CFLAGS_DEFAULT) -CFLAGS_PLUGIN_C= $(CFLAGS_DEBUG) +CFLAGS_XP_C= $(CFLAGS_DEFAULT) +CFLAGS_LIBPICS_C= $(CFLAGS_DEFAULT) +CFLAGS_LIBPWCAC_C= $(CFLAGS_DEFAULT) +CFLAGS_XLATE_C= $(CFLAGS_DEFAULT) +CFLAGS_LIBDBM_C= $(CFLAGS_DEFAULT) +CFLAGS_PLUGIN_C= $(CFLAGS_DEFAULT) CFLAGS_APPLET_C= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/lj.pch" /YX"lj.h" CFLAGS_EDTPLUG_C= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/le.pch" /YX"le.h" CFLAGS_LIBMOCHA_C= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/lm.pch" /YX"lm.h" -CFLAGS_LIBMSG_CPP= $(CFLAGS_DEFAULT) $(NEOFLAGS) /Fp"$(OUTDIR)/msgcpp.pch" /YX"msg.h" -CFLAGS_LIBADDR_CPP= $(CFLAGS_DEFAULT) $(NEOFLAGS) /Fp"$(OUTDIR)/addr.pch" /YX"neohdrsa.h" -CFLAGS_LIBADDR_C= $(CFLAGS_DEFAULT) $(NEOFLAGS) -CFLAGS_LIBNEO_CPP= $(CFLAGS_DEFAULT) $(NEOFLAGS) CFLAGS_LAYOUT_CPP= $(CFLAGS_DEFAULT) /Fp"$(OUTDIR)/editor.pch" /YX"editor.h" -CFLAGS_PLUGIN_CPP= $(CFLAGS_DEBUG) /I$(DEPTH)\cmd\winfe /Fp"$(OUTDIR)/stdafx.pch" /YX"stdafx.h" +CFLAGS_PLUGIN_CPP= $(CFLAGS_DEFAULT) /I$(DEPTH)\cmd\winfe /Fp"$(OUTDIR)/stdafx.pch" /YX"stdafx.h" CFLAGS_LIBPREF_C= $(CFLAGS_DEBUG) -CFLAGS_WINFE_C= $(CFLAGS_DEBUG) +CFLAGS_WINFE_C= $(CFLAGS_DEFAULT) !if "$(MOZ_BITS)"=="32" !if "$(MOZ_BCPRO)" == "" -CFLAGS_WINFE_CPP= $(CFLAGS_DEBUG) /I$(DEPTH)\jpeg /Fp"$(OUTDIR)/stdafx.pch" /YX"stdafx.h" +CFLAGS_WINFE_CPP= $(CFLAGS_DEFAULT) /I$(DEPTH)\jpeg /Fp"$(OUTDIR)/stdafx.pch" /YX"stdafx.h" !else -CFLAGS_WINFE_CPP= $(CFLAGS_DEBUG) /I$(DEPTH)\jpeg +CFLAGS_WINFE_CPP= $(CFLAGS_DEFAULT) /I$(DEPTH)\jpeg !endif !else -CFLAGS_WINFE_CPP= $(CFLAGS_DEBUG) +CFLAGS_WINFE_CPP= $(CFLAGS_DEFAULT) !endif !if "$(MOZ_BITS)"=="16" CFLAGS_WINDOWS_C= $(CFLAGS_DEFAULT) /I$(DEPTH)\dist\public\win16\private @@ -423,7 +418,7 @@ LINK_LIBS= \ $(DIST)\lib\cnetinit.lib \ !ifdef MOZ_LDAP !ifdef MOZ_JAVA - $(DIST)\lib\nsldap32.lib \ + $(DIST)\lib\nsldap32v30.lib \ !endif !endif $(DIST)\lib\unicvt32.lib \ @@ -437,6 +432,12 @@ LINK_LIBS= \ !endif !ifdef MOZ_LOC_INDEP $(DIST)\lib\li32.lib \ +!endif +!ifdef MOZ_MAIL_NEWS + $(DIST)\lib\mime.lib \ + $(DIST)\lib\msg.lib \ + $(DIST)\lib\addr.lib \ + $(DIST)\lib\neo.lib \ !endif $(DIST)\lib\prgrss32.lib \ $(DIST)\lib\sched32.lib \ @@ -445,6 +446,12 @@ LINK_LIBS= \ $(DIST)\lib\xpstrdll.lib \ !ifdef MOZ_MAIL_NEWS $(DIST)\lib\mnrc32.lib \ +!endif +!ifdef MOZ_CALENDAR + $(DIST)\lib\cal3240.lib \ + $(DIST)\lib\nsfmt3230.lib \ + $(DIST)\lib\nsuni3230.lib \ + $(DIST)\lib\nscnv3230.lib \ !endif $(DIST)\lib\zip$(MOZ_BITS)$(VERSION_NUMBER).lib \ $(DIST)\lib\jpeg$(MOZ_BITS)$(VERSION_NUMBER).lib \ @@ -503,7 +510,7 @@ LINK_FLAGS= \ /pdb:"$(OUTDIR)/mozilla.pdb" /machine:I386 \ !if !defined(MOZ_DEBUG) /fixed \ -!endif +!endif /nodefaultlib /out:"$(OUTDIR)/mozilla.exe" !else # $(DIST)\lib\jmc.lib \ @@ -554,15 +561,11 @@ CINCLUDES= \ /I$(DEPTH)\lib\layout \ /I$(DEPTH)\lib\libstyle \ /I$(DEPTH)\lib\liblayer\include \ + /I$(DEPTH)\lib\libmsg \ /I$(DEPTH)\lib\libcnv \ /I$(DEPTH)\lib\libi18n \ /I$(DEPTH)\lib\libparse \ /I$(DEPTH)\lib\plugin \ -!ifdef MOZ_MAIL_NEWS - /I$(DEPTH)\lib\libmsg \ - /I$(DEPTH)\lib\libaddr \ - /I$(DEPTH)\lib\libneo \ -!endif !else /I$(EXPORTINC) !endif @@ -573,8 +576,8 @@ CDEPENDINCLUDES= \ /I$(DEPTH)\cmd\winfe \ /I$(DEPTH)\jpeg -# if you add something to CDISTINCLUDES, you must also add it to the exports target -# at the end of the file. +# if you add something to CDISTINCLUDES1 or CDISTINCLUDES2, you must also add +# it to the exports target at the end of the file. CDISTINCLUDES1= \ !if "$(MOZ_BITS)" == "32" @@ -619,6 +622,13 @@ CDISTINCLUDES3= \ /I$(XPDIST)\public\progress \ /I$(XPDIST)\public\schedulr \ /I$(XPDIST)\public\xpcom \ +!ifdef MOZ_MAIL_NEWS + /I$(XPDIST)\public\mime \ + /I$(XPDIST)\public\net \ +!endif +!ifdef MOZ_CALENDAR + /I$(XPDIST)\public\calendar \ +!endif #!ifdef EDITOR !ifdef JAVA_OR_OJI /I$(XPDIST)\public\edtplug \ @@ -634,6 +644,9 @@ CDISTINCLUDES3= \ /I$(XPDIST)\public\img \ /I$(XPDIST)\public\jtools \ !endif +#Add additional include directories to CDISTINCLUDES2 + +CDISTINCLUDES2= \ /I$(XPDIST)\public \ /I$(XPDIST)\public\coreincl \ !ifndef NO_SECURITY @@ -725,7 +738,7 @@ all: "$(OUTDIR)" $(DEPTH)\cmd\winfe\mkfiles32\makedep.exe $(OUTDIR)\mozilla.dep $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak @rem <<$(PROD)$(VERSTR).dep - $(CINCLUDES) $(CDISTINCLUDES) $(CDEPENDINCLUDES) -O $(OUTDIR)\mozilla.dep + $(CINCLUDES) $(CDISTINCLUDES1) $(CDISTINCLUDES2) $(CDEPENDINCLUDES) -O $(OUTDIR)\mozilla.dep !IF "$(MOZ_BITS)"=="16" -16 !ENDIF @@ -739,104 +752,80 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\lib\liblayer\src\cl_util.c $(DEPTH)\lib\liblayer\src\xp_rect.c - $(DEPTH)\lib\layout\bullet.c + $(DEPTH)\lib\layout\bullet.c $(DEPTH)\lib\layout\clipline.c !ifdef EDITOR - $(DEPTH)\lib\layout\editor.cpp - $(DEPTH)\lib\layout\edtbuf.cpp - $(DEPTH)\lib\layout\edtcmd.cpp - $(DEPTH)\lib\layout\edtele.cpp - $(DEPTH)\lib\layout\edtjava.cpp - $(DEPTH)\lib\layout\edtsave.cpp - $(DEPTH)\lib\layout\edtutil.cpp + $(DEPTH)\lib\layout\editor.cpp + $(DEPTH)\lib\layout\edtbuf.cpp + $(DEPTH)\lib\layout\edtcmd.cpp + $(DEPTH)\lib\layout\edtele.cpp + $(DEPTH)\lib\layout\edtjava.cpp + $(DEPTH)\lib\layout\edtsave.cpp + $(DEPTH)\lib\layout\edtutil.cpp !endif - $(DEPTH)\lib\layout\layedit.c - $(DEPTH)\lib\layout\fsfile.cpp - $(DEPTH)\lib\layout\streams.cpp + $(DEPTH)\lib\layout\layedit.c + $(DEPTH)\lib\layout\fsfile.cpp + $(DEPTH)\lib\layout\streams.cpp $(DEPTH)\lib\layout\layarena.c - $(DEPTH)\lib\layout\layblock.c - $(DEPTH)\lib\layout\laycell.c - $(DEPTH)\lib\layout\laycols.c - $(DEPTH)\lib\layout\laydisp.c + $(DEPTH)\lib\layout\layblock.c + $(DEPTH)\lib\layout\laycell.c + $(DEPTH)\lib\layout\laycols.c + $(DEPTH)\lib\layout\laydisp.c $(DEPTH)\lib\layout\layembed.c - $(DEPTH)\lib\layout\layfind.c - $(DEPTH)\lib\layout\layform.c - $(DEPTH)\lib\layout\layfree.c - $(DEPTH)\lib\layout\laygrid.c + $(DEPTH)\lib\layout\layfind.c + $(DEPTH)\lib\layout\layform.c + $(DEPTH)\lib\layout\layfree.c + $(DEPTH)\lib\layout\laygrid.c $(DEPTH)\lib\layout\layhrule.c $(DEPTH)\lib\layout\layimage.c - $(DEPTH)\lib\layout\layinfo.c + $(DEPTH)\lib\layout\layinfo.c !if defined(MOZ_JAVA) - $(DEPTH)\lib\layout\layjava.c + $(DEPTH)\lib\layout\layjava.c !endif - $(DEPTH)\lib\layout\laylayer.c - $(DEPTH)\lib\layout\laylist.c - $(DEPTH)\lib\layout\laymap.c + $(DEPTH)\lib\layout\laylayer.c + $(DEPTH)\lib\layout\laylist.c + $(DEPTH)\lib\layout\laymap.c $(DEPTH)\lib\layout\laymocha.c $(DEPTH)\lib\layout\layobj.c - $(DEPTH)\lib\layout\layout.c - $(DEPTH)\lib\layout\layprobe.c + $(DEPTH)\lib\layout\layout.c + $(DEPTH)\lib\layout\layprobe.c $(DEPTH)\lib\layout\layscrip.c $(DEPTH)\lib\layout\laystyle.c - $(DEPTH)\lib\layout\laysel.c - $(DEPTH)\lib\layout\layspace.c - $(DEPTH)\lib\layout\laysub.c + $(DEPTH)\lib\layout\laysel.c + $(DEPTH)\lib\layout\layspace.c + $(DEPTH)\lib\layout\laysub.c $(DEPTH)\lib\layout\laytable.c - $(DEPTH)\lib\layout\laytags.c - $(DEPTH)\lib\layout\laytext.c - $(DEPTH)\lib\layout\layutil.c + $(DEPTH)\lib\layout\laytags.c + $(DEPTH)\lib\layout\laytext.c + $(DEPTH)\lib\layout\layutil.c $(DEPTH)\lib\layout\ptinpoly.c $(DEPTH)\lib\layout\layrelay.c $(DEPTH)\lib\layout\laytrav.c !endif - -!ifdef MOZ_MAIL_NEWS - $(DEPTH)\lib\libaddr\line64.c - $(DEPTH)\lib\libaddr\vobject.c - $(DEPTH)\lib\libaddr\vcc.c - $(DEPTH)\lib\libaddr\ab.cpp - $(DEPTH)\lib\libaddr\abcntxt.cpp - $(DEPTH)\lib\libaddr\abentry.cpp - $(DEPTH)\lib\libaddr\abinfo.cpp - $(DEPTH)\lib\libaddr\ablist.cpp - $(DEPTH)\lib\libaddr\addbook.cpp - $(DEPTH)\lib\libaddr\abpane.cpp - $(DEPTH)\lib\libaddr\nickindx.cpp - $(DEPTH)\lib\libaddr\tyindex.cpp - $(DEPTH)\lib\libaddr\import.cpp - $(DEPTH)\lib\libaddr\export.cpp - $(DEPTH)\lib\libaddr\abundoac.cpp - $(DEPTH)\lib\libaddr\abglue.cpp - $(DEPTH)\lib\libaddr\abcinfo.cpp - $(DEPTH)\lib\libaddr\abcpane.cpp - $(DEPTH)\lib\libaddr\abpane2.cpp - $(DEPTH)\lib\libaddr\abntfy.cpp -!endif - $(DEPTH)\lib\libi18n\detectu2.c $(DEPTH)\lib\libi18n\metatag.c $(DEPTH)\lib\libi18n\autokr.c $(DEPTH)\lib\libi18n\autocvt.c - $(DEPTH)\lib\libi18n\b52cns.c - $(DEPTH)\lib\libi18n\cns2b5.c - $(DEPTH)\lib\libi18n\cvchcode.c + $(DEPTH)\lib\libi18n\b52cns.c + $(DEPTH)\lib\libi18n\cns2b5.c + $(DEPTH)\lib\libi18n\cvchcode.c $(DEPTH)\lib\libi18n\euc2jis.c - $(DEPTH)\lib\libi18n\euc2sjis.c - $(DEPTH)\lib\libi18n\euckr2is.c - $(DEPTH)\lib\libi18n\fe_ccc.c - $(DEPTH)\lib\libi18n\doc_ccc.c - $(DEPTH)\lib\libi18n\intl_csi.c - $(DEPTH)\lib\libi18n\is2euckr.c - $(DEPTH)\lib\libi18n\intl_csi.c + $(DEPTH)\lib\libi18n\euc2sjis.c + $(DEPTH)\lib\libi18n\euckr2is.c + $(DEPTH)\lib\libi18n\fe_ccc.c + $(DEPTH)\lib\libi18n\doc_ccc.c + $(DEPTH)\lib\libi18n\intl_csi.c + $(DEPTH)\lib\libi18n\is2euckr.c + $(DEPTH)\lib\libi18n\intl_csi.c $(DEPTH)\lib\libi18n\jis2oth.c $(DEPTH)\lib\libi18n\nscstr.c - $(DEPTH)\lib\libi18n\sjis2euc.c - $(DEPTH)\lib\libi18n\sjis2jis.c - $(DEPTH)\lib\libi18n\ucs2.c - $(DEPTH)\lib\libi18n\ugen.c - $(DEPTH)\lib\libi18n\ugendata.c - $(DEPTH)\lib\libi18n\umap.c - $(DEPTH)\lib\libi18n\uscan.c + $(DEPTH)\lib\libi18n\sjis2euc.c + $(DEPTH)\lib\libi18n\sjis2jis.c + $(DEPTH)\lib\libi18n\ucs2.c + $(DEPTH)\lib\libi18n\ugen.c + $(DEPTH)\lib\libi18n\ugendata.c + $(DEPTH)\lib\libi18n\umap.c + $(DEPTH)\lib\libi18n\uscan.c !IF "$(MOZ_BITS)"=="16" $(DEPTH)\lib\libi18n\unicvt.c !ENDIF @@ -852,17 +841,16 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\lib\libi18n\dblower.c $(DEPTH)\lib\libi18n\kinsokud.c $(DEPTH)\lib\libi18n\kinsokuf.c - $(DEPTH)\lib\libi18n\net_junk.c - $(DEPTH)\lib\libi18n\katakana.c - $(DEPTH)\lib\libcnv\libcnv.c - $(DEPTH)\lib\libcnv\writejpg.c - $(DEPTH)\lib\libcnv\colorqnt.c - $(DEPTH)\lib\libcnv\readbmp.c - $(DEPTH)\lib\libcnv\libppm3.c + $(DEPTH)\lib\libi18n\net_junk.c + $(DEPTH)\lib\libi18n\katakana.c + $(DEPTH)\lib\libcnv\libcnv.c + $(DEPTH)\lib\libcnv\writejpg.c + $(DEPTH)\lib\libcnv\colorqnt.c + $(DEPTH)\lib\libcnv\readbmp.c + $(DEPTH)\lib\libcnv\libppm3.c !ifdef MOZ_MAIL_NEWS $(DEPTH)\lib\libmime\mimecont.c - $(DEPTH)\lib\libmime\mimecryp.c $(DEPTH)\lib\libmime\mimeebod.c $(DEPTH)\lib\libmime\mimeenc.c $(DEPTH)\lib\libmime\mimeeobj.c @@ -876,18 +864,12 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\lib\libmime\mimemmix.c $(DEPTH)\lib\libmime\mimemoz.c $(DEPTH)\lib\libmime\mimempar.c -!ifndef NO_SECURITY - $(DEPTH)\lib\libmime\mimempkc.c -!endif $(DEPTH)\lib\libmime\mimemrel.c $(DEPTH)\lib\libmime\mimemsg.c $(DEPTH)\lib\libmime\mimemsig.c $(DEPTH)\lib\libmime\mimemult.c $(DEPTH)\lib\libmime\mimeobj.c $(DEPTH)\lib\libmime\mimepbuf.c -!ifndef NO_SECURITY - $(DEPTH)\lib\libmime\mimepkcs.c -!endif $(DEPTH)\lib\libmime\mimesun.c $(DEPTH)\lib\libmime\mimetenr.c $(DEPTH)\lib\libmime\mimetext.c @@ -897,14 +879,15 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\lib\libmime\mimeunty.c $(DEPTH)\lib\libmime\mimevcrd.c $(DEPTH)\lib\libmime\mimedrft.c - $(DEPTH)\lib\libmisc\mime.c + $(DEPTH)\lib\libmisc\mime.c $(DEPTH)\lib\libmisc\dirprefs.c + $(DEPTH)\lib\libmime\mimecal.c !endif - - $(DEPTH)\lib\libmisc\glhist.c + + $(DEPTH)\lib\libmisc\glhist.c $(DEPTH)\lib\libmisc\hotlist.c - $(DEPTH)\lib\libmisc\shist.c - $(DEPTH)\lib\libmisc\undo.c + $(DEPTH)\lib\libmisc\shist.c + $(DEPTH)\lib\libmisc\undo.c !ifndef MOZ_NGLAYOUT $(DEPTH)\lib\libmocha\et_mocha.c @@ -915,20 +898,20 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\lib\libmocha\lm_doc.c $(DEPTH)\lib\libmocha\lm_embed.c $(DEPTH)\lib\libmocha\lm_event.c - $(DEPTH)\lib\libmocha\lm_form.c - $(DEPTH)\lib\libmocha\lm_hardw.c - $(DEPTH)\lib\libmocha\lm_hist.c - $(DEPTH)\lib\libmocha\lm_href.c + $(DEPTH)\lib\libmocha\lm_form.c + $(DEPTH)\lib\libmocha\lm_hardw.c + $(DEPTH)\lib\libmocha\lm_hist.c + $(DEPTH)\lib\libmocha\lm_href.c $(DEPTH)\lib\libmocha\lm_img.c - $(DEPTH)\lib\libmocha\lm_init.c - $(DEPTH)\lib\libmocha\lm_input.c - $(DEPTH)\lib\libmocha\lm_layer.c + $(DEPTH)\lib\libmocha\lm_init.c + $(DEPTH)\lib\libmocha\lm_input.c + $(DEPTH)\lib\libmocha\lm_layer.c $(DEPTH)\lib\libmocha\lm_nav.c - $(DEPTH)\lib\libmocha\lm_plgin.c - $(DEPTH)\lib\libmocha\lm_screen.c - $(DEPTH)\lib\libmocha\lm_supdt.c - $(DEPTH)\lib\libmocha\lm_taint.c - $(DEPTH)\lib\libmocha\lm_trggr.c + $(DEPTH)\lib\libmocha\lm_plgin.c + $(DEPTH)\lib\libmocha\lm_screen.c + $(DEPTH)\lib\libmocha\lm_supdt.c + $(DEPTH)\lib\libmocha\lm_taint.c + $(DEPTH)\lib\libmocha\lm_trggr.c $(DEPTH)\lib\libmocha\lm_url.c $(DEPTH)\lib\libmocha\lm_win.c !if "$(MOZ_BITS)" == "32" @@ -942,24 +925,22 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\lib\libmsg\ad_strm.c $(DEPTH)\lib\libmsg\msgppane.cpp $(DEPTH)\lib\libmsg\addr.c + $(DEPTH)\lib\libmsg\addrutil.c $(DEPTH)\lib\libmsg\ap_decod.c $(DEPTH)\lib\libmsg\ap_encod.c $(DEPTH)\lib\libmsg\appledbl.c - $(DEPTH)\lib\libmsg\bh_strm.c + $(DEPTH)\lib\libmsg\bh_strm.c + $(DEPTH)\lib\libmsg\biffmast.cpp $(DEPTH)\lib\libmsg\bytearr.cpp $(DEPTH)\lib\libmsg\chngntfy.cpp -!ifndef NO_SECURITY - $(DEPTH)\lib\libmsg\composec.c -!endif $(DEPTH)\lib\libmsg\dwordarr.cpp - $(DEPTH)\lib\libmsg\eneoidar.cpp $(DEPTH)\lib\libmsg\filters.cpp $(DEPTH)\lib\libmsg\grec.cpp $(DEPTH)\lib\libmsg\grpinfo.cpp - $(DEPTH)\lib\libmsg\hashtbl.cpp $(DEPTH)\lib\libmsg\hosttbl.cpp $(DEPTH)\lib\libmsg\idarray.cpp $(DEPTH)\lib\libmsg\imaphost.cpp + $(DEPTH)\lib\libmsg\imapoff.cpp $(DEPTH)\lib\libmsg\jsmsg.cpp $(DEPTH)\lib\libmsg\listngst.cpp $(DEPTH)\lib\libmsg\m_binhex.c @@ -968,28 +949,26 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\lib\libmsg\mhtmlstm.cpp $(DEPTH)\lib\libmsg\msgbg.cpp $(DEPTH)\lib\libmsg\msgbgcln.cpp - $(DEPTH)\lib\libmsg\msgbiff.c - $(DEPTH)\lib\libmsg\msgcpane.cpp $(DEPTH)\lib\libmsg\msgccach.cpp $(DEPTH)\lib\libmsg\msgcflds.cpp - $(DEPTH)\lib\libmsg\msgcmfld.cpp + $(DEPTH)\lib\libmsg\msgcmfld.cpp + $(DEPTH)\lib\libmsg\msgcpane.cpp $(DEPTH)\lib\libmsg\msgdb.cpp $(DEPTH)\lib\libmsg\msgdbini.cpp $(DEPTH)\lib\libmsg\msgdbvw.cpp - $(DEPTH)\lib\libmsg\msgdoc.cpp - $(DEPTH)\lib\libmsg\msgdwnof.cpp $(DEPTH)\lib\libmsg\msgdlqml.cpp + $(DEPTH)\lib\libmsg\msgdwnof.cpp $(DEPTH)\lib\libmsg\msgfcach.cpp $(DEPTH)\lib\libmsg\msgfinfo.cpp - $(DEPTH)\lib\libmsg\imapoff.cpp - $(DEPTH)\lib\libmsg\msgimap.cpp $(DEPTH)\lib\libmsg\msgfpane.cpp $(DEPTH)\lib\libmsg\msgglue.cpp $(DEPTH)\lib\libmsg\msghdr.cpp + $(DEPTH)\lib\libmsg\msgimap.cpp $(DEPTH)\lib\libmsg\msglpane.cpp $(DEPTH)\lib\libmsg\msglsrch.cpp - $(DEPTH)\lib\libmsg\msgmast.cpp $(DEPTH)\lib\libmsg\msgmapi.cpp + $(DEPTH)\lib\libmsg\msgmast.cpp + $(DEPTH)\lib\libmsg\msgmdn.cpp $(DEPTH)\lib\libmsg\msgmpane.cpp $(DEPTH)\lib\libmsg\msgmsrch.cpp $(DEPTH)\lib\libmsg\msgnsrch.cpp @@ -999,24 +978,22 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\lib\libmsg\msgprefs.cpp $(DEPTH)\lib\libmsg\msgpurge.cpp $(DEPTH)\lib\libmsg\msgrulet.cpp - $(DEPTH)\lib\libmsg\msgsec.cpp $(DEPTH)\lib\libmsg\msgsend.cpp $(DEPTH)\lib\libmsg\msgsendp.cpp $(DEPTH)\lib\libmsg\msgspane.cpp $(DEPTH)\lib\libmsg\msgtpane.cpp - $(DEPTH)\lib\libmsg\msgundmg.cpp $(DEPTH)\lib\libmsg\msgundac.cpp + $(DEPTH)\lib\libmsg\msgundmg.cpp $(DEPTH)\lib\libmsg\msgurlq.cpp $(DEPTH)\lib\libmsg\msgutils.c $(DEPTH)\lib\libmsg\msgzap.cpp - $(DEPTH)\lib\libmsg\msgmdn.cpp $(DEPTH)\lib\libmsg\newsdb.cpp - $(DEPTH)\lib\libmsg\newshdr.cpp - $(DEPTH)\lib\libmsg\newshost.cpp - $(DEPTH)\lib\libmsg\newspane.cpp - $(DEPTH)\lib\libmsg\newsset.cpp - $(DEPTH)\lib\libmsg\nwsartst.cpp - $(DEPTH)\lib\libmsg\prsembst.cpp + $(DEPTH)\lib\libmsg\newshdr.cpp + $(DEPTH)\lib\libmsg\newshost.cpp + $(DEPTH)\lib\libmsg\newspane.cpp + $(DEPTH)\lib\libmsg\newsset.cpp + $(DEPTH)\lib\libmsg\nwsartst.cpp + $(DEPTH)\lib\libmsg\prsembst.cpp $(DEPTH)\lib\libmsg\ptrarray.cpp $(DEPTH)\lib\libmsg\search.cpp $(DEPTH)\lib\libmsg\subline.cpp @@ -1026,60 +1003,14 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\lib\libmsg\thrlstst.cpp $(DEPTH)\lib\libmsg\thrnewvw.cpp $(DEPTH)\lib\libmsg\mozdb.cpp - - $(DEPTH)\lib\libneo\enstring.cpp - $(DEPTH)\lib\libneo\enswizz.cpp - $(DEPTH)\lib\libneo\nappl.cpp - $(DEPTH)\lib\libneo\nappsa.cpp - $(DEPTH)\lib\libneo\narray.cpp - $(DEPTH)\lib\libneo\nblob.cpp - $(DEPTH)\lib\libneo\nclass.cpp - $(DEPTH)\lib\libneo\ncstream.cpp - $(DEPTH)\lib\libneo\ndata.cpp - $(DEPTH)\lib\libneo\ndblndx.cpp - $(DEPTH)\lib\libneo\ndoc.cpp - $(DEPTH)\lib\libneo\nfltndx.cpp - $(DEPTH)\lib\libneo\nformat.cpp - $(DEPTH)\lib\libneo\nfree.cpp - $(DEPTH)\lib\libneo\nfstream.cpp - $(DEPTH)\lib\libneo\nidindex.cpp - $(DEPTH)\lib\libneo\nidlist.cpp - $(DEPTH)\lib\libneo\nindexit.cpp - $(DEPTH)\lib\libneo\ninode.cpp - $(DEPTH)\lib\libneo\nioblock.cpp - $(DEPTH)\lib\libneo\niter.cpp - $(DEPTH)\lib\libneo\nlaundry.cpp - $(DEPTH)\lib\libneo\nlongndx.cpp - $(DEPTH)\lib\libneo\nmeta.cpp - $(DEPTH)\lib\libneo\nmrswsem.cpp - $(DEPTH)\lib\libneo\nmsem.cpp - $(DEPTH)\lib\libneo\nnode.cpp - $(DEPTH)\lib\libneo\nnstrndx.cpp - $(DEPTH)\lib\libneo\noffsprn.cpp - $(DEPTH)\lib\libneo\npartmgr.cpp - $(DEPTH)\lib\libneo\npersist.cpp - $(DEPTH)\lib\libneo\npliter.cpp - $(DEPTH)\lib\libneo\nquery.cpp - $(DEPTH)\lib\libneo\nselect.cpp - $(DEPTH)\lib\libneo\nsselect.cpp - $(DEPTH)\lib\libneo\nstream.cpp - $(DEPTH)\lib\libneo\nstrndx.cpp - $(DEPTH)\lib\libneo\nsub.cpp - $(DEPTH)\lib\libneo\nthread.cpp - $(DEPTH)\lib\libneo\ntrans.cpp - $(DEPTH)\lib\libneo\nulngndx.cpp - $(DEPTH)\lib\libneo\nutils.cpp - $(DEPTH)\lib\libneo\nwselect.cpp - $(DEPTH)\lib\libneo\semnspr.cpp - $(DEPTH)\lib\libneo\thrnspr.cpp !endif !ifndef MOZ_NGLAYOUT $(DEPTH)\lib\libparse\pa_amp.c - $(DEPTH)\lib\libparse\pa_hash.c - $(DEPTH)\lib\libparse\pa_hook.c + $(DEPTH)\lib\libparse\pa_hash.c + $(DEPTH)\lib\libparse\pa_hook.c $(DEPTH)\lib\libparse\pa_mdl.c - $(DEPTH)\lib\libparse\pa_parse.c + $(DEPTH)\lib\libparse\pa_parse.c $(DEPTH)\lib\libstyle\libstyle.c $(DEPTH)\lib\libstyle\csslex.c @@ -1115,30 +1046,33 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak !ifndef MOZ_NGLAYOUT $(DEPTH)\lib\plugin\npassoc.c $(DEPTH)\lib\plugin\npglue.cpp - $(DEPTH)\lib\plugin\npwplat.cpp - $(DEPTH)\lib\plugin\nsplugin.cpp + $(DEPTH)\lib\plugin\npwplat.cpp + $(DEPTH)\lib\plugin\nsplugin.cpp - $(DEPTH)\lib\xlate\isotab.c + $(DEPTH)\lib\xlate\isotab.c $(DEPTH)\lib\xlate\stubs.c $(DEPTH)\lib\xlate\tblprint.c $(DEPTH)\lib\xlate\text.c !endif - $(DEPTH)\lib\xp\allxpstr.c $(DEPTH)\lib\xp\xp_alloc.c $(DEPTH)\lib\xp\xp_cntxt.c - $(DEPTH)\lib\xp\xp_core.c + $(DEPTH)\lib\xp\xp_core.c $(DEPTH)\lib\xp\xp_error.c - $(DEPTH)\lib\xp\xp_file.c + $(DEPTH)\lib\xp\xp_file.c $(DEPTH)\lib\xp\xp_hash.c - $(DEPTH)\lib\xp\xp_mesg.c + $(DEPTH)\lib\xp\xp_mesg.c +!ifdef MOZ_MAIL_NEWS + $(DEPTH)\lib\xp\xp_md5.c +!endif $(DEPTH)\lib\xp\xp_ncent.c - $(DEPTH)\lib\xp\xp_rgb.c - $(DEPTH)\lib\xp\xp_str.c + $(DEPTH)\lib\xp\xp_reg.c + $(DEPTH)\lib\xp\xp_rgb.c + $(DEPTH)\lib\xp\xp_str.c $(DEPTH)\lib\xp\xp_thrmo.c - $(DEPTH)\lib\xp\xp_time.c + $(DEPTH)\lib\xp\xp_time.c $(DEPTH)\lib\xp\xp_trace.c - $(DEPTH)\lib\xp\xp_wrap.c + $(DEPTH)\lib\xp\xp_wrap.c $(DEPTH)\lib\xp\xpassert.c $(DEPTH)\lib\xp\xp_list.c $(DEPTH)\lib\xp\xplocale.c @@ -1159,10 +1093,13 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\compmapi.cpp !endif !ifdef MOZ_MAIL_NEWS - $(DEPTH)\cmd\winfe\addrfrm.cpp - $(DEPTH)\cmd\winfe\addrdlg.cpp - $(DEPTH)\cmd\winfe\abmldlg.cpp - $(DEPTH)\cmd\winfe\advopdlg.cpp + $(DEPTH)\cmd\winfe\abhook.cpp + $(DEPTH)\cmd\winfe\abutils.cpp + $(DEPTH)\cmd\winfe\addrfrm.cpp + $(DEPTH)\cmd\winfe\addrdlg.cpp + $(DEPTH)\cmd\winfe\addrprop.cpp + $(DEPTH)\cmd\winfe\abmldlg.cpp + $(DEPTH)\cmd\winfe\advprosh.cpp $(DEPTH)\cmd\winfe\compbar.cpp $(DEPTH)\cmd\winfe\compfe.cpp $(DEPTH)\cmd\winfe\compfile.cpp @@ -1174,13 +1111,13 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\edframe.cpp $(DEPTH)\cmd\winfe\edprops.cpp $(DEPTH)\cmd\winfe\edtable.cpp - $(DEPTH)\cmd\winfe\edview.cpp - $(DEPTH)\cmd\winfe\edview2.cpp + $(DEPTH)\cmd\winfe\edview.cpp + $(DEPTH)\cmd\winfe\edview2.cpp $(DEPTH)\cmd\winfe\eddialog.cpp - $(DEPTH)\cmd\winfe\edlayout.cpp + $(DEPTH)\cmd\winfe\edlayout.cpp !endif !ifdef MOZ_MAIL_NEWS - $(DEPTH)\cmd\winfe\filter.cpp + $(DEPTH)\cmd\winfe\filter.cpp $(DEPTH)\cmd\winfe\edhdrdlg.cpp $(DEPTH)\cmd\winfe\mailfrm.cpp $(DEPTH)\cmd\winfe\mailfrm2.cpp @@ -1191,16 +1128,16 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\mapismem.cpp $(DEPTH)\cmd\winfe\mapimail.cpp $(DEPTH)\cmd\winfe\nsstrseq.cpp - $(DEPTH)\cmd\winfe\mnprefs.cpp - $(DEPTH)\cmd\winfe\mnwizard.cpp + $(DEPTH)\cmd\winfe\mnprefs.cpp + $(DEPTH)\cmd\winfe\mnwizard.cpp $(DEPTH)\cmd\winfe\msgfrm.cpp $(DEPTH)\cmd\winfe\msgtmpl.cpp $(DEPTH)\cmd\winfe\msgview.cpp $(DEPTH)\cmd\winfe\namcomp.cpp $(DEPTH)\cmd\winfe\numedit.cpp - $(DEPTH)\cmd\winfe\srchfrm.cpp - $(DEPTH)\cmd\winfe\subnews.cpp - $(DEPTH)\cmd\winfe\taskbar.cpp + $(DEPTH)\cmd\winfe\srchfrm.cpp + $(DEPTH)\cmd\winfe\subnews.cpp + $(DEPTH)\cmd\winfe\taskbar.cpp $(DEPTH)\cmd\winfe\thrdfrm.cpp !endif !ifdef EDITOR @@ -1209,37 +1146,40 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\spellcli.cpp !endif !ifdef MOZ_MAIL_NEWS - $(DEPTH)\cmd\winfe\dlgdwnld.cpp $(DEPTH)\cmd\winfe\dlghtmmq.cpp $(DEPTH)\cmd\winfe\dlghtmrp.cpp $(DEPTH)\cmd\winfe\dlgseldg.cpp $(DEPTH)\cmd\winfe\nsadrlst.cpp $(DEPTH)\cmd\winfe\nsadrnam.cpp $(DEPTH)\cmd\winfe\nsadrtyp.cpp - $(DEPTH)\cmd\winfe\fldrfrm.cpp + $(DEPTH)\cmd\winfe\offlndlg.cpp + $(DEPTH)\cmd\winfe\offpkdlg.cpp + $(DEPTH)\cmd\winfe\fldrfrm.cpp $(DEPTH)\cmd\winfe\dspppage.cpp $(DEPTH)\cmd\winfe\srchdlg.cpp $(DEPTH)\cmd\winfe\srchobj.cpp $(DEPTH)\cmd\winfe\mnrccln.cpp !endif - $(DEPTH)\cmd\winfe\setupwiz.cpp + $(DEPTH)\cmd\winfe\setupwiz.cpp $(DEPTH)\cmd\winfe\ngdwtrst.cpp - $(DEPTH)\cmd\winfe\animbar.cpp - $(DEPTH)\cmd\winfe\animbar2.cpp - $(DEPTH)\cmd\winfe\apiapi.cpp + $(DEPTH)\cmd\winfe\animbar.cpp + $(DEPTH)\cmd\winfe\animbar2.cpp + $(DEPTH)\cmd\winfe\apiapi.cpp $(DEPTH)\cmd\winfe\animecho.cpp - $(DEPTH)\cmd\winfe\askmedlg.cpp +!ifdef MOZ_OFFLINE + $(DEPTH)\cmd\winfe\askmedlg.cpp +!endif $(DEPTH)\cmd\winfe\authdll.cpp !ifndef MOZ_NGLAYOUT - $(DEPTH)\cmd\winfe\button.cpp + $(DEPTH)\cmd\winfe\button.cpp !endif $(DEPTH)\cmd\winfe\cfe.cpp $(DEPTH)\cmd\winfe\cmdparse.cpp - $(DEPTH)\cmd\winfe\cntritem.cpp + $(DEPTH)\cmd\winfe\cntritem.cpp $(DEPTH)\cmd\winfe\confhook.cpp $(DEPTH)\cmd\winfe\csttlbr2.cpp - $(DEPTH)\cmd\winfe\custom.cpp !ifndef MOZ_NGLAYOUT + $(DEPTH)\cmd\winfe\custom.cpp $(DEPTH)\cmd\winfe\cuvfm.cpp $(DEPTH)\cmd\winfe\cuvfs.cpp $(DEPTH)\cmd\winfe\cvffc.cpp @@ -1249,8 +1189,8 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\cxdc1.cpp $(DEPTH)\cmd\winfe\cxicon.cpp $(DEPTH)\cmd\winfe\cxinit.cpp - $(DEPTH)\cmd\winfe\cxmeta.cpp - $(DEPTH)\cmd\winfe\cxnet1.cpp + $(DEPTH)\cmd\winfe\cxmeta.cpp + $(DEPTH)\cmd\winfe\cxnet1.cpp $(DEPTH)\cmd\winfe\cxpane.cpp !ifndef MOZ_NGLAYOUT $(DEPTH)\cmd\winfe\cxprint.cpp @@ -1263,8 +1203,8 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\dateedit.cpp $(DEPTH)\cmd\winfe\dde.cpp $(DEPTH)\cmd\winfe\ddecmd.cpp - $(DEPTH)\cmd\winfe\ddectc.cpp - $(DEPTH)\cmd\winfe\dialog.cpp + $(DEPTH)\cmd\winfe\ddectc.cpp + $(DEPTH)\cmd\winfe\dialog.cpp $(DEPTH)\cmd\winfe\display.cpp $(DEPTH)\cmd\winfe\dragbar.cpp !ifndef MOZ_NGLAYOUT @@ -1293,10 +1233,10 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\fmbutton.cpp $(DEPTH)\cmd\winfe\fmfile.cpp $(DEPTH)\cmd\winfe\fmradio.cpp - $(DEPTH)\cmd\winfe\fmrdonly.cpp - $(DEPTH)\cmd\winfe\fmselmul.cpp - $(DEPTH)\cmd\winfe\fmselone.cpp - $(DEPTH)\cmd\winfe\fmtext.cpp + $(DEPTH)\cmd\winfe\fmrdonly.cpp + $(DEPTH)\cmd\winfe\fmselmul.cpp + $(DEPTH)\cmd\winfe\fmselone.cpp + $(DEPTH)\cmd\winfe\fmtext.cpp $(DEPTH)\cmd\winfe\fmtxarea.cpp !endif $(DEPTH)\cmd\winfe\frameglu.cpp @@ -1304,16 +1244,16 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\genchrom.cpp $(DEPTH)\cmd\winfe\gendoc.cpp $(DEPTH)\cmd\winfe\genedit.cpp - $(DEPTH)\cmd\winfe\genframe.cpp - $(DEPTH)\cmd\winfe\genfram2.cpp - $(DEPTH)\cmd\winfe\prefs.cpp + $(DEPTH)\cmd\winfe\genframe.cpp + $(DEPTH)\cmd\winfe\genfram2.cpp + $(DEPTH)\cmd\winfe\prefs.cpp $(DEPTH)\cmd\winfe\genview.cpp !ifndef MOZ_NGLAYOUT $(DEPTH)\cmd\winfe\gridedge.cpp !endif $(DEPTH)\cmd\winfe\helpers.cpp - $(DEPTH)\cmd\winfe\hiddenfr.cpp - $(DEPTH)\cmd\winfe\histbld.cpp + $(DEPTH)\cmd\winfe\hiddenfr.cpp + $(DEPTH)\cmd\winfe\histbld.cpp $(DEPTH)\cmd\winfe\imagemap.cpp !if "$(MOZ_BITS)" == "32" $(DEPTH)\cmd\winfe\intelli.cpp @@ -1321,7 +1261,7 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\intlwin.cpp $(DEPTH)\cmd\winfe\ipframe.cpp $(DEPTH)\cmd\winfe\lastacti.cpp - $(DEPTH)\cmd\winfe\logindg.cpp + $(DEPTH)\cmd\winfe\logindg.cpp $(DEPTH)\cmd\winfe\mainfrm.cpp !ifndef MOZ_NGLAYOUT $(DEPTH)\cmd\winfe\medit.cpp @@ -1399,18 +1339,19 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak $(DEPTH)\cmd\winfe\testcasemanager.cpp $(DEPTH)\cmd\winfe\tclist.cpp $(DEPTH)\cmd\winfe\testcasedlg.cpp -!endif - $(DEPTH)\cmd\winfe\timer.cpp - $(DEPTH)\cmd\winfe\tip.cpp - $(DEPTH)\cmd\winfe\tlbutton.cpp - $(DEPTH)\cmd\winfe\toolbar2.cpp - $(DEPTH)\cmd\winfe\tooltip.cpp - $(DEPTH)\cmd\winfe\urlbar.cpp +!endif + $(DEPTH)\cmd\winfe\timer.cpp + $(DEPTH)\cmd\winfe\tip.cpp + $(DEPTH)\cmd\winfe\tlbutton.cpp + $(DEPTH)\cmd\winfe\toolbar2.cpp + $(DEPTH)\cmd\winfe\tooltip.cpp + $(DEPTH)\cmd\winfe\urlbar.cpp $(DEPTH)\cmd\winfe\urlecho.cpp $(DEPTH)\cmd\winfe\usertlbr.cpp - $(DEPTH)\cmd\winfe\viewerse.cpp - $(DEPTH)\cmd\winfe\winclose.cpp + $(DEPTH)\cmd\winfe\viewerse.cpp + $(DEPTH)\cmd\winfe\winclose.cpp $(DEPTH)\cmd\winfe\winpref.c + $(DEPTH)\cmd\winfe\winprog.cpp !ifdef MOZ_LOC_INDEP $(DEPTH)\cmd\winfe\winli.cpp !endif @@ -1443,7 +1384,7 @@ $(DEPTH)\cmd\winfe\mkfiles32\makedep.exe: $(DEPTH)\cmd\winfe\mkfiles32\makedep.c ALL : $(OUTDIR)\mozilla.dep "$(OUTDIR)" prebuild $(OUTDIR)\resdll.dll $(OUTDIR)\appicon.res $(OUTDIR)\mozilla.exe $(OUTDIR)\mozilla.tlb install rebase \ !if !defined(MOZ_NO_PATCHER) # Allow building without patcher. You get intl security, but faster build time -"$(OUTDIR)\netsc_us.exe" "$(OUTDIR)\netsc_fr.exe" +"$(OUTDIR)\netsc_us.exe" "$(OUTDIR)\netsc_fr.exe" !else !endif @@ -1456,7 +1397,7 @@ PURIFY : "$(OUTDIR)" "$(OUTDIR)\PurifyCache" "$(OUTDIR)\mozilla.exe" pure !ENDIF -# +# # utility Stuff. # $(OUTDIR) : @@ -1669,6 +1610,20 @@ install: \ $(OUTDIR)\mnrc$(MOZ_BITS).dll \ !ENDIF !endif +!ifdef MOZ_CALENDAR +!IF EXIST($(DIST)\bin\cal3240.dll) + $(OUTDIR)\cal3240.dll \ +!ENDIF +!IF EXIST($(DIST)\bin\nsfmt3230.dll) + $(OUTDIR)\nsfmt3230.dll \ +!ENDIF +!IF EXIST($(DIST)\bin\nsuni3230.dll) + $(OUTDIR)\nsuni3230.dll \ +!ENDIF +!IF EXIST($(DIST)\bin\nscnv3230.dll) + $(OUTDIR)\nscnv3230.dll \ +!ENDIF +!endif !IF EXIST($(DIST)\bin\xpstrdll.dll) $(OUTDIR)\xpstrdll.dll \ !ENDIF @@ -1762,8 +1717,8 @@ install: \ $(OUTDIR)\dynfonts\nstdfp32.dll \ !ENDIF !ifdef MOZ_LDAP -!IF EXIST($(DIST)\bin\nsldap32.dll) - $(OUTDIR)\nsldap32.dll \ +!IF EXIST($(DIST)\bin\nsldap32v30.dll) + $(OUTDIR)\nsldap32v30.dll \ !ENDIF !endif !IF EXIST($(DIST)\bin\unicvt32.dll) @@ -2064,9 +2019,9 @@ $(OUTDIR)\dynfonts\nstdfp32.dll: $(DEPTH)\cmd\winfe\nstdfp32.dll @IF NOT EXIST "$(OUTDIR)\dynfonts/$(NULL)" mkdir "$(OUTDIR)\dynfonts" @IF EXIST $(DEPTH)\cmd\winfe\nstdfp32.dll copy $(DEPTH)\cmd\winfe\nstdfp32.dll $(OUTDIR)\dynfonts\nstdfp32.dll -!if !defined(MOZ_NO_LDAP) -$(OUTDIR)\nsldap32.dll: $(DIST)\bin\nsldap32.dll - @IF EXIST $(DIST)\bin\nsldap32.dll copy $(DIST)\bin\nsldap32.dll $(OUTDIR)\nsldap32.dll +!if defined(MOZ_LDAP) +$(OUTDIR)\nsldap32v30.dll: $(DIST)\bin\nsldap32v30.dll + @IF EXIST $(DIST)\bin\nsldap32v30.dll copy $(DIST)\bin\nsldap32v30.dll $(OUTDIR)\nsldap32v30.dll !endif $(JAVABIN_DIR)\awt32$(VERSION_NUMBER).dll: $(DIST)\bin\awt32$(VERSION_NUMBER).dll @@ -2139,7 +2094,7 @@ $(OUTDIR)\dynfonts\nstdfp16.dll: $(DEPTH)\cmd\winfe\nstdfp16.dll @IF NOT EXIST "$(OUTDIR)\dynfonts/$(NULL)" mkdir "$(OUTDIR)\dynfonts" @IF EXIST $(DEPTH)\cmd\winfe\nstdfp16.dll copy $(DEPTH)\cmd\winfe\nstdfp16.dll $(OUTDIR)\dynfonts\nstdfp16.dll -!if !defined(MOZ_NO_LDAP) +!if defined(MOZ_LDAP) $(OUTDIR)\nsldap.dll: $(DIST)\bin\nsldap.dll @IF EXIST $(DIST)\bin\nsldap.dll copy $(DIST)\bin\nsldap.dll $(OUTDIR)\nsldap.dll !endif @@ -2179,6 +2134,16 @@ $(OUTDIR)\nsinit.exe: $(DIST)\bin\nsinit.exe !ENDIF +!if defined(MOZ_CALENDAR) +$(OUTDIR)\cal3240.dll: $(DIST)\bin\cal3240.dll + @IF EXIST $(DIST)\bin\cal3240.dll copy $(DIST)\bin\cal3240.dll $(OUTDIR)\cal3240.dll +$(OUTDIR)\nsfmt3230.dll: $(DIST)\bin\nsfmt3230.dll + @IF EXIST $(DIST)\bin\nsfmt3230.dll copy $(DIST)\bin\nsfmt3230.dll $(OUTDIR)\nsfmt3230.dll +$(OUTDIR)\nsuni3230.dll: $(DIST)\bin\nsuni3230.dll + @IF EXIST $(DIST)\bin\nsuni3230.dll copy $(DIST)\bin\nsuni3230.dll $(OUTDIR)\nsuni3230.dll +$(OUTDIR)\nscnv3230.dll: $(DIST)\bin\nscnv3230.dll + @IF EXIST $(DIST)\bin\nscnv3230.dll copy $(DIST)\bin\nscnv3230.dll $(OUTDIR)\nscnv3230.dll +!endif # XXX this will copy them all, we really only want the ones that changed $(JAVACLS_DIR)\$(JAR_NAME): $(JAVA_DESTPATH)\$(JAR_NAME) @@ -2260,57 +2225,57 @@ $(OUTDIR)\res: $(NGLAYOUT_DIST)\bin\res @IF EXIST $(NGLAYOUT_DIST)\bin\$(@F) copy $(NGLAYOUT_DIST)\bin\$(@F) $@ !endif -$(OUTDIR)\spellchk\$(SPELLCHK_DLL): $(DIST)\bin\$(SPELLCHK_DLL) +$(OUTDIR)\spellchk\$(SPELLCHK_DLL): $(DIST)\bin\$(SPELLCHK_DLL) @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(DIST)\bin\$(SPELLCHK_DLL) copy $(DIST)\bin\$(SPELLCHK_DLL) $(OUTDIR)\spellchk\$(SPELLCHK_DLL) -# spell checker English dictionary -$(OUTDIR)\spellchk\pen4s324.dat: $(SPELLCHK_DATA)\pen4s324.dat +# spell checker English dictionary +$(OUTDIR)\spellchk\pen4s324.dat: $(SPELLCHK_DATA)\pen4s324.dat @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(SPELLCHK_DATA)\pen4s324.dat copy $(SPELLCHK_DATA)\pen4s324.dat $(OUTDIR)\spellchk\pen4s324.dat #spell checker built-in dictionary extension -$(OUTDIR)\spellchk\netscape.dic: $(SPELLCHK_DATA)\netscape.dic +$(OUTDIR)\spellchk\netscape.dic: $(SPELLCHK_DATA)\netscape.dic @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(SPELLCHK_DATA)\netscape.dic copy $(SPELLCHK_DATA)\netscape.dic $(OUTDIR)\spellchk\netscape.dic -# spell checker Spanish dictionary -$(OUTDIR)\spellchk\psp4s333.dat: $(SPELLCHK_DATA)\psp4s333.dat +# spell checker Spanish dictionary +$(OUTDIR)\spellchk\psp4s333.dat: $(SPELLCHK_DATA)\psp4s333.dat @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(SPELLCHK_DATA)\psp4s333.dat copy $(SPELLCHK_DATA)\psp4s333.dat $(OUTDIR)\spellchk\psp4s333.dat -# spell checker German dictionary -$(OUTDIR)\spellchk\pgr2s321.dat: $(SPELLCHK_DATA)\pgr2s321.dat +# spell checker German dictionary +$(OUTDIR)\spellchk\pgr2s321.dat: $(SPELLCHK_DATA)\pgr2s321.dat @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(SPELLCHK_DATA)\pgr2s321.dat copy $(SPELLCHK_DATA)\pgr2s321.dat $(OUTDIR)\spellchk\pgr2s321.dat -# spell checker French dictionary -$(OUTDIR)\spellchk\pfr2s331.dat: $(SPELLCHK_DATA)\pfr2s331.dat +# spell checker French dictionary +$(OUTDIR)\spellchk\pfr2s331.dat: $(SPELLCHK_DATA)\pfr2s331.dat @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(SPELLCHK_DATA)\pfr2s331.dat copy $(SPELLCHK_DATA)\pfr2s331.dat $(OUTDIR)\spellchk\pfr2s331.dat -# spell checker Italian dictionary -$(OUTDIR)\spellchk\pit2s340.dat: $(SPELLCHK_DATA)\pit2s340.dat +# spell checker Italian dictionary +$(OUTDIR)\spellchk\pit2s340.dat: $(SPELLCHK_DATA)\pit2s340.dat @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(SPELLCHK_DATA)\pit2s340.dat copy $(SPELLCHK_DATA)\pit2s340.dat $(OUTDIR)\spellchk\pit2s340.dat -# spell checker Brazilian dictionary -$(OUTDIR)\spellchk\ppo4s331.dat: $(SPELLCHK_DATA)\ppo4s331.dat +# spell checker Brazilian dictionary +$(OUTDIR)\spellchk\ppo4s331.dat: $(SPELLCHK_DATA)\ppo4s331.dat @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(SPELLCHK_DATA)\ppo4s331.dat copy $(SPELLCHK_DATA)\ppo4s331.dat $(OUTDIR)\spellchk\ppo4s331.dat -# spell checker Catalan dictionary -$(OUTDIR)\spellchk\pca4s323.dat: $(SPELLCHK_DATA)\pca4s323.dat +# spell checker Catalan dictionary +$(OUTDIR)\spellchk\pca4s323.dat: $(SPELLCHK_DATA)\pca4s323.dat @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(SPELLCHK_DATA)\pca4s323.dat copy $(SPELLCHK_DATA)\pca4s323.dat $(OUTDIR)\spellchk\pca4s323.dat -# spell checker Dutch dictionary -$(OUTDIR)\spellchk\pdu2s341.dat: $(SPELLCHK_DATA)\pdu2s341.dat +# spell checker Dutch dictionary +$(OUTDIR)\spellchk\pdu2s341.dat: $(SPELLCHK_DATA)\pdu2s341.dat @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(SPELLCHK_DATA)\pdu2s341.dat copy $(SPELLCHK_DATA)\pdu2s341.dat $(OUTDIR)\spellchk\pdu2s341.dat -# spell checker Finnish dictionary -$(OUTDIR)\spellchk\pfn2s311.dat: $(SPELLCHK_DATA)\pfn2s311.dat +# spell checker Finnish dictionary +$(OUTDIR)\spellchk\pfn2s311.dat: $(SPELLCHK_DATA)\pfn2s311.dat @IF NOT EXIST "$(OUTDIR)\spellchk/$(NULL)" mkdir "$(OUTDIR)\spellchk" @IF EXIST $(SPELLCHK_DATA)\pfn2s311.dat copy $(SPELLCHK_DATA)\pfn2s311.dat $(OUTDIR)\spellchk\pfn2s311.dat @@ -2318,33 +2283,31 @@ $(OUTDIR)\spellchk\pfn2s311.dat: $(SPELLCHK_DATA)\pfn2s311.dat BATCH_BUILD_1: \ BATCH_LIBI18N_C \ BATCH_LIBLAYER_C \ - BATCH_LIBMSG_CPP \ BATCH_PLUGIN_CPP \ + BATCH_LIBMSG_CPP \ BATCH_LIBDBM_C \ BATCH_LAYOUT_CPP \ BATCH_WINFE_CPP \ BATCH_LIBJAR_C \ - BATCH_XLATE_C + BATCH_XLATE_C echo Done > $(TMP)\bb1.sem echo BATCH BUILD 1 Successful and complete BATCH_BUILD_2: \ - BATCH_LIBADDR_C \ BATCH_LIBMIME_C \ BATCH_LIBPARSE_C \ BATCH_LIBMSG_C \ + BATCH_LIBPARSE_C \ BATCH_LIBMISC_C \ BATCH_LIBSTYLE_C \ BATCH_XP_C \ BATCH_PICS_C \ BATCH_WINFE_C \ BATCH_PLUGIN_C \ - BATCH_LIBADDR_CPP \ BATCH_LAYOUT_C \ BATCH_JPEG_C \ - BATCH_LIBNEO_CPP \ - BATCH_LIBMOCHA_C + BATCH_LIBMOCHA_C echo Done >$(TMP)\bb2.sem echo BATCH BUILD 2 Successful and complete @@ -2494,6 +2457,12 @@ BUILD_SOURCE: $(OBJ_FILES) $(DIST)\lib\cnetinit.lib + !ifdef MOZ_MAIL_NEWS $(DIST)\lib\mnrc16.lib + +!endif +!ifdef MOZ_CALENDAR + $(DIST)\lib\cal3240.lib + + $(DIST)\lib\nsfmt3230.lib + + $(DIST)\lib\nsuni3230.lib + + $(DIST)\lib\nscnv3230.lib + !endif $(DIST)\lib\zip$(MOZ_BITS)$(VERSION_NUMBER).lib + $(DIST)\lib\jpeg$(MOZ_BITS)$(VERSION_NUMBER).lib + @@ -2517,14 +2486,14 @@ PATCHER = $(PATCHER:16=32) $(OUTDIR)\netsc_us.exe : "$(OUTDIR)" $(PATCHER) $(XPDIST)\xpdist\domestic.txt $(OUTDIR)\mozilla.exe $(PATCHER) @<< $(XPDIST)\xpdist\domestic.txt - $(OUTDIR)\mozilla.exe + $(OUTDIR)\mozilla.exe $(OUTDIR)\netsc_us.exe << $(OUTDIR)\netsc_fr.exe : "$(OUTDIR)" $(PATCHER) $(XPDIST)\xpdist\france.txt $(OUTDIR)\mozilla.exe $(PATCHER) @<< $(XPDIST)\xpdist\france.txt - $(OUTDIR)\mozilla.exe + $(OUTDIR)\mozilla.exe $(OUTDIR)\netsc_fr.exe << @@ -2668,7 +2637,7 @@ $(OUTDIR)\mozilla.res : $(RES_FILES) "$(OUTDIR)" @SET SAVEINCLUDE=%%INCLUDE%% @SET INCLUDE=$(RCINCLUDES);$(RCDISTINCLUDES);%%SAVEINCLUDE%% $(RSC) /Fo$(PROD)$(VERSTR).res $(RCFILEFLAGS) $(RCFLAGS) $(DEPTH)\cmd\winfe\mozilla.rc - @IF EXIST $(PROD)$(VERSTR).res copy $(PROD)$(VERSTR).res $(OUTDIR)\mozilla.res + @IF EXIST $(PROD)$(VERSTR).res copy $(PROD)$(VERSTR).res $(OUTDIR)\mozilla.res @IF EXIST $(PROD)$(VERSTR).res del $(PROD)$(VERSTR).res @SET INCLUDE=%%SAVEINCLUDE%% @SET SAVEINCLUDE= @@ -2677,7 +2646,7 @@ $(OUTDIR)\appicon.res : $(DEPTH)\cmd\winfe\res\silver.ico "$(OUTDIR)" @SET SAVEINCLUDE=%%INCLUDE%% @SET INCLUDE=$(DEPTH)\cmd\winfe\res;%%SAVEINCLUDE%% $(RSC) /Fo$(PROD)$(VERSTR).res $(RCFILEFLAGS) $(RCFLAGS) $(DEPTH)\cmd\winfe\res\appicon.rc - @IF EXIST $(PROD)$(VERSTR).res copy $(PROD)$(VERSTR).res $(OUTDIR)\appicon.res + @IF EXIST $(PROD)$(VERSTR).res copy $(PROD)$(VERSTR).res $(OUTDIR)\appicon.res @IF EXIST $(PROD)$(VERSTR).res del $(PROD)$(VERSTR).res @SET INCLUDE=%%SAVEINCLUDE%% @SET SAVEINCLUDE= @@ -2791,7 +2760,6 @@ exports: !ifdef MOZ_MAIL_NEWS -xcopy $(DEPTH)\lib\libaddr\*.h $(EXPORTINC) $(XCF) -xcopy $(DEPTH)\lib\libmsg\*.h $(EXPORTINC) $(XCF) - -xcopy $(DEPTH)\lib\libneo\*.h $(EXPORTINC) $(XCF) !endif !ifdef MOZ_LDAP -xcopy $(DEPTH)\netsite\ldap\include\*.h $(EXPORTINC) $(XCF) @@ -2847,6 +2815,9 @@ exports: -xcopy $(DEPTH)\dist\public\spellchk\*.h $(EXPORTINC) $(XCF) -xcopy $(DEPTH)\jpeg\*.h $(EXPORTINC) $(XCF) -xcopy $(DEPTH)\lib\libcnv\*.h $(EXPORTINC) $(XCF) +!if defined(MOZ_CALENDAR) + -xcopy $(DIST)\public\calendar\*.h $(EXPORTINC) $(XCF) +!endif pure: $(MOZ_PURIFY)\purify /Run=no /ErrorCallStackLength=20 /AllocCallStackLength=20 \ @@ -2862,7 +2833,7 @@ symbols: @echo "MOZ_SRC = $(MOZ_SRC)" @echo "PATCHER = $(PATCHER)" !if "$(MOZ_USERNAME)" == "WHITEBOX" - @echo "MOZ_USERNAME = $(MOZ_USERNAME)" + @echo "MOZ_USERNAME = $(MOZ_USERNAME)" @echo "MOZ_USERDEBUG = $(MOZ_USERDEBUG)" !endif @@ -2898,12 +2869,16 @@ ns.zip: resdll.dll \ prefui32.dll \ pr3240.dll \ - nsldap32.dll \ + nsldap32v30.dll \ nsdlg32.dll \ mnpref32.dll \ mnrc32.dll \ xpstrdll.dll \ js3240.dll \ + cal3240.dll \ + nsfmt3230.dll \ + nsuni3230.dll \ + nscnv3230.dll \ jpeg3240.dll \ edpref32.dll \ editor32.dll \ @@ -2911,4 +2886,4 @@ ns.zip: sched32.dll \ xpcom32.dll \ netscape.cfg \ - moz40p3 + moz40p3 diff --git a/mozilla/cmd/winfe/mnprefs.cpp b/mozilla/cmd/winfe/mnprefs.cpp index 6af0c5e6b35..1dfa3248dc2 100644 --- a/mozilla/cmd/winfe/mnprefs.cpp +++ b/mozilla/cmd/winfe/mnprefs.cpp @@ -17,6 +17,8 @@ */ #include "stdafx.h" + +#include "rosetta.h" #include "prefapi.h" #include "dialog.h" #include "msgcom.h" @@ -38,6 +40,9 @@ extern "C" { #include "xpgetstr.h" #ifdef MOZ_MAIL_NEWS extern int MK_MSG_LOCAL_MAIL; +extern int MK_MSG_SENT_L10N_NAME; //Sent folder +extern int MK_MSG_DRAFTS_L10N_NAME; +extern int MK_MSG_TEMPLATES_L10N_NAME; #endif }; @@ -208,7 +213,7 @@ static BOOL UpdateMapiDll(BOOL prefUseMAPI, CWnd* pWnd) return(TRUE); } -static BOOL UpdateMapiDll(void) +extern "C" BOOL UpdateMapiDll(void) { XP_Bool prefUseMAPI = FALSE; PREF_GetBoolPref("mail.use_mapi_server", &prefUseMAPI); @@ -235,12 +240,12 @@ extern "C" MSG_Host *DoAddNewsServer(CWnd* pParent, int nFromWhere) if (IDOK == addServerDialog.DoModal()) { char* pName = addServerDialog.GetNewsHostName(); - XP_Bool bSecure = addServerDialog.GetSecure(); + XP_Bool bxxx = HG28751 XP_Bool bAuthentication = addServerDialog.GetAuthentication(); int32 nPort = addServerDialog.GetNewsHostPort(); MSG_NewsHost *pNewHost = MSG_CreateNewsHost(WFE_MSGGetMaster(), pName, - bSecure, nPort); + bxxx, nPort); if (pNewHost) { @@ -259,14 +264,10 @@ extern "C" MSG_Host *DoAddNewsServer(CWnd* pParent, int nFromWhere) extern "C" MSG_Host *DoAddIMAPServer(CWnd* pParent, char* pServerName, BOOL bImap) { CString title; - title.LoadString(IDS_ADD_MAIL_SERVER); + title.LoadString(IDS_MAIL_SERVER_PROPERTY); CMailServerPropertySheet addMailServer(pParent, title, pServerName, TYPE_IMAP, FALSE); - if (IDOK == addMailServer.DoModal()) - { - return NULL; - } - else - return NULL; + addMailServer.DoModal(); + return NULL; } void UnixToDosString(char* pStr) @@ -328,15 +329,15 @@ MSG_FolderInfo * GetFolderInfoFromPref(char* lpPref) pURL = ConvertPathToURL(lpPref); if (pURL) { - pFolderInfo = MSG_GetFolderInfoFromURL(pMaster, pURL); + pFolderInfo = MSG_GetFolderInfoFromURL(pMaster, pURL, FALSE); XP_FREE(pURL); } } else - pFolderInfo = MSG_GetFolderInfoFromURL(pMaster, lpPref); + pFolderInfo = MSG_GetFolderInfoFromURL(pMaster, lpPref, FALSE); } else if (IMAP_TYPE_URL == nUrlType) - pFolderInfo = MSG_GetFolderInfoFromURL(pMaster, lpPref); + pFolderInfo = MSG_GetFolderInfoFromURL(pMaster, lpPref, FALSE); } return pFolderInfo; } @@ -380,10 +381,28 @@ BOOL SetServerComboCurSel(HWND hControl, char* lpName, int nDefaultID) if (nLen) { pFolder = GetFolderInfoFromPref(lpName); - MSG_GetFolderLineById (pMaster, pFolder, &folderLine); - if (!XP_FILENAMECMP(pDefaultName, folderLine.name)) + if (pFolder) { - bUseDefaultName = TRUE; + MSG_GetFolderLineById (pMaster, pFolder, &folderLine); + // We are checking against local mail directory or imap server + // versus any other folder by checking folderline level + // we should check the folder flag instead of folderline level + if (folderLine.level == 1 || (!XP_FILENAMECMP(pDefaultName, folderLine.name))) + { + bUseDefaultName = TRUE; + } + } + else + { //Get folder path from URL + char* pFolderPath = NET_ParseURL(lpName, GET_PATH_PART); + if (pFolderPath) + { + if (XP_STRSTR(&pFolderPath[1], pDefaultName)) + { + bUseDefaultName = TRUE; + } + XP_FREE(pFolderPath); + } } if (0 == nUrlType || MAILBOX_TYPE_URL == nUrlType) bLocalMail = TRUE; @@ -398,7 +417,10 @@ BOOL SetServerComboCurSel(HWND hControl, char* lpName, int nDefaultID) if (bLocalMail) pLocal = XP_GetString(MK_MSG_LOCAL_MAIL); + MSG_FolderInfo* pHostFolderInfo = GetHostFolderInfo(pFolder); + char* pHost = NET_ParseURL(lpName, GET_HOST_PART); + int nCount = (int)SendMessage(hControl, CB_GETCOUNT, 0, 0); for (int i = 0; i < nCount; i++ ) { @@ -412,8 +434,6 @@ BOOL SetServerComboCurSel(HWND hControl, char* lpName, int nDefaultID) nFolderIndex = i; break; } - nFolderIndex = (int)SendMessage(hControl, CB_FINDSTRING, (WPARAM)-1, - (LPARAM)(LPCSTR)pLocal); } else { @@ -422,10 +442,22 @@ BOOL SetServerComboCurSel(HWND hControl, char* lpName, int nDefaultID) nFolderIndex = i; break; } + else if (!pHostFolderInfo && pHost) + { //Get Host name from URL + MSG_GetFolderLineById (pMaster, pFolderInfo, &folderLine); + if (!XP_FILENAMECMP(pHost, folderLine.name)) + { + nFolderIndex = i; + break; + } + } } } SendMessage(hControl, CB_SETCURSEL, nFolderIndex, 0); + if (pHost) + XP_FREE(pHost); + if (bUseDefaultName) return TRUE; else @@ -439,16 +471,13 @@ extern "C" void GetFolderServerNames int nLen = strlen(lpName); if (nLen) - { pFolderInfo = GetFolderInfoFromPref(lpName); - } else { - char* pDefault = XP_GetString(nDefaultID); - char defaultName[256]; int nLen = 255; + char* pDefault = XP_GetString(nDefaultID); if (PREF_NOERROR == PREF_GetCharPref("mail.directory", defaultName, &nLen)) { defaultName[nLen] = '\0'; @@ -463,16 +492,48 @@ extern "C" void GetFolderServerNames MSG_Master* pMaster = WFE_MSGGetMaster(); MSG_FolderLine folderLine; if (MSG_GetFolderLineById(pMaster, pFolderInfo, &folderLine)) - folder = folderLine.name; - - MSG_FolderInfo* pHostFolderInfo = GetHostFolderInfo(pFolderInfo); - if (pHostFolderInfo) { - if (MSG_GetFolderLineById(pMaster, pHostFolderInfo, &folderLine)) + // We are checking against local mail directory or imap server + // versus any other folder by checking folderline level + // we should check the folder flag instead of folderline level + if (folderLine.level == 1) + { + folder = XP_GetString(nDefaultID); server = folderLine.name; + } + else + { + folder = folderLine.name; + + MSG_FolderInfo* pHostFolderInfo = GetHostFolderInfo(pFolderInfo); + if (pHostFolderInfo) + { + if (MSG_GetFolderLineById(pMaster, pHostFolderInfo, &folderLine)) + server = folderLine.name; + } + else + server = XP_GetString(MK_MSG_LOCAL_MAIL); + } } else + { + folder = XP_GetString(nDefaultID); server = XP_GetString(MK_MSG_LOCAL_MAIL); + } + } + else + { //Get Host name from URL + char* pHost = NET_ParseURL(lpName, GET_HOST_PART); + if (pHost && strlen(pHost)) + { + server = pHost; + XP_FREE(pHost); + } + else + { + server = XP_GetString(MK_MSG_LOCAL_MAIL); + } + folder = XP_GetString(nDefaultID); } } @@ -483,13 +544,27 @@ CChooseFolderDialog::CChooseFolderDialog(CWnd *pParent, char* pFolderPath, int n : CDialog(IDD, pParent) { m_pFolderPath = pFolderPath; - m_nDefaultID = nTypeID; + m_nTypeID = nTypeID; + + if (nTypeID == TYPE_SENTMAIL || nTypeID == TYPE_SENTNEWS) + m_nDefaultID = MK_MSG_SENT_L10N_NAME; + else if (nTypeID == TYPE_DRAFT) + m_nDefaultID = MK_MSG_DRAFTS_L10N_NAME; + else if (nTypeID == TYPE_TEMPLATE) + m_nDefaultID = MK_MSG_TEMPLATES_L10N_NAME; } BOOL CChooseFolderDialog::OnInitDialog() { BOOL ret = CDialog::OnInitDialog(); + if (m_nTypeID == TYPE_SENTNEWS) + SetDlgItemText(IDC_STATIC_TITLE, szLoadString(IDS_COPY_NEWS_MSG)); + else if (m_nTypeID == TYPE_DRAFT) + SetDlgItemText(IDC_STATIC_TITLE, szLoadString(IDS_COPY_DRAFTS)); + else if (m_nTypeID == TYPE_TEMPLATE) + SetDlgItemText(IDC_STATIC_TITLE, szLoadString(IDS_COPY_TEMPLATES)); + CString formatString, defaultTitle; formatString.LoadString(IDS_SPECIAL_FOLDER); defaultTitle.Format(LPCTSTR(formatString), XP_GetString(m_nDefaultID)); @@ -529,7 +604,19 @@ void CChooseFolderDialog::OnOK() if (MSG_GetFolderLineById(pMaster, pFolder, &folderLine)) m_szServer = folderLine.name; URL_Struct *url = MSG_ConstructUrlForFolder(NULL, pFolder); - m_szPrefUrl = url->address; + if (MK_MSG_SENT_L10N_NAME == m_nDefaultID && + MAILBOX_TYPE_URL == NET_URL_Type(url->address)) + { //local mail + int nPos = strlen("mailbox:/"); + m_szPrefUrl = &url->address[nPos]; + LPTSTR pBuffer = m_szPrefUrl.GetBuffer(m_szPrefUrl.GetLength()); + UnixToDosString(pBuffer); + m_szPrefUrl.ReleaseBuffer(); + } + else + { //imap + m_szPrefUrl = url->address; + } } else if (IsDlgButtonChecked(IDC_RADIO_OTHER)) { @@ -540,15 +627,27 @@ void CChooseFolderDialog::OnOK() m_szFolder = folderLine.name; MSG_FolderInfo* pHostFolderInfo = GetHostFolderInfo(pFolder); if (pHostFolderInfo) - { + { //imap if (MSG_GetFolderLineById(pMaster, pHostFolderInfo, &folderLine)) m_szServer = folderLine.name; + URL_Struct *url = MSG_ConstructUrlForFolder(NULL, pFolder); + m_szPrefUrl = url->address; } else + { //local mail m_szServer = XP_GetString(MK_MSG_LOCAL_MAIL); - - URL_Struct *url = MSG_ConstructUrlForFolder(NULL, pFolder); - m_szPrefUrl = url->address; + URL_Struct *url = MSG_ConstructUrlForFolder(NULL, pFolder); + if (MK_MSG_SENT_L10N_NAME == m_nDefaultID) + { + int nPos = strlen("mailbox:/"); + m_szPrefUrl = &url->address[nPos]; + LPTSTR pBuffer = m_szPrefUrl.GetBuffer(m_szPrefUrl.GetLength()); + UnixToDosString(pBuffer); + m_szPrefUrl.ReleaseBuffer(); + } + else + m_szPrefUrl = url->address; + } } } @@ -577,11 +676,32 @@ void CChooseFolderDialog::OnNewFolder() break; } } + OnSelectFolder(); //check the radio button + } +} + +void CChooseFolderDialog::OnSelectServer() +{ + if (!IsDlgButtonChecked(IDC_RADIO_SENT)) + { + CheckDlgButton(IDC_RADIO_SENT, TRUE); + CheckDlgButton(IDC_RADIO_OTHER, FALSE); + } +} + +void CChooseFolderDialog::OnSelectFolder() +{ + if (!IsDlgButtonChecked(IDC_RADIO_OTHER)) + { + CheckDlgButton(IDC_RADIO_OTHER, TRUE); + CheckDlgButton(IDC_RADIO_SENT, FALSE); } } BEGIN_MESSAGE_MAP(CChooseFolderDialog, CDialog) ON_BN_CLICKED(IDC_NEW_FOLDER, OnNewFolder) + ON_CBN_SELCHANGE(IDC_COMBO_SERVERS, OnSelectServer) + ON_CBN_SELCHANGE(IDC_COMBO_FOLDERS, OnSelectFolder) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -600,7 +720,7 @@ CNewsServerDialog::CNewsServerDialog(CWnd *pParent, const char* pName, int nFrom m_pEditHost = pHost; if (pHost) { - m_bIsSecure = MSG_IsNewsHostSecure(pHost); + HG28972 m_lPort = MSG_GetNewsHostPort(pHost); m_bAuthentication = MSG_GetNewsHostPushAuth(pHost); } @@ -614,10 +734,10 @@ BOOL CNewsServerDialog::OnInitDialog() sprintf(port, "%ld", m_lPort); SetDlgItemText(IDC_EDIT_PORT, port); + title.LoadString(IDS_NEWS_SERVER_PROPERTY); + SetWindowText(LPCTSTR(title)); if (m_pEditHost) { - title.LoadString(IDS_NEWS_SERVER_PROPERTY); - SetWindowText(LPCTSTR(title)); SetDlgItemText(IDC_STATIC_HOST, MSG_GetNewsHostName(m_pEditHost)); GetDlgItem(IDC_EDIT_HOST)->ShowWindow(SW_HIDE); @@ -629,8 +749,6 @@ BOOL CNewsServerDialog::OnInitDialog() } else { - title.LoadString(IDS_ADD_NEWS_SERVER); - SetWindowText(LPCTSTR(title)); GetDlgItem(IDC_STATIC_HOST)->ShowWindow(SW_HIDE); #ifdef _WIN32 ((CEdit*)GetDlgItem(IDC_EDIT_HOST))->SetLimitText(MAX_HOSTNAME_LEN - 1); @@ -686,9 +804,7 @@ void CNewsServerDialog::OnOK() } else { - if (m_bIsSecure) - m_lPort = SECURE_NEWS_PORT; - else + HG29172 m_lPort = NEWS_PORT; } if (IsDlgButtonChecked(IDC_USE_NAME)) // Authentication @@ -750,16 +866,22 @@ BOOL CNewsServerDialog::NewsHostExists() BOOL CNewsServerDialog::IsSameServer(MSG_Host *pHost) { - XP_Bool bIsSecure = IsDlgButtonChecked(IDC_SECURE); + const char* pHostName = NULL; + + HG98271 int32 lEditPort = GetPortNumber(); - const char* pHostName = MSG_GetNewsHostName((MSG_NewsHost*)pHost); - if (0 == lstrcmp(m_hostName, pHostName)) + MSG_NewsHost* pNewsHost = MSG_GetNewsHostFromMSGHost(pHost); + if (pNewsHost) { - XP_Bool bSecure = MSG_IsNewsHostSecure((MSG_NewsHost*)pHost); - int32 lPort = MSG_GetNewsHostPort((MSG_NewsHost*)pHost); - if (bIsSecure == bSecure && lEditPort == lPort) - return TRUE; - } + pHostName = MSG_GetNewsHostName(pNewsHost); + if (0 == lstrcmp(m_hostName, pHostName)) + { + HG27851 + int32 lPort = MSG_GetNewsHostPort(pNewsHost); + if (HG98261 lEditPort == lPort) + return TRUE; + } + } return FALSE; } @@ -775,26 +897,9 @@ int32 CNewsServerDialog::GetPortNumber() void CNewsServerDialog::OnCheckSecure() { - char port[16]; - if (IsDlgButtonChecked(IDC_SECURE)) - m_bIsSecure = TRUE; - else - m_bIsSecure = FALSE; - if (GetDlgItemText(IDC_EDIT_PORT, port, 16) == 0) - { - if (m_bIsSecure) - SetDlgItemInt(IDC_EDIT_PORT, SECURE_NEWS_PORT); - else - SetDlgItemInt(IDC_EDIT_PORT, NEWS_PORT); - } - else - { - int32 lPort = GetPortNumber(); - if (m_bIsSecure && lPort == NEWS_PORT) - SetDlgItemInt(IDC_EDIT_PORT, SECURE_NEWS_PORT); - else if (!m_bIsSecure && lPort == SECURE_NEWS_PORT) - SetDlgItemInt(IDC_EDIT_PORT, NEWS_PORT); - } + SetDlgItemInt(IDC_EDIT_PORT, NEWS_PORT); + HG28768 + } void CNewsServerDialog::OnHelp() @@ -811,22 +916,6 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // IMAP pref stuff -typedef enum -{ - CHAR_USERNAME, - BOOL_REMEMBER_PASSWORD, - BOOL_CHECK_NEW_MAIL, - INT_CHECK_TIME, - BOOL_OFFLINE_DOWNLOAD, - BOOL_MOVE_TO_TRASH, - BOOL_IS_SECURE, - CHAR_PERAONAL_DIR, - CHAR_PUBLIC_DIR, - CHAR_OTHER_USER_DIR, - BOOL_OVERRIDE_NAMESPACES - -}IMAP_PREF; - static const char *kPrefTemplate = "mail.imap.server.%s.%s"; @@ -861,8 +950,8 @@ char* IMAP_GetPrefString(const char *pHostName, int nID) PR_snprintf(pPrefName, prefSize, kPrefTemplate, pHostName, "offline_download"); break; - case BOOL_MOVE_TO_TRASH: - PR_snprintf(pPrefName, prefSize, kPrefTemplate, pHostName, "delete_is_move_to_trash"); + case INT_DELETE_MODEL: + PR_snprintf(pPrefName, prefSize, kPrefTemplate, pHostName, "delete_model"); break; case BOOL_IS_SECURE: @@ -885,6 +974,14 @@ char* IMAP_GetPrefString(const char *pHostName, int nID) PR_snprintf(pPrefName, prefSize, kPrefTemplate, pHostName, "override_namespaces"); break; + case BOOL_EMPTY_TRASH_ON_EXIT: + PR_snprintf(pPrefName, prefSize, kPrefTemplate, pHostName, "empty_trash_on_exit"); + break; + + case BOOL_CLEANUP_INBOX_ON_EXIT: + PR_snprintf(pPrefName, prefSize, kPrefTemplate, pHostName, "cleanup_inbox_on_exit"); + break; + default: ASSERT(0); break; @@ -990,9 +1087,9 @@ CMailServerPropertySheet::CMailServerPropertySheet if (pName && strlen(pName)) XP_STRCAT(m_hostName, pName); if (nType == TYPE_IMAP) - m_bPop = FALSE; + m_bWasPop = m_bPop = FALSE; else - m_bPop = TRUE; + m_bWasPop = m_bPop = TRUE; m_bEdit = bEdit; m_bBothType = bBothType; @@ -1034,14 +1131,15 @@ CMailServerPropertySheet::~CMailServerPropertySheet() void CMailServerPropertySheet::SetMailHostName(char* pName) { if (pName && strlen(pName)) + { + m_hostName[0] = '\0'; XP_STRCAT(m_hostName, pName); + } } XP_Bool CMailServerPropertySheet::GetIMAPUseSSL() { - if (m_pIMAPPage && IsWindow(m_pIMAPPage->GetSafeHwnd())) - return m_pIMAPPage->GetUseSSL(); - else + HG21675 return FALSE; } @@ -1203,6 +1301,14 @@ void CMailServerPropertySheet::OnOK() void CMailServerPropertySheet::OnHelp() { + if (GetActivePage() == m_pGeneralPage) + NetHelp(HELP_MAILSERVER_PROPERTY_GENERAL); + else if (GetActivePage() == m_pPopPage) + NetHelp(HELP_MAILSERVER_PROPERTY_POP); + else if (GetActivePage() == m_pIMAPPage) + NetHelp(HELP_MAILSERVER_PROPERTY_IMAP); + else if (GetActivePage() == m_pAdvancedPage) + NetHelp(HELP_MAILSERVER_PROPERTY_ADVANCED); } BEGIN_MESSAGE_MAP(CMailServerPropertySheet, CPropertySheet) @@ -1210,6 +1316,7 @@ BEGIN_MESSAGE_MAP(CMailServerPropertySheet, CPropertySheet) ON_WM_CREATE() #endif ON_BN_CLICKED(IDOK, OnOK) + ON_BN_CLICKED(IDHELP, OnHelp) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -1232,7 +1339,7 @@ BOOL CGeneralServerPage::OnInitDialog() ((CEdit*)GetDlgItem(IDC_EDIT_CHECK_MAIL))->LimitText(5); #endif - if (!m_szServerName.IsEmpty()) + if (!m_pParent->IsPopServer() && !m_szServerName.IsEmpty()) { SetDlgItemText(IDC_STATIC_MAIL_SERVER, szLoadString(IDS_MAIL_SERVER)); SetDlgItemText(IDC_STATIC_SERVER, LPCTSTR(m_szServerName)); @@ -1241,6 +1348,8 @@ BOOL CGeneralServerPage::OnInitDialog() else { GetDlgItem(IDC_STATIC_SERVER)->ShowWindow(SW_HIDE); + if (!m_szServerName.IsEmpty()) + SetDlgItemText(IDC_EDIT_SERVER, LPCTSTR(m_szServerName)); #ifdef _WIN32 ((CEdit*)GetDlgItem(IDC_EDIT_SERVER))->SetLimitText(MAX_HOSTNAME_LEN - 1); #else @@ -1354,7 +1463,7 @@ BOOL CGeneralServerPage::ProcessOK() char userName[256]; char text[MAX_DESCRIPTION_LEN]; - if (m_szServerName.IsEmpty() && + if ((m_szServerName.IsEmpty() || m_pParent->WasPopServer()) && 0 == GetDlgItemText(IDC_EDIT_SERVER, name, MAX_HOSTNAME_LEN)) { AfxMessageBox(IDS_EMPTY_STRING); @@ -1380,8 +1489,11 @@ BOOL CGeneralServerPage::ProcessOK() return FALSE; } } - if (m_szServerName.IsEmpty()) + if (m_szServerName.IsEmpty() || m_pParent->WasPopServer()) + { + m_szServerName = name; m_pParent->SetMailHostName(name); + } else strncpy(name, LPCTSTR(m_szServerName), m_szServerName.GetLength()); @@ -1402,9 +1514,9 @@ BOOL CGeneralServerPage::ProcessOK() } else { - if (!m_pParent->EditServer()) + if (!m_pParent->EditServer() || m_pParent->WasPopServer()) { - XP_Bool bIsSecure = m_pParent->GetIMAPUseSSL(); + XP_Bool bIsxxx = HG72866 XP_Bool bOverrideNamespaces = m_pParent->GetIMAPOverrideNameSpaces(); char personalDir[256]; char publicDir[256]; @@ -1415,12 +1527,12 @@ BOOL CGeneralServerPage::ProcessOK() MSG_IMAPHost* pHost = MSG_CreateIMAPHost(WFE_MSGGetMaster(), name, - bIsSecure, + bIsxxx, userName, bCheckMail, nCheckTime, bRememberPassword, - FALSE, + TRUE, bOverrideNamespaces, personalDir, publicDir, @@ -1444,6 +1556,10 @@ void CGeneralServerPage::OnChangeServerType() if ((m_pParent->IsPopServer() && nType == TYPE_POP) || (!m_pParent->IsPopServer() && nType == TYPE_IMAP)) return; + if (nType == TYPE_POP) + m_pParent->SetPopServer(TRUE); + else + m_pParent->SetPopServer(FALSE); m_pParent->ShowHidePages(nType); } @@ -1508,29 +1624,49 @@ BOOL CIMAPServerPage::OnInitDialog() BOOL ret = CPropertyPage::OnInitDialog(); XP_Bool bOfflineDownload = FALSE; - XP_Bool bMoveToTrash = FALSE; - XP_Bool bUseSSL = FALSE; + XP_Bool bxxx = FALSE; + XP_Bool bEmptyTrash = FALSE; + XP_Bool bCleanupInbox = FALSE; + int32 lDeleteModel = -1; IMAP_GetBoolPref(LPCTSTR(m_szServerName), BOOL_OFFLINE_DOWNLOAD, &bOfflineDownload); - IMAP_GetBoolPref(LPCTSTR(m_szServerName), BOOL_MOVE_TO_TRASH, &bMoveToTrash); - IMAP_GetBoolPref(LPCTSTR(m_szServerName), BOOL_IS_SECURE, &bUseSSL); + + IMAP_GetBoolPref(LPCTSTR(m_szServerName), BOOL_EMPTY_TRASH_ON_EXIT, &bEmptyTrash); + IMAP_GetBoolPref(LPCTSTR(m_szServerName), BOOL_CLEANUP_INBOX_ON_EXIT, &bCleanupInbox); + IMAP_GetIntPref(LPCTSTR(m_szServerName), INT_DELETE_MODEL, &lDeleteModel); CheckDlgButton(IDC_CHECK_IMAP_LOCAL, bOfflineDownload); - CheckDlgButton(IDC_CHECK_IMAP_TRASH, bMoveToTrash); - CheckDlgButton(IDC_CHECK_IMAP_SSL, bUseSSL); + + CheckDlgButton(IDC_CHECK_EMPTY_TRASH, bEmptyTrash); + CheckDlgButton(IDC_CHECK_EMPTY_INBOX, bCleanupInbox); + if (lDeleteModel == 0) + CheckDlgButton(IDC_RADIO_IMAP_DELETE, TRUE); + else if (lDeleteModel == 1) + CheckDlgButton(IDC_RADIO_MOVE_TO_TRASH, TRUE); + else if (lDeleteModel == 2) + CheckDlgButton(IDC_RADIO_REAL_DELETE, TRUE); + else + CheckDlgButton(IDC_RADIO_MOVE_TO_TRASH, TRUE); if (IMAP_PrefIsLocked(LPCTSTR(m_szServerName), BOOL_OFFLINE_DOWNLOAD)) GetDlgItem(IDC_CHECK_IMAP_LOCAL)->EnableWindow(FALSE); - if (IMAP_PrefIsLocked(LPCTSTR(m_szServerName), BOOL_MOVE_TO_TRASH)) - GetDlgItem(IDC_CHECK_IMAP_TRASH)->EnableWindow(FALSE); if (IMAP_PrefIsLocked(LPCTSTR(m_szServerName), BOOL_IS_SECURE)) GetDlgItem(IDC_CHECK_IMAP_SSL)->EnableWindow(FALSE); - + if (IMAP_PrefIsLocked(LPCTSTR(m_szServerName), BOOL_EMPTY_TRASH_ON_EXIT)) + GetDlgItem(IDC_CHECK_EMPTY_TRASH)->EnableWindow(FALSE); + if (IMAP_PrefIsLocked(LPCTSTR(m_szServerName), BOOL_CLEANUP_INBOX_ON_EXIT)) + GetDlgItem(IDC_CHECK_EMPTY_INBOX)->EnableWindow(FALSE); + if (IMAP_PrefIsLocked(LPCTSTR(m_szServerName), INT_DELETE_MODEL)) + { + GetDlgItem(IDC_RADIO_IMAP_DELETE)->EnableWindow(FALSE); + GetDlgItem(IDC_RADIO_MOVE_TO_TRASH)->EnableWindow(FALSE); + GetDlgItem(IDC_RADIO_REAL_DELETE)->EnableWindow(FALSE); + } return ret; } XP_Bool CIMAPServerPage::GetUseSSL() { - return (IsDlgButtonChecked(IDC_CHECK_IMAP_SSL) == 0 ? FALSE : TRUE); + return (HG73221); } void CIMAPServerPage::DoDataExchange(CDataExchange* pDX) @@ -1540,13 +1676,24 @@ void CIMAPServerPage::DoDataExchange(CDataExchange* pDX) BOOL CIMAPServerPage::ProcessOK() { + m_szServerName = m_pParent->GetMailHostName(); + XP_Bool bOfflineDownload = IsDlgButtonChecked(IDC_CHECK_IMAP_LOCAL); - XP_Bool bMoveToTrash = IsDlgButtonChecked(IDC_CHECK_IMAP_TRASH); - XP_Bool bUseSSL = IsDlgButtonChecked(IDC_CHECK_IMAP_SSL); + HG73723 + XP_Bool bEmptyTrash = IsDlgButtonChecked(IDC_CHECK_EMPTY_TRASH); + XP_Bool bCleanupInbox = IsDlgButtonChecked(IDC_CHECK_EMPTY_INBOX); + int nDeleteModel = 1; + if (IsDlgButtonChecked(IDC_RADIO_IMAP_DELETE)) + nDeleteModel = 0; + else if (IsDlgButtonChecked(IDC_RADIO_MOVE_TO_TRASH)) + nDeleteModel = 1; + else if (IsDlgButtonChecked(IDC_RADIO_REAL_DELETE)) + nDeleteModel = 2; IMAP_SetBoolPref(LPCTSTR(m_szServerName), BOOL_OFFLINE_DOWNLOAD, bOfflineDownload); - IMAP_SetBoolPref(LPCTSTR(m_szServerName), BOOL_MOVE_TO_TRASH, bMoveToTrash); - IMAP_SetBoolPref(LPCTSTR(m_szServerName), BOOL_IS_SECURE, bUseSSL); + IMAP_SetBoolPref(LPCTSTR(m_szServerName), BOOL_EMPTY_TRASH_ON_EXIT, bEmptyTrash); + IMAP_SetBoolPref(LPCTSTR(m_szServerName), BOOL_CLEANUP_INBOX_ON_EXIT, bCleanupInbox); + IMAP_SetIntPref(LPCTSTR(m_szServerName), INT_DELETE_MODEL, (int32)nDeleteModel); return TRUE; } @@ -1635,6 +1782,8 @@ void CIMAPAdvancedPage::DoDataExchange(CDataExchange* pDX) BOOL CIMAPAdvancedPage::ProcessOK() { + m_szServerName = m_pParent->GetMailHostName(); + char directory[256]; if (0 == GetDlgItemText(IDC_EDIT_IMAP_DIR, directory, 255)) IMAP_SetCharPref(LPCTSTR(m_szServerName), CHAR_PERAONAL_DIR, ""); diff --git a/mozilla/cmd/winfe/mnprefs.h b/mozilla/cmd/winfe/mnprefs.h index bc8cdc10453..df2d3fd5218 100644 --- a/mozilla/cmd/winfe/mnprefs.h +++ b/mozilla/cmd/winfe/mnprefs.h @@ -60,6 +60,7 @@ public: // Implementation protected: + int m_nTypeID; int m_nDefaultID; CMailFolderCombo m_FolderCombo; CMailFolderCombo m_ServerCombo; @@ -69,6 +70,8 @@ protected: virtual BOOL OnInitDialog(); afx_msg void OnNewFolder(); + afx_msg void OnSelectServer(); + afx_msg void OnSelectFolder(); DECLARE_MESSAGE_MAP() }; @@ -200,6 +203,8 @@ public: ~CMailServerPropertySheet(); BOOL IsPopServer() { return m_bPop; } + BOOL WasPopServer() { return m_bWasPop; } + void SetPopServer(BOOL bPop) { m_bPop = bPop; } BOOL EditServer() { return m_bEdit; } BOOL AllowBothTypes() { return m_bBothType; } char* GetMailHostName() { return m_hostName; } @@ -216,10 +221,9 @@ public: CPropertyPage* GetCurrentPage() { return (CPropertyPage*)GetActivePage(); } - virtual void OnHelp(); - protected: + BOOL m_bWasPop; BOOL m_bPop; BOOL m_bEdit; BOOL m_bBothType; @@ -237,6 +241,7 @@ protected: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); #endif afx_msg void OnOK(); + afx_msg void OnHelp(); DECLARE_MESSAGE_MAP() }; diff --git a/mozilla/cmd/winfe/mnrccln.cpp b/mozilla/cmd/winfe/mnrccln.cpp index c21e246ee06..91e9c27831a 100644 --- a/mozilla/cmd/winfe/mnrccln.cpp +++ b/mozilla/cmd/winfe/mnrccln.cpp @@ -32,38 +32,50 @@ HINSTANCE CMailNewsResourceDll::s_dllinstance=NULL; unsigned int CMailNewsResourceDll::s_refcount=0; CMailNewsResourceDll::CMailNewsResourceDll() +{ +} + +CMailNewsResourceDll::~CMailNewsResourceDll() +{ + if (s_dllinstance) + { +#ifdef WIN32 + if (!FreeLibrary(s_dllinstance)) + XP_ASSERT(0); +#else + FreeLibrary(s_dllinstance); +#endif + s_refcount--; + } +} + +BOOL CMailNewsResourceDll::Initialize() { // Running under Win3.1, if the default drive is A or B and the disk // was removed, this tries to load from the default drive. // So change to C before loading. (A=1, B=2, C=3) + BOOL ret = FALSE; if( _getdrive() < 3 ){ _chdrive(3); } if (s_refcount) { s_dllinstance=LoadLibrary(MAILNEWSDLL); - s_refcount++; - return; + if (s_dllinstance) { + s_refcount++; + ret = TRUE; + } } else { s_dllinstance=LoadLibrary(MAILNEWSDLL); XP_ASSERT(s_dllinstance); - s_refcount++; - if(!s_dllinstance) - return; + if(s_dllinstance) { + s_refcount++; + ret = TRUE; + } } -} - -CMailNewsResourceDll::~CMailNewsResourceDll() -{ -#ifdef WIN32 - if (!FreeLibrary(s_dllinstance)) - XP_ASSERT(0); -#else - FreeLibrary(s_dllinstance); -#endif - s_refcount--; + return ret; } HINSTANCE @@ -71,6 +83,31 @@ CMailNewsResourceDll::switchResources() { XP_ASSERT(s_refcount); HINSTANCE t_hinstance=AfxGetResourceHandle(); - AfxSetResourceHandle(s_dllinstance); + if (s_dllinstance) + AfxSetResourceHandle(s_dllinstance); return t_hinstance; } + +CMailNewsResourceSwitcher::CMailNewsResourceSwitcher() +{ + m_oldresourcehandle = NULL; +} + +void CMailNewsResourceSwitcher::Reset() +{ + if (m_oldresourcehandle) + AfxSetResourceHandle(m_oldresourcehandle); +} + + +BOOL +CMailNewsResourceSwitcher::Initialize() +{ + BOOL ret = FALSE; + if (CMailNewsResourceDll::Initialize()) { + m_oldresourcehandle=switchResources(); + ret = TRUE; + } + + return ret; +} diff --git a/mozilla/cmd/winfe/mnrccln.h b/mozilla/cmd/winfe/mnrccln.h index 88f67c119b8..6d955510b7f 100644 --- a/mozilla/cmd/winfe/mnrccln.h +++ b/mozilla/cmd/winfe/mnrccln.h @@ -29,6 +29,7 @@ class CMailNewsResourceDll public: HINSTANCE switchResources(); + BOOL Initialize (); CMailNewsResourceDll(); ~CMailNewsResourceDll(); }; @@ -38,8 +39,9 @@ class CMailNewsResourceSwitcher:public CMailNewsResourceDll { HINSTANCE m_oldresourcehandle; public: - CMailNewsResourceSwitcher(){m_oldresourcehandle=switchResources();} - void Reset(){AfxSetResourceHandle(m_oldresourcehandle);} + CMailNewsResourceSwitcher(); + BOOL Initialize (); + void Reset(); ~CMailNewsResourceSwitcher(){Reset();} }; diff --git a/mozilla/cmd/winfe/mnrcdll/makefile.win b/mozilla/cmd/winfe/mnrcdll/makefile.win new file mode 100644 index 00000000000..d85ee49f2b5 --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/makefile.win @@ -0,0 +1,20 @@ +# 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. + +DEPTH = ..\..\.. +DIRS = public src + +!include "$(DEPTH)\config\rules.mak" + diff --git a/mozilla/cmd/winfe/mnrcdll/public/makefile.win b/mozilla/cmd/winfe/mnrcdll/public/makefile.win new file mode 100644 index 00000000000..21eb720f45b --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/public/makefile.win @@ -0,0 +1,25 @@ +IGNORE_MANIFEST=1 +# 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. + +MODULE = mnrc$(MOZ_BITS) + +DEPTH = ../../../.. + +EXPORTS = mndlgs.h + + +!include "$(DEPTH)\config\rules.mak" + diff --git a/mozilla/cmd/winfe/mnrcdll/public/mndlgs.h b/mozilla/cmd/winfe/mnrcdll/public/mndlgs.h new file mode 100644 index 00000000000..612d65f2748 --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/public/mndlgs.h @@ -0,0 +1,30 @@ +/* -*- 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. + */ + +#ifndef _MNDLGS_H +#define _MNDLGS_H 1 + +#ifdef XP_WIN16 +#define LOADDS __loadds +#else +#define LOADDS +#endif//XP_WIN16 + + +#endif //_MNDLGS_H + diff --git a/mozilla/cmd/winfe/mnrcdll/src/StdAfx.cpp b/mozilla/cmd/winfe/mnrcdll/src/StdAfx.cpp new file mode 100644 index 00000000000..a3099b3876b --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/src/StdAfx.cpp @@ -0,0 +1,23 @@ +/* -*- 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. + */ +// stdafx.cpp : source file that includes just the standard includes +// mnrcdll.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/mozilla/cmd/winfe/mnrcdll/src/StdAfx.h b/mozilla/cmd/winfe/mnrcdll/src/StdAfx.h new file mode 100644 index 00000000000..1ff33975e47 --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/src/StdAfx.h @@ -0,0 +1,28 @@ +/* -*- 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. + */ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#define _STDAFX_H 1 + +#include "windows.h"//windows core +#include "cdialog.h"//netscape dialog core +#include "cstring.h"//netscape dialog core + diff --git a/mozilla/cmd/winfe/mnrcdll/src/makefile.win b/mozilla/cmd/winfe/mnrcdll/src/makefile.win new file mode 100644 index 00000000000..483361e7c10 --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/src/makefile.win @@ -0,0 +1,46 @@ +IGNORE_MANIFEST=1 +# 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. + +DLLNAME = mnrc$(MOZ_BITS) +PDBFILE = $(DLLNAME).pdb +MAPFILE = $(DLLNAME).map +DLL =.\$(OBJDIR)\$(DLLNAME).dll +DEFFILE = mnrc$(MOZ_BITS).def +RESFILE = mnrcdll.res +MAKE_OBJ_TYPE = DLL + +OBJS = $(OBJS) + +LLIBS = $(DIST)\lib\nsdlg$(MOZ_BITS).lib + +MODULE = mnrcdll +DEPTH = ..\..\..\.. +REQUIRES=mnrcdll coreincl nspr winprefs +CPPSRCS = mnrcdll.cpp stdafx.cpp + +CPP_OBJS=.\$(OBJDIR)\mnrcdll.obj .\$(OBJDIR)\stdafx.obj +!if "$(MOZ_BITS)" != "16" +LINCS=-I$(XPDIST)\public\mnrcdll -I$(XPDIST)\public\coreincl \ + -I$(XPDIST)\public\nspr -I$(XPDIST)\public\winprefs +!endif + +!include "$(DEPTH)\config\rules.mak" + +libs:: $(DLL) + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib + + diff --git a/mozilla/cmd/winfe/mnrcdll/src/mnrc16.def b/mozilla/cmd/winfe/mnrcdll/src/mnrc16.def new file mode 100644 index 00000000000..f4f1f7783ab --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/src/mnrc16.def @@ -0,0 +1,25 @@ +; 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. + +LIBRARY mnrc16 +DESCRIPTION "Navigator mail news resources code" +EXETYPE WINDOWS +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE SINGLE +HEAPSIZE 4096 + +EXPORTS + WEP @10 RESIDENTNAME PRIVATE + diff --git a/mozilla/cmd/winfe/mnrcdll/src/mnrc32.def b/mozilla/cmd/winfe/mnrcdll/src/mnrc32.def new file mode 100644 index 00000000000..4c0d2267d6b --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/src/mnrc32.def @@ -0,0 +1,22 @@ +; 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. +; mnrc32.def : Declares the module parameters for the DLL. + +LIBRARY "MNRC32" +DESCRIPTION 'MNRC32 Windows Dynamic Link Library for the editor' + +EXPORTS + + ; Explicit exports can go here diff --git a/mozilla/cmd/winfe/mnrcdll/src/mnrcdll.cpp b/mozilla/cmd/winfe/mnrcdll/src/mnrcdll.cpp new file mode 100644 index 00000000000..9b6a70d2632 --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/src/mnrcdll.cpp @@ -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. + */ +// mnrcdll.cpp : Defines the initialization routines for the DLL. +// + +#include "stdafx.h" +#include "mnrcdll.h" + +HINSTANCE g_instance; //global instance of this dll + +#ifdef WIN32 + +BOOL WINAPI +DllMain (HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) +{ + g_instance=hInst; + switch( ul_reason_for_call ) { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + default:break; + } + return TRUE; +} + +#endif //WIN32 + + + +#ifndef WIN32 +extern "C" int CALLBACK +LibMain(HINSTANCE hinst, WORD wDataSeg, WORD cbHeap, LPSTR lpszCmdLine ) +{ + g_instance=hinst; + return TRUE; + +} + +#endif //NOT WIN32 diff --git a/mozilla/cmd/winfe/mnrcdll/src/mnrcdll.h b/mozilla/cmd/winfe/mnrcdll/src/mnrcdll.h new file mode 100644 index 00000000000..e90dd7cd9ae --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/src/mnrcdll.h @@ -0,0 +1,30 @@ +/* -*- 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. + */ +// mnrcdll.h : main header file for the MNRCDLL DLL +// + +#ifndef _STDAFX_H + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + + +extern HINSTANCE g_instance; + +///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/cmd/winfe/mnrcdll/src/mnrcdll.rc b/mozilla/cmd/winfe/mnrcdll/src/mnrcdll.rc new file mode 100644 index 00000000000..768c60d188a --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/src/mnrcdll.rc @@ -0,0 +1,590 @@ +/* -*- 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. + */ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" +#if !defined(_WIN32) +#define SS_ETCHEDHORZ SS_BLACKFRAME +#endif +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "#if !defined(_WIN32)\r\n" + "#define SS_ETCHEDHORZ SS_BLACKFRAME\r\n" + "#endif\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""res\\mnrcdll.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "MNRCDLL DLL\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "MNRCDLL\0" + VALUE "LegalCopyright", "Copyright © 1996\0" + VALUE "OriginalFilename", "MNRCDLL.DLL\0" + VALUE "ProductName", "MNRCDLL Dynamic Link Library\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ADDRESS_LIST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 243 + TOPMARGIN, 7 + BOTTOMMARGIN, 235 + HORZGUIDE, 175 + HORZGUIDE, 182 + END + + IDD_ADDRESS_USER, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 223 + TOPMARGIN, 5 + BOTTOMMARGIN, 214 + END + + IDD_ADDRESS_CONTACT, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 221 + TOPMARGIN, 5 + END + + IDD_ADDRESS_COOLTALK, DIALOG + BEGIN + LEFTMARGIN, 10 + RIGHTMARGIN, 231 + TOPMARGIN, 9 + BOTTOMMARGIN, 144 + END + + IDD_ADDRESS_SECURITY, DIALOG + BEGIN + LEFTMARGIN, 10 + RIGHTMARGIN, 221 + TOPMARGIN, 7 + BOTTOMMARGIN, 151 + END + + IDD_EDIT_HEADER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 175 + TOPMARGIN, 7 + BOTTOMMARGIN, 43 + END + + IDD_PREF_LDAP_OFFLINE_SETTINGS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 233 + TOPMARGIN, 7 + BOTTOMMARGIN, 149 + END + + IDD_PREF_LDAP_SERVER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 233 + TOPMARGIN, 7 + END + + IDD_OFFLINE_PICKER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 244 + TOPMARGIN, 7 + BOTTOMMARGIN, 214 + END + + IDD_DOWNLOAD_CONTROL_PANEL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 180 + TOPMARGIN, 7 + BOTTOMMARGIN, 131 + END + + IDD_SYNCHRONIZE_ONOFF, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 198 + TOPMARGIN, 7 + BOTTOMMARGIN, 75 + END + + IDD_DWNLD_CTRL_PANEL_W16, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 180 + TOPMARGIN, 7 + BOTTOMMARGIN, 151 + END + + IDD_UPGRADE_SUBSCRIBE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 274 + TOPMARGIN, 7 + BOTTOMMARGIN, 109 + END + + IDD_COMPLETION_PICKER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 154 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ADDRESS_LIST DIALOG DISCARDABLE 0, 0, 250, 242 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Mailing List" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_NAME,69,20,159,14,ES_AUTOHSCROLL + EDITTEXT IDC_NICKNAME,69,37,159,14,ES_AUTOHSCROLL + EDITTEXT IDC_Description,69,54,159,14,ES_AUTOHSCROLL + LISTBOX IDC_ENTRIES,14,88,223,99,LBS_SORT | LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + GROUPBOX "Mailing List Info",IDC_STATIC,7,7,236,185 + RTEXT "List Name:",IDC_STATIC,13,24,51,8 + RTEXT "List Nickname:",IDC_STATIC,13,40,51,8 + RTEXT "Description:",IDC_STATIC,13,58,51,8 + CTEXT "Drag entries from the Address Book window into this list", + IDC_STATIC,13,74,225,8 + PUSHBUTTON "OK",IDOK,8,201,50,14 + PUSHBUTTON "Remove",IDC_REMOVEITEM,66,201,50,14 + PUSHBUTTON "Cancel",IDCANCEL,124,201,50,14 + PUSHBUTTON "Help",ID_HELP,181,201,50,14 + CONTROL "",IDC_StatusRect,"Static",SS_BLACKFRAME,7,227,230,11 + CONTROL "",IDC_STATUSSEPARATOR,"Static",SS_ETCHEDHORZ,10,223,230, + 1 +END + +IDD_ADDRESS_USER DIALOG DISCARDABLE 0, 0, 233, 215 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Name" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_FIRSTNAME,59,9,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_LASTNAME,59,26,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_DISPLAYNAME,59,43,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_ADDRESS,59,64,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_NICKNAME,59,79,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_TITLE,59,100,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_COMPANY_NAME,59,117,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_DEPARTMENT,59,134,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_Description,59,151,163,36,ES_MULTILINE | + ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | + WS_VSCROLL + CONTROL "Prefers to receive rich text (HTML) mail",IDC_CHECK1, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,59,192,162,9 + RTEXT "First Name:",IDC_STATIC,5,11,50,9 + RTEXT "Last Name:",IDC_STATIC,5,28,50,9 + RTEXT "Display Name:",IDC_STATIC,5,45,50,9 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,59,231,1 + RTEXT "Email:",IDC_STATIC,5,66,50,9 + RTEXT "Nickname:",IDC_STATIC,5,81,50,9 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,95,231,1 + RTEXT "Title:",IDC_STATIC,5,102,50,9 + RTEXT "Organization:",IDC_STATIC,5,119,50,9 + RTEXT "Notes:",IDC_STATIC,5,153,50,9 + RTEXT "Department:",IDC_STATIC,5,136,50,9 +END + +IDD_ADDRESS_CONTACT DIALOG DISCARDABLE 0, 0, 231, 202 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Contact" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_STREET2,58,14,163,23,ES_MULTILINE | ES_AUTOHSCROLL + EDITTEXT IDC_LOCALITY,58,41,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_REGION,58,57,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_ZIP,58,73,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_COUNTRY,58,89,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_PHONE1,58,110,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_HOME1,58,127,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_FAX,58,144,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_PAGER,58,161,163,12,ES_AUTOHSCROLL + EDITTEXT IDC_CELLULAR,58,178,163,12,ES_AUTOHSCROLL + RTEXT "Address:",IDC_STATIC,4,14,48,9 + RTEXT "City:",IDC_STATIC,4,43,48,9 + RTEXT "State:",IDC_STATIC,4,59,48,9 + RTEXT "Zip:",IDC_STATIC,4,75,48,10 + RTEXT "Country:",IDC_STATIC,4,91,48,10 + RTEXT "Work:",IDC_STATIC,4,111,48,9 + RTEXT "Fax:",IDC_STATIC,4,146,48,9 + RTEXT "Home:",IDC_STATIC,4,129,48,9 + RTEXT "Pager:",IDC_STATIC,4,163,48,8 + RTEXT "Cellular:",IDC_STATIC,4,180,48,8 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,105,231,1 +END + +IDD_ADDRESS_COOLTALK DIALOG DISCARDABLE 0, 0, 241, 154 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Conference" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Address:",IDC_STATIC,34,53,32,8,NOT WS_GROUP + LTEXT "Use the Call button to conference with another user using the defined conferencing application. You must first choose the directory server you would like to use to look up that person's address, or enter a direct address for their machine.", + IDC_STATIC,15,13,211,34 + COMBOBOX IDC_CoolServer,74,51,132,46,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_IP_ADDRESS,74,69,132,14,ES_AUTOHSCROLL + CTEXT "(For example: name.domain.com or 123.45.678.90)", + IDC_EXPLANATION1,74,87,132,20 +END + +IDD_ADDRESS_SECURITY DIALOG DISCARDABLE 0, 0, 231, 161 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Security" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "You have this person's Security Certificate", + IDC_EXPLANATION1,15,11,201,9 + LTEXT "This person's Secuirty Certificate will expire....", + IDC_EXPLANATION3,15,79,201,45 + LTEXT "This means that.....",IDC_EXPLANATION2,15,29,201,41 + PUSHBUTTON "Show Certificate",IDC_BUTTON1,86,132,58,14 +END + +IDD_ADDRESSPICKER DIALOG DISCARDABLE 0, 0, 405, 245 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select Addresses" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_ADDRNAME,78,12,238,14,ES_AUTOHSCROLL + COMBOBOX IDC_DIRECTORIES,321,12,16,80,CBS_DROPDOWNLIST | NOT + WS_VISIBLE | WS_VSCROLL + PUSHBUTTON "Stop",ID_NAVIGATE_INTERRUPT,344,12,50,14 + LISTBOX IDC_ADDRESSLIST,10,30,385,65,LBS_SORT | LBS_MULTIPLESEL | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&To:",IDC_TO,10,99,50,14 + PUSHBUTTON "&Cc:",IDC_CC,66,99,50,14 + PUSHBUTTON "&Bcc:",IDC_BCC,123,99,50,14 + PUSHBUTTON "Properties...",ID_ITEM_PROPERTIES,345,99,50,14 + LISTBOX IDC_ADDRESSBKT,5,140,395,65,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + PUSHBUTTON "OK",IDC_DONE_EDITING,111,211,50,14,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,177,211,50,14 + PUSHBUTTON "Help",ID_HELP,243,211,50,14 + PUSHBUTTON "&Search...",IDC_DIRSEARCH,11,12,56,14 + GROUPBOX "Select a directory and type in the name you are looking for:", + IDC_STATIC,5,0,395,121 + SCROLLBAR IDC_StatusRect,0,232,405,12 + LTEXT "This message will be sent to:",IDC_STATIC,5,130,91,8 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDVERT,72,9,1,20 +END + +IDD_EDIT_HEADER DIALOG DISCARDABLE 0, 0, 182, 50 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Header name" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "&Enter header",IDC_STATIC,7,6,90,8 + EDITTEXT IDC_EDIT_HEADERS,6,15,170,12,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,70,32,50,14 + PUSHBUTTON "Cancel",IDCANCEL,126,32,50,14 +END + +IDD_PREF_LDAP_OFFLINE_SETTINGS DIALOG DISCARDABLE 0, 0, 240, 156 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Offline Settings" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Select this directory for download",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,11,226,10 + LTEXT "This directory is being replicated on your system. You will have access to all of Client product development from this directory when offline. Only Name, Email, Department and phone number is saved locally.", + IDC_STATIC,7,33,154,58 + PUSHBUTTON "Update Now",IDC_UPDATE_NOW,7,135,50,14 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,11,25,218,1 +END + +IDD_PREF_LDAP_SERVER DIALOG DISCARDABLE 0, 0, 240, 154 +STYLE WS_CHILD | WS_CAPTION | WS_SYSMENU +CAPTION "General" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_EDIT_DESCRIPTION,95,7,138,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SERVER,95,22,138,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_ROOT,95,36,138,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_PORT_NO,95,61,32,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_MAX_HITS,95,75,32,12,ES_AUTOHSCROLL + CONTROL "Se&cure",IDC_SECURE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,100,55,10 + CONTROL "Login with name and password",IDC_LOGIN_LDAP,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,116,113,10 + CONTROL "S&ave Password",IDC_SAVE_PASSWORD,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,18,132,75,10 + LTEXT "&Description:",IDC_STATIC,8,7,70,10 + LTEXT "&LDAP Server:",IDC_STATIC_SERVER,8,23,70,11 + LTEXT "&Search Root:",IDC_STATIC_ROOT,8,38,70,11 + LTEXT "&Port Number:",IDC_STATIC_PORT,8,62,70,11 + LTEXT "&Maximum Number of Hits:",IDC_STATIC_MAX_HITS,8,78,83, + 11 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,54,225,1 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,92,225,1 +END + +110 DIALOG DISCARDABLE 0, 0, 311, 173 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Items Matching " +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_ADDRESSLIST,7,7,297,130,LBS_SORT | LBS_MULTIPLESEL | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,64,141,50,14,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,131,141,50,14 + PUSHBUTTON "Help",ID_HELP,198,141,50,14 + SCROLLBAR IDC_StatusRect,0,160,311,12 +END + +IDD_OFFLINE_PICKER DIALOG DISCARDABLE 0, 0, 251, 221 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select Items for Download" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,84,200,50,14 + PUSHBUTTON "Cancel",IDCANCEL,139,200,50,14 + PUSHBUTTON "Help",IDC_OFFLINE_SELECT_HELP,194,200,50,14 + GROUPBOX "",IDC_TEMP_OUTLINER_BOX,6,15,237,178 + LTEXT "Choose Mail folders, Newsgroups and Directories for offline use:", + IDC_STATIC,7,4,244,8,NOT WS_GROUP +END + +IDD_DOWNLOAD_CONTROL_PANEL DIALOG DISCARDABLE 0, 0, 187, 138 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Download Offline Items" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "&Mail Messages",IDC_DWNLD_CHECK_MAIL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,23,21,138,8 + CONTROL "&News Messages",IDC_DWNLD_CHECK_DISCUSSIONS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,23,36,138,8 + CONTROL "&Directories",IDC_DWNLD_CHECK_DIRECTORIES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,23,50,102,8 + PUSHBUTTON "&Select...",IDC_DWNLD_BUTTON_SELECT,129,46,42,12 + DEFPUSHBUTTON "S&ynchronize",IDOK,9,111,50,14 + PUSHBUTTON "Close",IDCANCEL,68,111,50,14 + PUSHBUTTON "Help",IDC_DWNLD_HELP_GO_OFFLINE,127,111,50,14 + GROUPBOX "Mail and News Items",IDC_DWNLD_STATIC_MGD,9,9,168,78 + CONTROL "S&end Unsent Messages",IDC_DWNLD_CHECK_SENDMAIL, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,73,138,8 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,11,66,165,1 + CONTROL "Go &offline after synchronization", + IDC_DWNLD_CHECK_GO_OFFLINE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,9,96,167,8 +END + +IDD_SYNCHRONIZE_ONOFF DIALOG DISCARDABLE 0, 0, 205, 82 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Go Offline" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Yes",IDOK,11,61,39,14 + PUSHBUTTON "Cancel",IDCANCEL,107,61,39,14 + PUSHBUTTON "Help",IDC_HELP_DOWNLOAD,155,61,39,14 + LTEXT "Going offline will tell Communicator not to make any network connections.", + IDC_STATIC,21,6,162,18 + LTEXT "Do you want to synchronize before going offline?", + IDC_STATIC_SYNC_QUESTION,21,33,159,18 + DEFPUSHBUTTON "No",IDC_BUTTON_NO,59,61,39,14 +END + +IDD_DWNLD_CTRL_PANEL_W16 DIALOG DISCARDABLE 0, 0, 187, 158 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "&Mail Folders",IDC_DWNLD_CHECK_MAIL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,23,18,103,8 + CONTROL "News&groups",IDC_DWNLD_CHECK_DISCUSSIONS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,23,42,103,8 + CONTROL "&Directories",IDC_DWNLD_CHECK_DIRECTORIES,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,23,66,103,8 + PUSHBUTTON "&Select...",IDC_DWNLD_BUTTON_SELECT,129,72,42,12 + CONTROL "Go &offline after synchronization", + IDC_DWNLD_CHECK_GO_OFFLINE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,118,167,8 + DEFPUSHBUTTON "S&ynchronize",IDOK,9,135,50,14 + PUSHBUTTON "Cancel",IDCANCEL,68,135,50,14 + PUSHBUTTON "Help",IDC_DWNLD_HELP_GO_OFFLINE,127,135,50,14 + GROUPBOX "Mail, Groups and Directories",IDC_DWNLD_STATIC_MGD,9,6, + 168,104 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,12,89,165,1 + CONTROL "S&end Messages",IDC_DWNLD_CHECK_SENDMAIL,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,23,96,133,8 +END + +IDD_UPGRADE_SUBSCRIBE DIALOG DISCARDABLE 0, 0, 281, 116 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Subscribing to Folders" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,91,95,50,14 + PUSHBUTTON "Cancel",IDCANCEL,157,95,50,14 + PUSHBUTTON "&Help",IDHELP,223,95,50,14 + LTEXT "Messenger detects that you have upgraded from a previous version. In order to read your mail, Messenger will need to know which folders you would like to subscribe to.", + IDC_STATIC,7,7,267,16 + LTEXT "Only folders you subscribe to will appear in your folder view. Any folders you do not subscribe to will not be available in your Messenger window. (Note: you can always change which folders you subscribe to by selecting Subscribe from the File menu).", + IDC_STATIC,7,27,267,31 + CONTROL "Automatically subscribe to all my folders on %s", + IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,25,62,249,10 + CONTROL "Let me choose now which folders are subscribed to", + IDC_RADIO2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,25, + 75,249,10 +END + +IDD_COMPLETION_PICKER DIALOG DISCARDABLE 0, 0, 276, 161 +STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_ADDRESSLIST,17,22,244,91,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,81,118,50,14 + PUSHBUTTON "Cancel",IDCANCEL,145,118,50,14 + CONTROL "",IDC_StatusRect,"Static",SS_BLACKFRAME,17,145,252,9 + CONTROL "",IDC_STATUSSEPARATOR,"Static",SS_ETCHEDHORZ,22,137,68, + 1 +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif +#include "res\mnrcdll.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/cmd/winfe/mnrcdll/src/res/mnrcdll.rc2 b/mozilla/cmd/winfe/mnrcdll/src/res/mnrcdll.rc2 new file mode 100644 index 00000000000..dbc718f69bd --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/src/res/mnrcdll.rc2 @@ -0,0 +1,30 @@ +/* -*- 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. + */ +// +// MNRCDLL.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/cmd/winfe/mnrcdll/src/resource.h b/mozilla/cmd/winfe/mnrcdll/src/resource.h new file mode 100644 index 00000000000..8e6fd847a2a --- /dev/null +++ b/mozilla/cmd/winfe/mnrcdll/src/resource.h @@ -0,0 +1,531 @@ +/* -*- 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. + */ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by mnrcdll.rc +// +#define IDC_REMOVE 3 +#define IDC_VERIFY_HTML 7 +#define IDHELP 9 +#define IDD_ADDRESS_LIST 101 +#define IDD_FECONVERTIMAGE 103 +#define IDD_LOCATION_DLG 104 +#define IDD_PAGE_TITLE 105 +#define IDC_TITLE 113 +#define IDD_ADDRESS_USER 127 +#define IDD_DWNLD_CTRL_PANEL_W16 142 +#define IDC_StatusRect 153 +#define IDC_Description 208 +#define IDC_FONTFACE_COMBO 213 +#define IDC_AUTO_SAVE_MINUTES 214 +#define IDC_PUBLISH_USER_NAME 217 +#define IDD_ADDRESSBOOK 230 +#define IDC_NAME 284 +#define IDC_REMOVEITEM 290 +#define IDC_DONE_EDITING 291 +#define IDC_STATIC1 335 +#define IDC_STATIC2 336 +#define IDC_STATIC3 337 +#define IDC_ALT_TEXT_LOWRES 373 +#define IDC_USE_EXTERNAL_CHANGES 373 +#define IDC_BUTTON1 373 +#define IDC_EXTRA_HTML 374 +#define IDC_USE_INTERNAL_CHANGES 374 +#define IDC_REPLACE 375 +#define IDC_BCC 375 +#define IDC_CANCEL 381 +#define IDD_COLOR_LIST 390 +#define IDD_COLOR_DLG 391 +#define IDD_PROPS_FONTDEF 423 +#define IDC_STATIC5 502 +#define IDC_RADIO1 540 +#define IDC_OPEN_IN_EDITOR 541 +#define IDC_RADIO2 541 +#define IDC_RADIO3 542 +#define IDC_CHOOSE_BKGRND_COLOR 552 +#define IDC_BKGRND_USE_IMAGE 563 +#define IDC_BKGRND_IMAGE 564 +#define IDC_BKGRND_IMAGE_BROWSE 572 +#define IDC_LOCATION 616 +#define IDC_STATIC_DESC 621 +#define IDC_LOCK_ASPECT 630 +#define IDC_HR_SAVE_DEFAULT 630 +#define IDC_AUTO_SAVE 630 +#define IDC_CHECK1 630 +#define IDC_NICKNAME 633 +#define IDC_ADDRESS 634 +#define ID_LIST_FONTCOLOR 640 +#define IDD_ADDRESS_SECURITY 917 +#define IDD_ADDRESS_COOLTALK 918 +#define IDC_ROWS 1000 +#define IDC_ERROR_WORD 1000 +#define IDC_CONVERTLIST 1000 +#define IDC_OUTFILE 1001 +#define IDC_NEW_WORD 1002 +#define IDC_ENTRIES 1002 +#define IDC_COLUMNS 1003 +#define IDC_USE_AS_DEFAULT 1003 +#define IDC_QUALITY2 1004 +#define IDC_FIRSTNAME 1005 +#define IDC_IP_ADDRESS 1005 +#define IDC_IMAGETYPE 1006 +#define IDC_CHANGE 1006 +#define IDC_IMAGETYPE2 1007 +#define IDC_ROWSPAN 1007 +#define IDC_LASTNAME 1007 +#define IDC_INPUTIMAGETYPE 1008 +#define IDC_COLSPAN 1008 +#define IDC_WORD_TO_ADD 1008 +#define IDC_INPUTIMAGESIZE 1009 +#define IDC_IGNORE_ALL 1009 +#define IDC_PREF_STRING_MSG 1009 +#define IDC_QUALITY1 1010 +#define IDC_CHANGE_ALL 1010 +#define IDC_LOCALITY 1010 +#define IDC_WIDTH 1011 +#define IDC_ERROR_PROMPT 1011 +#define IDC_USE_PAGE_LOCATION 1011 +#define IDC_REGION 1011 +#define IDC_QUALITY3 1012 +#define IDC_EDIT_DICTIONARY 1013 +#define IDC_COMPANY_NAME 1013 +#define IDC_STREET2 1013 +#define IDC_CAPTION 1015 +#define IDC_HEIGHT 1017 +#define IDC_SECURE 1018 +#define IDC_SAVE_PASSWORD 1019 +#define IDC_LOGIN_LDAP 1020 +#define IDC_COLOR_WELL 1021 +#define IDC_CHOOSE_BACKGROUND 1022 +#define IDC_WRAP 1025 +#define IDC_HEADER 1026 +#define IDC_NOSAVE_FONTDEF 1026 +#define IDC_ALIGN_TOP 1027 +#define IDC_FONTFACE_MSG 1027 +#define IDC_ALIGN_V_CENTER 1028 +#define IDC_ALIGN_BOTTOM 1029 +#define IDC_ALIGN_BASELINE 1030 +#define IDC_FONT_SIZE_MSG 1031 +#define IDC_LANGUAGE 1032 +#define IDC_MAKE_IMAGE_BACKGROUND 1032 +#define IDC_SUGGESTIONS 1033 +#define IDC_BORDER 1034 +#define IDC_CHECK_WORD 1034 +#define IDC_CELL_SPACING 1035 +#define IDC_CELL_PADDING 1036 +#define IDC_USE_BORDER 1037 +#define IDC_DEFAULT_COLOR_MSG 1065 +#define IDC_DEFAULT_COLOR 1100 +#define IDC_COLOR_1 1101 +#define IDC_COLOR_2 1102 +#define IDC_COLOR_3 1103 +#define IDC_COLOR_4 1104 +#define IDC_COLOR_5 1105 +#define IDC_COLOR_6 1106 +#define IDC_COLOR_7 1107 +#define IDC_COLOR_8 1108 +#define IDC_COLOR_9 1109 +#define IDC_COLOR_10 1110 +#define IDC_COLOR_11 1111 +#define IDC_COLOR_12 1112 +#define IDC_COLOR_13 1113 +#define IDC_COLOR_14 1114 +#define IDC_COLOR_15 1115 +#define IDC_COLOR_16 1116 +#define IDC_COLOR_17 1117 +#define IDC_COLOR_18 1118 +#define IDC_COLOR_19 1119 +#define IDC_COLOR_20 1120 +#define IDC_COLOR_21 1121 +#define IDC_COLOR_22 1122 +#define IDC_COLOR_23 1123 +#define IDC_COLOR_24 1124 +#define IDC_COLOR_25 1125 +#define IDC_COLOR_26 1126 +#define IDC_COLOR_27 1127 +#define IDC_COLOR_28 1128 +#define IDC_COLOR_29 1129 +#define IDC_COLOR_30 1130 +#define IDC_COLOR_31 1131 +#define IDC_COLOR_32 1132 +#define IDC_COLOR_33 1133 +#define IDC_COLOR_34 1134 +#define IDC_COLOR_35 1135 +#define IDC_COLOR_36 1136 +#define IDC_COLOR_37 1137 +#define IDC_COLOR_38 1138 +#define IDC_COLOR_39 1139 +#define IDC_COLOR_40 1140 +#define IDC_COLOR_41 1141 +#define IDC_COLOR_42 1142 +#define IDC_COLOR_43 1143 +#define IDC_COLOR_44 1144 +#define IDC_COLOR_45 1145 +#define IDC_COLOR_46 1146 +#define IDC_COLOR_47 1147 +#define IDC_COLOR_48 1148 +#define IDC_COLOR_49 1149 +#define IDC_ADDRESSLIST 1203 +#define IDC_TO 1204 +#define IDC_CC 1205 +#define IDC_WORD_LIST 1216 +#define IDC_LANGUAGE_LIST 1216 +#define IDC_IGNORE 1228 +#define IDC_FEWER 1255 +#define IDC_SAVE_FILENAME 1276 +#define IDC_COMBO_ATTRIB1 1285 +#define IDC_COMBO_ATTRIB2 1286 +#define IDC_COMBO_ATTRIB3 1287 +#define IDC_COMBO_ATTRIB4 1288 +#define IDC_COMBO_ATTRIB5 1289 +#define IDC_COMBO_OP1 1290 +#define IDC_COMBO_OP2 1291 +#define IDC_COMBO_OP3 1292 +#define IDC_COMBO_OP5 1293 +#define IDC_COMBO_OP4 1294 +#define IDC_EDIT_VALUE1 1296 +#define IDC_EDIT_VALUE2 1297 +#define IDC_EDIT_VALUE3 1298 +#define IDC_EDIT_VALUE4 1299 +#define IDC_EDIT_VALUE5 1300 +#define IDC_STATIC_THE2 1306 +#define IDC_STATIC_THE3 1307 +#define IDC_STATIC_THE4 1308 +#define IDC_STATIC_THE5 1309 +#define IDC_STATIC_THE1 1315 +#define IDC_NEW 1319 +#define IDC_ADDRNAME 1332 +#define IDC_EXPLANATION2 1332 +#define IDC_ADD 1333 +#define IDC_MORE 1334 +#define IDC_IN_STATIC 1349 +#define IDC_DIRECTORIES 1350 +#define IDC_DIRSEARCH 1351 +#define IDC_POBOX 1354 +#define IDC_ZIP 1355 +#define IDC_PHONE1 1356 +#define IDC_COUNTRY 1357 +#define IDC_FAX 1358 +#define IDC_HOME1 1359 +#define IDD_ADDRESSPICKER 1363 +#define IDC_EXPLANATION3 1366 +#define IDC_CoolServer 1367 +#define IDD_ADDRESS_CONTACT 1372 +#define IDD_RESOLVE_EDIT_CHANGES 1402 +#define IDD_PREF_LDAP_SERVER 1404 +#define IDC_CHOOSE_COLOR 1405 +#define IDC_CHOOSE_FONT 1407 +#define IDC_STATIC_SERVER 1414 +#define IDC_EDIT_MAX_HITS 1415 +#define IDC_EDIT_PORT_NO 1416 +#define IDC_STATIC_ROOT 1417 +#define IDC_EDIT_ROOT 1418 +#define IDC_STATIC_PORT 1419 +#define IDC_STATIC_MAX_HITS 1420 +#define IDC_EDIT_SERVER 1423 +#define IDC_EDIT_DESCRIPTION 1424 +#define IDC_ADDRESSBKT 1438 +#define IDD_IMAGE_ALT 1443 +#define IDD_EXTRA_HTML 1444 +#define IDC_EXTRA_HTML_TEXT 1445 +#define IDC_EXTRA_HTML_MSG 1446 +#define IDD_SPELL_CHECKER 1446 +#define IDC_LOCAL_FONT_MSG 1447 +#define IDC_FONT_COLOR_FRAME 1448 +#define IDC_USE_COLS 1455 +#define IDC_INSTALL 1464 +#define IDC_NETHELP 1465 +#define IDC_COLOR_LIST_FRAME 1466 +#define IDC_EXPLANATION1 1466 +#define IDD_NO_SPELL_CHECKER 1474 +#define IDD_CUSTOM_DICTIONARY 1476 +#define IDD_SPELLING_LANGUAGE 1500 +#define IDC_COMBO_AND_OR 1503 +#define IDC_EDIT_HEADERS 1508 +#define IDD_BASIC_SEARCH 1533 +#define IDD_ADVANCED_LDAP_SEARCH 1535 +#define IDC_UPDATE_NOW 1553 +#define IDD_PREF_LDAP_OFFLINE_SETTINGS 1553 +#define IDD_BASIC_SEARCH 1533 +#define IDD_EDIT_HEADER 1700 +#define IDD_DOWNLOAD_CONTROL_PANEL 1735 +#define IDD_SYNCHRONIZE_ONOFF 1736 +#define IDD_OFFLINE_PICKER 1739 +#define IDD_COMPLETION_PICKER 1740 +#define IDC_DWNLD_HELP_GO_OFFLINE 1750 +#define IDC_DWNLD_CHECK_GO_OFFLINE 1751 +#define IDC_DWNLD_CHECK_MAIL 1752 +#define IDC_DWNLD_CHECK_DISCUSSIONS 1753 +#define IDC_DWNLD_CHECK_DIRECTORIES 1754 +#define IDC_DWNLD_BUTTON_SELECT 1755 +#define IDC_DWNLD_STATIC_MGD 1756 +#define IDC_DWNLD_CHECK_SENDMAIL 1757 +#define IDC_DOWNLOADFLAGGED 1758 +#define IDC_HELP_DOWNLOAD 1759 +#define IDC_STATIC_SYNC_QUESTION 1760 +#define IDC_BUTTON_NO 1761 +#define IDC_STATUSSEPARATOR 1762 +#define IDC_DISPLAYNAME 1764 +#define IDC_DEPARTMENT 1765 +#define IDC_CELLULAR 1774 +#define IDC_PAGER 1775 +#define IDC_DWNLD_CHECK_GO_OFFLINE2 1800 +#define IDC_DWNLD_DISCUSSIONS 1801 +#define IDD_PREF_EDITOR 2008 +#define IDD_HINT_DLG 2022 +#define IDC_HREF_FILE 2023 +#define IDD_PROPS_HRULE 2024 +#define IDC_ANCHOR_EDIT 2026 +#define IDC_HREF_UNLINK 2036 +#define IDC_HREF_URL 2040 +#define IDC_TARGET_LIST 2041 +#define IDC_ANCHOR_LABEL 2050 +#define IDC_ANCHOR 2051 +#define IDC_ANCHOR_FRAME 2052 +#define IDC_LINK_FRAME 2053 +#define IDC_TARGET_LABEL 2054 +#define IDC_SHOW_HINT_AGAIN 2055 +#define IDC_EDIT_HINT 2056 +#define IDC_OVERWRITE_ICON 2059 +#define IDC_HR_ALIGN_LEFT 2066 +#define IDC_HR_ALIGN_CENTER 2067 +#define IDC_HR_ALIGN_RIGHT 2068 +#define IDC_HR_WIDTH 2069 +#define IDC_IMAGE_BORDER 2073 +#define IDC_HR_SHADOW 2073 +#define IDC_IMAGE_SPACE_HORIZ 2074 +#define IDC_HR_HEIGHT 2074 +#define IDC_IMAGE_SPACE_VERT 2076 +#define IDC_IMAGE_ALT_TEXT 2077 +#define IDC_IMAGE_FILE 2079 +#define IDC_NOWRAP_MSG 2092 +#define IDC_LOWRES_URL 2096 +#define IDC_COMPACT_LIST 2098 +#define IDC_KEEP_IMAGE_WITH_DOC 2099 +#define IDC_IMAGE_URL 2101 +#define IDD_LOADING_IMAGES 2102 +#define IDC_NO_SAVE_IMAGE 2103 +#define IDC_DOC_TITLE 2104 +#define IDC_DOC_URL 2105 +#define IDC_DOC_AUTHOR 2106 +#define IDC_DOC_CREATION_DATE 2107 +#define IDC_FONTDEF_LOCATION 2107 +#define IDC_DOC_UPDATE_DATE 2108 +#define IDC_DOC_DESCRIPTION 2109 +#define IDC_CHECK_BOLD 2115 +#define IDC_CHECK_ITALIC 2116 +#define IDC_CHECK_STRIKETHROUGH 2117 +#define IDC_CHECK_SUPERSCRIPT 2118 +#define IDD_SAVE_REMOTE_DOCUMENT 2118 +#define IDC_CHECK_SUBSCRIPT 2119 +#define IDC_CHECK_UNDERLINE 2120 +#define IDD_PAGE_DOC_COLORS 2121 +#define IDC_FONT_SIZE_COMBO 2124 +#define IDC_FONT_COLOR_COMBO 2125 +#define IDD_SAVE_IMAGE_OVERWRITE 2125 +#define IDC_FONT_SIZE_COMBO2 2126 +#define IDC_CHECK_BLINK 2127 +#define IDC_COPY_IMAGES 2128 +#define IDC_CHECK_NOBREAK 2128 +#define IDC_EDIT_AUTHOR 2132 +#define IDC_DOC_COLOR_PREVIEW 2134 +#define IDC_EQUIV_LIST 2135 +#define IDC_META_LIST 2136 +#define IDC_VAR_NAME 2137 +#define IDC_VAR_VALUE 2138 +#define IDC_VAR_SET 2139 +#define IDC_VAR_DELETE 2140 +#define IDC_VAR_NEW 2141 +#define IDC_SAVEAS_MSG 2142 +#define IDC_SCHEME_LIST 2146 +#define IDC_SAVE_SCHEME 2147 +#define IDC_REMOVE_SCHEME 2148 +#define IDC_OVERWRITE_ONE 2160 +#define IDC_OVERWRITE_ALL 2161 +#define IDC_DONT_OVERWRITE_ONE 2162 +#define IDD_PAGE_IMAGE 2163 +#define IDC_DONT_OVERWRITE_ALL 2163 +#define IDD_PAGE_LINK 2164 +#define IDD_PAGE_CHARACTER 2165 +#define IDC_CHOOSE_TEXT_COLOR 2166 +#define IDC_CHOOSE_LINK_COLOR 2167 +#define IDD_PAGE_PARAGRAPH 2167 +#define IDC_CHOOSE_ACTIVELINK_COLOR 2168 +#define IDD_PAGE_DOC_ADVANCED 2169 +#define IDC_CHOOSE_FOLLOWEDLINK_COLOR 2169 +#define IDC_SWATCH_TEXT 2170 +#define IDD_PROPS_TARGET 2170 +#define IDC_SWATCH_LINK 2171 +#define IDC_SWATCH_ACTIVELINK 2172 +#define IDC_SWATCH_FOLLOWEDLINK 2173 +#define IDC_SWATCH_BKGRND 2174 +#define IDD_PUB_STATUS 2174 +#define IDD_PUBLISH 2175 +#define IDC_APPLY_SETTINGS_MSG 2177 +#define IDC_COLOR_SCHEME_GROUP 2178 +#define IDC_COLOR_BKGRND_GROUP 2180 +#define IDD_PAGE_DOC_INFO 2180 +#define IDC_SET_DOC_COLORS 2183 +#define IDC_USE_BROWSER_COLORS 2184 +#define IDD_SAVE_NEW_DOCUMENT 2184 +#define IDD_PREF_PUBLISH 2189 +#define IDC_CLEAR_ALL_STYLES 2190 +#define IDC_CLEAR_TEXT_STYLES 2191 +#define IDC_PARAGRAPH_STYLES 2191 +#define IDC_ALIGN_LEFT 2192 +#define IDC_ALIGN_CENTER 2193 +#define IDC_ALIGN_RIGHT 2194 +#define IDD_PROPS_HTML_TAG 2194 +#define IDC_LIST_STYLES 2195 +#define IDC_LIST_ITEM_LABEL 2196 +#define IDD_PROPS_JAVA_HEADER 2196 +#define IDC_LIST_ITEM_STYLES 2197 +#define IDD_NEW_DOCUMENT 2197 +#define IDD_OPEN_TEMPLATE 2198 +#define IDC_NETSCAPE_TEMPLATES 2198 +#define IDC_LIST_START_NUMBER 2201 +#define IDC_HR_WIDTH_TYPE 2202 +#define IDC_TARGET_NAME 2204 +#define IDC_TARGETS_IN_CURRENT_DOC 2205 +#define IDC_TARGETS_IN_FILE 2206 +#define IDC_CONTAINER_STYLES 2211 +#define IDC_HTML_EDITOR 2212 +#define IDC_IMAGE_ORIGINAL_SIZE 2213 +#define IDC_IMAGE_EDITOR 2213 +#define IDC_SELECT_HTML_EDITOR 2214 +#define IDC_IMAGE_HEIGHT 2215 +#define IDC_SELECT_IMAGE_EDITOR 2215 +#define IDC_PUBLISH_FILE_COUNT 2215 +#define IDC_IMAGE_WIDTH 2216 +#define IDC_PUBLISH_CURRENT_FILE 2216 +#define IDC_PUBLISH_TO_URL 2217 +#define IDC_TIME_REMAINING 2218 +#define IDC_PUBLISH_RATE 2219 +#define IDC_EDIT_IMAGE 2220 +#define IDC_AUTOADJUST_LINKS 2221 +#define IDC_PUBLISH_USER 2222 +#define IDC_INFO_ICON 2223 +#define IDC_KEYWORDS 2224 +#define IDC_PUBLISH_FILENAME 2225 +#define IDC_REMOVE_ISMAP 2227 +#define IDC_PUBLISH_LOCATION_LIST 2230 +#define IDC_BROWSE_FILE 2230 +#define IDC_PUBLISH_FTP 2231 +#define IDC_DOC_CLASIFICATION 2232 +#define IDC_PUBLISH_HTTP 2232 +#define IDC_PUBLISH_PASSWORD 2233 +#define IDC_PUBLISH_REMEMBER_PASSWORD 2235 +#define IDC_HEIGHT_PIX_OR_PERCENT 2236 +#define IDC_NEW_DOC_TEMPLATE 2236 +#define IDC_WIDTH_PIX_OR_PERCENT 2237 +#define IDC_RESTORE_DEFAULT_TEMPLATE 2237 +#define IDC_EDAL_A 2238 +#define IDC_EDIT_TAG 2238 +#define IDC_EDAL_B 2239 +#define IDC_EDALCB 2240 +#define IDC_EDIT_TAG_MSG 2240 +#define IDC_EDAL_C 2241 +#define IDC_EDAL_T 2242 +#define IDC_EDAL_L 2243 +#define IDC_EDAL_R 2244 +#define IDC_MIXED_COLOR_LABEL 2246 +#define IDC_NEW_DOC_BLANK 2249 +#define IDC_NEW_DOC_WIZARD 2251 +#define IDC_PUBLISH_OTHER_FILES 2252 +#define IDC_SELECT_ALL 2254 +#define IDC_SELECT_NONE 2255 +#define IDC_INCLUDE_IMAGE_FILES 2257 +#define IDC_INCLUDE_ALL_FILES 2258 +#define IDC_PUBLISH_DEFAULT_LOCATION 2259 +#define IDC_OVERRIDE_WIDTH 2263 +#define IDC_OVERRIDE_HEIGHT 2264 +#define IDC_OVERRIDE_COLOR 2265 +#define IDC_DONT_CHANGE_COLOR 2266 +#define IDD_CREATE_TABLE 2266 +#define IDD_PAGE_TABLE 2267 +#define IDD_PAGE_TABLE_ROW 2268 +#define IDD_PAGE_TABLE_CELL 2269 +#define IDD_FEJPEGOPTIONS 2270 +#define IDC_APPLY 2272 +#define IDC_OFFLINE_SELECT_HELP 2655 +#define IDC_TEMP_OUTLINER_BOX 2656 +#define IDD_UPGRADE_SUBSCRIBE 22977 +#define ID_NAVIGATE_INTERRUPT 32795 +#define ID_ITEM_PROPERTIES 34137 +#define IDS_HREF_OTHER_ATTRIBS 42271 +#define IDS_HREF_OTHER_ATTRIBS_CAPTION 42272 +#define IDS_ERROR_HTML_CAPTION 42296 +#define IDS_TAG_UNOPENED 42297 +#define IDS_TAG_UNCLOSED 42298 +#define IDS_TAG_PREMATURE_CLOSE 42299 +#define IDS_TAG_TAGNAME_EXPECTED 42300 +#define IDS_TAG_UNTERMINATED_STRING 42301 +#define IDS_TAG_ERROR 42302 +#define IDC_ALIGN_DEFAULT 42337 +#define IDC_ALIGN_VDEFAULT 42338 +#define IDC_ABOVE 42338 +#define IDC_BELOW 42339 +#define IDS_SPELL_NO_SUGGESTIONS 59423 +#define IDS_SPELL_CHANGE 59424 +#define IDS_SPELL_CHANGE_ALL 59425 +#define IDS_SPELL_DELETE 59426 +#define IDS_SPELL_DELETE_ALL 59427 +#define IDS_SPELL_CZECH 59428 +#define IDS_SPELL_RUSSIAN 59429 +#define IDS_SPELL_CATALAN 59430 +#define IDS_SPELL_HUNGARIAN 59431 +#define IDS_SPELL_FRENCH 59432 +#define IDS_SPELL_GERMAN 59433 +#define IDS_SPELL_SWEDISH 59434 +#define IDS_SPELL_SPANISH 59435 +#define IDS_SPELL_ITALIAN 59436 +#define IDS_SPELL_DANISH 59437 +#define IDS_SPELL_DUTCH 59438 +#define IDS_SPELL_PORTUGUESE 59439 +#define IDS_SPELL_PORTUGUESE_BRAZILIAN 59440 +#define IDS_SPELL_PORTUGUESE_EUROPEAN 59441 +#define IDS_SPELL_NORWEGIAN 59442 +#define IDS_SPELL_NORWEGIAN_BOKMAL 59443 +#define IDS_SPELL_NORWEGIAN_NYNORSK 59444 +#define IDS_SPELL_FINNISH 59445 +#define IDS_SPELL_GREEK 59446 +#define IDS_SPELL_ENGLISH 59447 +#define IDS_SPELL_ENGLISH_US 59448 +#define IDS_SPELL_ENGLISH_UK 59449 +#define IDS_SPELL_AFRIKAANS 59450 +#define IDS_SPELL_POLISH 59451 +#define IDS_SPELL_UNKNOWN_LANGUAGE 59452 +#define IDS_SPELL_STOP 59453 +#define IDS_SPELL_DONE 59454 +#define IDS_SPELL_INSTANCE_ACTIVE 59455 +#define IDS_CHECK_SPELLING 59456 +#define IDS_SPELL_NOT_INSTALLED 59457 +#define IDS_SPELL_COULD_NOT_LOAD 59458 +#define IDS_SPELL_CORRUPT 59459 +#define IDS_CORRECT_SPELLING 59460 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 140 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 32892 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mozilla/cmd/winfe/mnwizard.cpp b/mozilla/cmd/winfe/mnwizard.cpp index 48095b1653d..03e13aaca56 100644 --- a/mozilla/cmd/winfe/mnwizard.cpp +++ b/mozilla/cmd/winfe/mnwizard.cpp @@ -61,6 +61,64 @@ extern "C" BOOL EmailValid(char* pEmail) return FALSE; } +void GetImapServerName(char* pServerName) +{ + char serverStr[512]; + int nLen = 511; + if (PREF_NOERROR == PREF_GetCharPref("network.hosts.imap_servers", serverStr, &nLen)) + { + nLen = strlen(serverStr); + int j = 0; + for (int i = 0; i <= nLen; i++) + { + if (serverStr[i] != ',' && serverStr[i] != '\0') + pServerName[j++] = serverStr[i]; + else + { + pServerName[j] = '\0'; + break; + } + } + } +} + +void GetImapUserName(char* pServerName, char* pUserName) +{ + if (strlen(pServerName) > 0) + { + char* pName = NULL; + IMAP_GetCharPref(pServerName, CHAR_USERNAME, &pName); + if (pName) + { + strcat(pUserName, pName); + XP_FREE(pName); + } + } +} + +void SetImapServerName(const char* pServerName) +{ + char *pServerList = NULL; + PREF_CopyCharPref("network.hosts.imap_servers", &pServerList); + + if (pServerList) + { + int nListLen = XP_STRLEN(pServerList) + strlen(pServerName) + 1; + char *pNewList = nListLen ? (char *) XP_ALLOC(nListLen) : 0; + if (pNewList) + { + XP_STRCAT(pNewList, ","); + XP_STRCAT(pNewList, pServerName); + PREF_SetCharPref("network.hosts.imap_servers", pNewList); + XP_FREE(pNewList); + } + XP_FREE(pServerList); + } + else + PREF_SetCharPref("network.hosts.imap_servers", pServerName); + +} + #ifdef _WIN32 ///////////////////////////////////////////////////////////////////////////// // CCoverPage @@ -205,31 +263,41 @@ BOOL CReceiveMailPage::OnInitDialog() char buffer[256]; int nLen = 255; - if (PREF_NOERROR == PREF_GetCharPref("mail.pop_name", buffer, &nLen)) - SetDlgItemText(IDC_EDIT_USER_NAME, buffer); - if (PREF_NOERROR == PREF_GetCharPref("network.hosts.pop_server", buffer, &nLen)) - { - int nameLen = strlen(buffer); - if (nameLen) - SetDlgItemText(IDC_EDIT_MAIL_SERVER, buffer); - else + long prefLong = MSG_Pop3; + PREF_GetIntPref("mail.server_type",&prefLong); + if (prefLong == MSG_Imap4) + { // imap server + CheckDlgButton(IDC_RADIO_IMAP, TRUE); + + char serverName[128]; + GetImapServerName(serverName); + + if (strlen(serverName) > 0) { - if (PREF_NOERROR == PREF_GetCharPref("network.hosts.smtp_server", buffer, &nLen)) - SetDlgItemText(IDC_EDIT_MAIL_SERVER, buffer); + char userName[128]; + SetDlgItemText(IDC_EDIT_MAIL_SERVER, serverName); + GetImapUserName(serverName, userName); + if (strlen(userName) > 0) + SetDlgItemText(IDC_EDIT_USER_NAME, userName); } } else + { // pop server + CheckDlgButton(IDC_RADIO_POP, TRUE); + if (PREF_NOERROR == PREF_GetCharPref("mail.pop_name", buffer, &nLen)) + SetDlgItemText(IDC_EDIT_USER_NAME, buffer); + if (PREF_NOERROR == PREF_GetCharPref("network.hosts.pop_server", buffer, &nLen)) + { + int nameLen = strlen(buffer); + if (nameLen) + SetDlgItemText(IDC_EDIT_MAIL_SERVER, buffer); + } + } + if (!GetDlgItemText(IDC_EDIT_MAIL_SERVER, buffer, 255)) { if (PREF_NOERROR == PREF_GetCharPref("network.hosts.smtp_server", buffer, &nLen)) SetDlgItemText(IDC_EDIT_MAIL_SERVER, buffer); } - - long prefLong = MSG_Pop3; - PREF_GetIntPref("mail.server_type",&prefLong); - if (prefLong == MSG_Imap4) - CheckDlgButton(IDC_RADIO_IMAP, TRUE); - else - CheckDlgButton(IDC_RADIO_POP, TRUE); return ret; } @@ -281,9 +349,30 @@ void CReceiveMailPage::DoFinish() PREF_SetCharPref("network.hosts.pop_server", text); if (IsDlgButtonChecked(IDC_RADIO_IMAP)) + { // IMAP server PREF_SetIntPref("mail.server_type", (int32)MSG_Imap4); + + char server[BUFSZ]; + server[0] = '\0'; + GetDlgItemText(IDC_EDIT_MAIL_SERVER, server, BUFSZ); + SetImapServerName(server); + + text[0] = '\0'; + GetDlgItemText(IDC_EDIT_USER_NAME, text, BUFSZ); + IMAP_SetCharPref(server, CHAR_USERNAME, text); + + } else + { // pop server PREF_SetIntPref("mail.server_type", (int32)MSG_Pop3); + + GetDlgItemText(IDC_EDIT_USER_NAME, text, BUFSZ); + PREF_SetCharPref("mail.pop_name", text); + + text[0] = '\0'; + GetDlgItemText(IDC_EDIT_MAIL_SERVER, text, BUFSZ); + PREF_SetCharPref("network.hosts.pop_server", text); + } } void CReceiveMailPage::DoDataExchange(CDataExchange* pDX) @@ -558,10 +647,33 @@ CMailNewsWizard::CMailNewsWizard(CWnd *pParent) long prefLong = MSG_Pop3; PREF_GetIntPref("mail.server_type",&prefLong); - if (prefLong == MSG_Imap4) - m_bUseIMAP = TRUE; + m_bUseIMAP = prefLong == MSG_Imap4; + + if (m_bUseIMAP) + { + char serverName[128]; + GetImapServerName(serverName); + m_szPopName = serverName; + if (strlen(serverName) > 0) + { + char userName[128]; + GetImapUserName(serverName, userName); + if (strlen(userName) > 0) + m_szInMailServer = userName; + } + } else - m_bUseIMAP = FALSE; + { //POP server + pPrefStr = NULL; + PREF_CopyCharPref("mail.pop_name", &pPrefStr); + m_szPopName = pPrefStr; + if (pPrefStr) XP_FREE(pPrefStr); + + pPrefStr = NULL; + PREF_CopyCharPref("network.hosts.pop_server", &pPrefStr); + m_szInMailServer = pPrefStr; + if (pPrefStr) XP_FREE(pPrefStr); + } pPrefStr = NULL; PREF_CopyCharPref("network.hosts.nntp_server", &pPrefStr); @@ -915,11 +1027,18 @@ BOOL CMailNewsWizard::DoFinish() PREF_SetCharPref("mail.identity.useremail", LPCTSTR(m_szEmail)); PREF_SetCharPref("network.hosts.smtp_server", LPCTSTR(m_szMailServer)); - PREF_SetCharPref("mail.pop_name", LPCTSTR(m_szPopName)); - PREF_SetCharPref("network.hosts.pop_server", LPCTSTR(m_szInMailServer)); - long imapPref = m_bUseIMAP ? MSG_Imap4 : MSG_Pop3; PREF_SetIntPref("mail.server_type", imapPref); + if (m_bUseIMAP) + { + SetImapServerName(LPCTSTR(m_szInMailServer)); + IMAP_SetCharPref(LPCTSTR(m_szInMailServer), CHAR_USERNAME, LPCTSTR(m_szPopName)); + } + else + { + PREF_SetCharPref("mail.pop_name", LPCTSTR(m_szPopName)); + PREF_SetCharPref("network.hosts.pop_server", LPCTSTR(m_szInMailServer)); + } PREF_SetCharPref("network.hosts.nntp_server", LPCTSTR(m_szNewsServer)); diff --git a/mozilla/cmd/winfe/mozilla.cpp b/mozilla/cmd/winfe/mozilla.cpp index 48478279387..5143cc47cb6 100644 --- a/mozilla/cmd/winfe/mozilla.cpp +++ b/mozilla/cmd/winfe/mozilla.cpp @@ -109,6 +109,15 @@ BOOL bIsGold = FALSE; void WFE_LJ_StartDebugger(void); #endif +#ifdef NEW_PREF_ARCH +#include "cprofile.h" +#include "cprofmgr.h" + +extern int login_NewProfilePreInit(); +extern int login_NewProfilePostInit(CProfile *pProfile); + +#endif + #ifdef _DEBUG #undef THIS_FILE static char BASED_CODE THIS_FILE[] = __FILE__; @@ -122,6 +131,8 @@ static char BASED_CODE THIS_FILE[] = __FILE__; #define _mkdir mkdir #endif +extern "C" void WFE_StartCalendar(); + extern "C" { NET_StreamClass *memory_stream(int iFormatOut, void *pDataObj, URL_Struct *pUrlData, MWContext *pContext); NET_StreamClass *external_viewer_disk_stream(int iFormatOut, void *pDataObj, URL_Struct *pUrlData, MWContext *pContext); @@ -653,8 +664,14 @@ BOOL CNetscapeApp::InitInstance() JSContext * prefContext=NULL; JSObject *prefObject=NULL; +#ifdef NEW_PREF_ARCH + CProfile *profile = NULL; + CProfileManager *profMgr; + profile = (CProfile *) PREF_Init(); +#else PREF_Init(NULL); + // Read network and cache parameters PREF_GetConfigContext(&prefContext); @@ -663,6 +680,7 @@ BOOL CNetscapeApp::InitInstance() if (!pref_InitInitialObjects(prefContext,prefObject)) return FALSE; +#endif SECNAV_InitConfigObject(); @@ -778,6 +796,150 @@ BOOL CNetscapeApp::InitInstance() // init parts of security for li SECNAV_EarlyInit(); +#ifdef NEW_PREF_ARCH + // After the new preferences architecture lands from the Nova branch, enable + // this #define + + + // Get the main NSPR event queue + mozilla_event_queue = PR_GetMainEventQueue(); + + LM_InitMocha(); + + // Register all XP content type converters and stream decoders. + // We can overwrite these settings if we have other settings ourselves. + NET_RegisterMIMEDecoders(); + + // Do PE precleanup and such + login_NewProfilePreInit(); + + // Read network and cache parameters + + PREF_GetConfigContext(&prefContext); + PREF_GetPrefConfigObject(&prefObject); + if (!(prefContext && prefObject)) return FALSE; + + if (!pref_InitInitialObjects(prefContext,prefObject)) + return FALSE; + + profile->LoadPrefs("netscape.cfg"); + profMgr = new CProfileManager(profile); + + int profErr = PREF_OK; + + if (m_bAccountSetup) { + // FIXME! This isn't permanent! +// profMgr->CreateNewDialupAcct(); + profErr = login_QueryForCurrentProfile(); + } else if (m_bCreateNewProfile) { + if (theApp.m_bPEEnabled) { + profErr = login_QueryForCurrentProfile(); + // FIXME! This isn't permanent! +// profMgr->CreateNewDialupAcct(); + } else { + profErr = profMgr->DoNewProfileWizard(PROFMGR_DEFAULT); + } + } else if (m_bProfileManager) { + profErr = profMgr->ChooseProfile(PROFMGR_FORCE_SHOW | PROFMGR_SHOW_CONTROLS, m_CmdLineProfile); + } else if (m_CmdLineProfile != NULL) { + profErr = profMgr->GetProfileFromName(m_CmdLineProfile); + } else { + if (theApp.m_bPEEnabled) { + profErr = profMgr->ChooseProfile(PROFMGR_USE_DIALUP); + } else { + profErr = profMgr->ChooseProfile(PROFMGR_DEFAULT); + } + } + + if (profErr != PREF_OK) { + return FALSE; + } + + { + char userDir[FILENAME_MAX + 1]; + int nameLength = FILENAME_MAX; + + profile->GetCharPref("profile.directory", userDir, &nameLength, PR_TRUE); + theApp.m_UserDirectory = userDir; + } + + profile->LoadPrefs(); + + // do this font init here for now for ldap + m_iCSID = (int16)2; + INTL_ChangeDefaultCharSetID((int16)m_iCSID); +#ifdef XP_WIN32 + theApp.m_bUseUnicodeFont = GetProfileInt("Intl", "UseUnicodeFont", TRUE ) ; + theApp.m_bUseVirtualFont = GetProfileInt("Intl", "UseVirtualFont", FALSE); + if(! theApp.m_bUseUnicodeFont ) { + theApp.m_bUseVirtualFont = TRUE; + } +#else + theApp.m_bUseUnicodeFont = FALSE ; + theApp.m_bUseVirtualFont = TRUE; +#endif + + STARTUP_cvffc(); + + // Set version and application names + // We have to get around it's const status. + XP_AppName = XP_STRDUP(szLoadString(IDS_APP_NAME)); + XP_AppLanguage = XP_STRDUP(szLoadString(IDS_APP_LANGUAGE)); + XP_AppCodeName = XP_STRDUP(szLoadString(IDS_APP_CODE_NAME)); + XP_AppVersion = XP_STRDUP(ResolveShortAppVersion()); + + // Create our hidden frame window. + // Set this to be the applications main window. + m_pHiddenFrame = new CHiddenFrame(); +#ifdef _WIN32 + { + WNDCLASS wc; + wc.style = 0; + wc.lpfnWndProc = ::DefWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = sizeof(DWORD); // this is used by java's setAgentPassword + wc.hInstance = ::AfxGetInstanceHandle(); + wc.hIcon = NULL; + wc.hCursor = ::LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); + wc.lpszMenuName = (LPCSTR) NULL; + wc.lpszClassName = "aHiddenFrameClass"; + ATOM result = ::RegisterClass(&wc); + ASSERT(result != 0); + m_pHiddenFrame->Create(wc.lpszClassName, "Netscape's Hidden Frame"); + } +#else + m_pHiddenFrame->Create(NULL, "Netscape's Hidden Frame"); +#endif + m_pMainWnd = m_pHiddenFrame; + m_pHiddenFrame->ShowWindow(SW_HIDE); + + do { + profErr = login_NewProfilePostInit(profile); + + if (profErr == -1) { + profErr = profMgr->PromptPassword(); + if (profErr == PREF_OK) { + profErr = -1; + } + } + } while (profErr == -1); + + if (profErr < PREF_OK) { + return FALSE; + } + + int32 csid ; + if( PREF_GetIntPref("intl.character_set",&csid) != PREF_NOERROR) + csid = 2; + + m_iCSID = (int16)csid; + +//#ifdef MOZ_NETSCAPE_FONT_MODULE + VERIFY( FONTERR_OK == theGlobalNSFont.InitFontModule() ); +//#endif MOZ_NETSCAPE_FONT_MODULE + +#else // NEW_PREF_ARCH // Create our hidden frame window. // Set this to be the applications main window. m_pHiddenFrame = new CHiddenFrame(); @@ -835,8 +997,6 @@ BOOL CNetscapeApp::InitInstance() theApp.m_bUseVirtualFont = TRUE; #endif - m_pIntlFont = new CIntlFont; - int32 csid ; if( PREF_GetIntPref("intl.character_set",&csid) != PREF_NOERROR) csid = 2; @@ -863,6 +1023,11 @@ BOOL CNetscapeApp::InitInstance() if (!login_QueryForCurrentProfile()) return FALSE; +#endif // NEW_PREF_ARCH + + // Read in font and setup encoding table stuff (must be done after prefs are read) + m_pIntlFont = new CIntlFont; + // SECNAV_INIT requires AppCodeName and the first substring in AppVersion SECNAV_Init(); @@ -884,8 +1049,10 @@ BOOL CNetscapeApp::InitInstance() if(!bAlreadyRunning) { #endif +#ifdef MOZ_OFFLINE extern void AskMeDlg(void); - AskMeDlg(); + AskMeDlg(); +#endif /* MOZ_OFFLINE */ #ifdef XP_WIN32 } #endif @@ -1312,6 +1479,10 @@ BOOL CNetscapeApp::InitInstance() PREF_SetCharPref("browser.bookmark_location",msg); } +#ifdef MOZ_OFFLINE + m_bSynchronizingExit = FALSE; + m_bSynchronizing = FALSE; +#endif/* MOZ_OFFLINE */ // Get LDAP servers filename #ifdef MOZ_LDAP @@ -1323,7 +1494,6 @@ BOOL CNetscapeApp::InitInstance() PREF_CopyCharPref("browser.ldapfile_location",&ldapFile); // Initialize the directories and PAB -// msg = m_UserDirectory; msg = "abook.nab"; PREF_SetDefaultCharPref("browser.addressbook_location",msg); @@ -1406,7 +1576,7 @@ BOOL CNetscapeApp::InitInstance() } else { - DIR_GetServerPreferences (&m_directories, msg); + m_directories = DIR_GetDirServers(); char * ldapPref = PR_smprintf("ldap_%d.end_of_directories", kCurrentListVersion); if (ldapPref) PREF_RegisterCallback(ldapPref, DirServerListChanged, NULL); @@ -1511,7 +1681,7 @@ BOOL CNetscapeApp::InitInstance() if(m_bAutomated == FALSE && m_bEmbedded == FALSE && csPrintCommand.IsEmpty()) { - int iStartupMode=0; + long iStartupMode=0; PRBool bStartMode = FALSE; PREF_GetBoolPref("general.startup.browser", &bStartMode); @@ -1522,6 +1692,10 @@ BOOL CNetscapeApp::InitInstance() if (bStartMode) iStartupMode |= STARTUP_MAIL; + PREF_GetBoolPref("general.startup.calendar", &bStartMode); + if (bStartMode) + iStartupMode |= STARTUP_CALENDAR; + PREF_GetBoolPref("general.startup.news", &bStartMode); if (bStartMode) iStartupMode |= STARTUP_NEWS; @@ -1631,12 +1805,18 @@ BOOL CNetscapeApp::InitInstance() m_CmdLineLoadURL = NULL; break; } + + case STARTUP_CALENDAR: + WFE_StartCalendar(); + break; + #ifdef MOZ_MAIL_NEWS case STARTUP_INBOX: WFE_MSGOpenInbox(); //opens the inbox folder with the split pain view. break; case STARTUP_CLIENT_MAPI: // rhp - for MAPI Startup + case STARTUP_CLIENT_ABAPI: // rhp - for Address Book API { CGenericDoc *pDoc = (CGenericDoc *)theApp.m_ViewTmplate->OpenDocumentFile(NULL, FALSE); if (pDoc) @@ -1648,9 +1828,17 @@ BOOL CNetscapeApp::InitInstance() if (pFrameWnd) { extern void StoreMAPIFrameWnd(CFrameWnd *pFrameWnd); + extern void StoreNABFrameWnd(CFrameWnd *pFrameWnd); pFrameWnd->ShowWindow(SW_SHOWMINIMIZED); - StoreMAPIFrameWnd(pFrameWnd); + if (iStartupMode == STARTUP_CLIENT_MAPI) + { + StoreMAPIFrameWnd(pFrameWnd); + } + else + { + StoreNABFrameWnd(pFrameWnd); + } } } } @@ -1852,10 +2040,19 @@ BOOL CNetscapeApp::InitInstance() } //fall through here and launch browser if necessary +#ifdef MOZ_MAIL_NEWS + if ((iStartupMode & STARTUP_BROWSER || iStartupMode & STARTUP_EDITOR || // if startup browser or editor + !(iStartupMode & (STARTUP_BROWSER|STARTUP_CALENDAR|STARTUP_MAIL|STARTUP_ADDRESS + |STARTUP_INBOX|STARTUP_COMPOSE|STARTUP_FOLDER|STARTUP_FOLDERS|STARTUP_NETCASTER + |STARTUP_CLIENT_MAPI|STARTUP_CLIENT_ABAPI)) || // or invalid data + m_bKioskMode )) { // or kiosk mode - start browser +#else if ((iStartupMode & STARTUP_BROWSER || iStartupMode & STARTUP_EDITOR || // if startup browser or editor !(iStartupMode & (STARTUP_BROWSER|STARTUP_NEWS|STARTUP_MAIL|STARTUP_ADDRESS - |STARTUP_INBOX|STARTUP_COMPOSE|STARTUP_FOLDER|STARTUP_FOLDERS|STARTUP_NETCASTER)) || // or invalid data + |STARTUP_INBOX|STARTUP_COMPOSE|STARTUP_FOLDER|STARTUP_FOLDERS|STARTUP_NETCASTER|STARTUP_CALENDAR)) || // or invalid data m_bKioskMode )) { // or kiosk mode - start browser +#endif /* MOZ_MAIL_NEWS */ + #ifdef EDITOR if ( (bIsGold && (iStartupMode & STARTUP_EDITOR)) && !(iStartupMode & STARTUP_BROWSER)) { //start the editor @@ -2025,9 +2222,6 @@ int CNetscapeApp::ExitInstance() // Shutdown RDF RDF_Shutdown(); -#ifdef MOZ_LOC_INDEP - SHUTDOWN_li(); -#endif /* MOZ_LOC_INDEP */ SHUTDOWN_np(); // Unload any remaining images. @@ -2053,9 +2247,6 @@ int CNetscapeApp::ExitInstance() fe_CleanupFileFormatTypes(); PREF_SavePrefFile(); - char * prefName = WH_FileName(NULL, xpLIPrefs); - PREF_SaveLIPrefFile(prefName); - XP_FREEIF (prefName); NR_ShutdownRegistry(); #ifdef MOZ_SMARTUPDATE SU_Shutdown(); @@ -2080,7 +2271,7 @@ int CNetscapeApp::ExitInstance() #ifdef MOZ_MAIL_NEWS if (m_pABook) - AB_CloseAddressBook(&m_pABook); + AB_CloseAddressBook(&m_pABook); WFE_MSGShutdown(); #endif /* MOZ_MAIL_NEWS */ diff --git a/mozilla/cmd/winfe/mozilla.h b/mozilla/cmd/winfe/mozilla.h index cf4b016914e..fc4142b77db 100644 --- a/mozilla/cmd/winfe/mozilla.h +++ b/mozilla/cmd/winfe/mozilla.h @@ -58,13 +58,13 @@ extern int winfeInProcessNet; #define STARTUP_NEWS 0x4 #define STARTUP_EDITOR 0x8 -#define STARTUP_MAIL_NEWS (STARTUP_MAIL | STARTUP_NEWS) +#define STARTUP_MAIL_NEWS (STARTUP_MAIL | STARTUP_NEWS) #define STARTUP_MAIL_BROWSER (STARTUP_MAIL | STARTUP_BROWSER) #define STARTUP_NEWS_BROWSER (STARTUP_NEWS | STARTUP_BROWSER) #define STARTUP_MAIL_NEWS_BROWSER (STARTUP_MAIL | STARTUP_NEWS | STARTUP_BROWSER) -#define STARTUP_MAIL_EDITOR (STARTUP_MAIL | STARTUP_EDITOR) -#define STARTUP_NEWS_EDITOR (STARTUP_NEWS | STARTUP_EDITOR) -#define STARTUP_BROWSER_EDITOR (STARTUP_BROWSER | STARTUP_EDITOR) +#define STARTUP_MAIL_EDITOR (STARTUP_MAIL | STARTUP_EDITOR) +#define STARTUP_NEWS_EDITOR (STARTUP_NEWS | STARTUP_EDITOR) +#define STARTUP_BROWSER_EDITOR (STARTUP_BROWSER | STARTUP_EDITOR) #define STARTUP_MAIL_NEWS_EDITOR (STARTUP_MAIL | STARTUP_NEWS | STARTUP_EDITOR) #define STARTUP_MAIL_BROWSER_EDITOR (STARTUP_MAIL | STARTUP_BROWSER | STARTUP_EDITOR) #define STARTUP_NEWS_BROWSER_EDITOR (STARTUP_NEWS | STARTUP_BROWSER | STARTUP_EDITOR) @@ -72,7 +72,6 @@ extern int winfeInProcessNet; // component launch states #define STARTUP_INBOX 0x10 #define STARTUP_FOLDER 0x20 -#define STARTUP_CLIENT_MAPI 0x30 // rhp - DOES THIS WORK - will it break other startups??? #define STARTUP_FOLDERS 0x40 #define STARTUP_ADDRESS 0x80 #define STARTUP_COMPOSE 0x100 @@ -82,9 +81,11 @@ extern int winfeInProcessNet; #define STARTUP_ACCOUNT_SETUP 0x800 #define STARTUP_JAVA_DEBUG_AGENT 0x1000 #define STARTUP_JAVA 0x1200 +#define STARTUP_NETHELP 0x2000 #define STARTUP_CALENDAR 0x4000 #define STARTUP_CONFERENCE 0x8000 -#define STARTUP_NETHELP 0x2000 +#define STARTUP_CLIENT_MAPI 0x10000 // rhp - DOES THIS WORK - will it break other startups??? +#define STARTUP_CLIENT_ABAPI 0x20000 // rhp - for use with Address Book API // max list of things in the menu #define MAX_HISTORY_ITEMS (LAST_HISTORY_MENU_ID-FIRST_HISTORY_MENU_ID) @@ -279,10 +280,6 @@ public: public: int Run(); BOOL NSPumpMessage(); -#ifdef MOZ_LOC_INDEP - /* location independence exit code */ - BOOL LIStuffEnd(); -#endif /* MOZ_LOC_INDEP */ BOOL IsIdleMessage(MSG *pMsg); BOOL OnIdle(LONG lIdleCount); #ifdef XP_WIN16 @@ -419,6 +416,11 @@ public: // Appearance of toolbars/component bars int m_pToolbarStyle; +#ifdef MOZ_OFFLINE + BOOL m_bSynchronizingExit; //Are we currently synchronizing on exiting + BOOL m_bSynchronizing; //Are we currently synchronizing +#endif /* MOZ_OFFLINE */ + // preference type stuff int m_nConfig; int m_iNumTypesInINIFile; @@ -437,6 +439,7 @@ public: BOOL m_bCreateMail; #endif /* MOZ_MAIL_NEWS */ BOOL m_bCreateNetcaster; + BOOL m_bCreateCalendar; #ifdef EDITOR // "-EDIT" or "/EDIT" on command line causes us to start editor BOOL m_bCmdEdit; @@ -444,7 +447,8 @@ public: #ifdef MOZ_MAIL_NEWS //component launch flags BOOL m_bCreateInbox; //causes the inbox to be started - BOOL m_bCreateInboxMAPI; // start inbox minimized! + BOOL m_bCreateInboxMAPI;// start inbox minimized! + BOOL m_bCreateNABWin; // rhp - for Address Book API BOOL m_bCreateFolders; //causes the folders frame window to be started BOOL m_bCreateFolder; //causes a particular folder in the folders frame window to open BOOL m_bCreateCompose; //causes the compose window to be opened, 3 different possibilities @@ -537,7 +541,7 @@ public: BOOL ParseComponentArguments(char *pszCommandLine, BOOL bRemove); BOOL ExistComponentArguments(char *pszCommandLine); void LaunchComponentWindow(int iStartupMode, char *pszCmdLine); - void SetStartupMode(int *iStartupMode); + void SetStartupMode(int32 *iStartupMode); void BuildStubFile();//Sets the m_strStubFile member CString BuildDDEFile();//Returns a CString type to a random file name @@ -583,6 +587,14 @@ public: CString m_csPEPage; // Don't use this if one-time homepage happens void CommonAppExit(); +#ifdef MOZ_OFFLINE + void HideFrames(); + BOOL CanCloseAllFrames(); +#endif /*MOZ_OFFLINE */ + +#ifdef MOZ_MAIL_NEWS + BOOL m_bReverseSenseOfHtmlCompose; +#endif /*MOZ_MAIL_NEWS */ inline BOOL showSplashScreen(const CString &csPrintCommand); @@ -600,7 +612,7 @@ public: BOOL CNetscapeApp::showSplashScreen(const CString &csPrintCommand) { #ifdef MOZ_MAIL_NEWS - return (!(m_bEmbedded || m_bAutomated || m_bCreateInboxMAPI) && csPrintCommand.IsEmpty()); + return (!(m_bEmbedded || m_bAutomated || m_bCreateInboxMAPI || m_bCreateNABWin) && csPrintCommand.IsEmpty()); #else return (!(m_bEmbedded || m_bAutomated) && csPrintCommand.IsEmpty()); #endif diff --git a/mozilla/cmd/winfe/mozilla.rc b/mozilla/cmd/winfe/mozilla.rc index 8fb323044b7..8eca3443ada 100644 --- a/mozilla/cmd/winfe/mozilla.rc +++ b/mozilla/cmd/winfe/mozilla.rc @@ -147,6 +147,9 @@ IDB_BUTTON_FOLDER BITMAP DISCARDABLE "res\\button_f.bmp" IDB_BACK BITMAP DISCARDABLE "res\\msgback.bmp" IDB_USERBTN BITMAP DISCARDABLE "res\\defuser.bmp" IDB_SECURE_STATUS BITMAP DISCARDABLE "res\\ssecure.bmp" +#if defined(MOZ_OFFLINE) +IDB_OFFLINE_STATUS BITMAP DISCARDABLE "res\\offline.bmp" +#endif LANGDOWND BITMAP DISCARDABLE "RES\\DOWND.BMP" IDB_NAV_BAR BITMAP DISCARDABLE "res\\hdrgbar.bmp" IDB_NAV_BAR1 BITMAP DISCARDABLE "res\\vdrgbar.bmp" @@ -185,9 +188,11 @@ BEGIN "G", ID_EDIT_FINDAGAIN, VIRTKEY, CONTROL, NOINVERT "H", ID_GO_HISTORY, VIRTKEY, CONTROL, NOINVERT "I", ID_FILE_DOCINFO, VIRTKEY, CONTROL, NOINVERT +#ifdef MOZ_SECURITY "I", ID_SECURITY, VIRTKEY, SHIFT, CONTROL, NOINVERT - "M", ID_FILE_MAILNEW, VIRTKEY, CONTROL, NOINVERT +#endif + "M", ID_FILE_MAILNEW, VIRTKEY, CONTROL, NOINVERT "N", ID_NEW_FRAME, VIRTKEY, CONTROL, NOINVERT "N", ID_EDT_NEW_DOC_BLANK, VIRTKEY, SHIFT, CONTROL, NOINVERT @@ -281,9 +286,11 @@ BEGIN "F", ID_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT "G", ID_EDIT_FINDAGAIN, VIRTKEY, CONTROL, NOINVERT "H", ID_GO_HISTORY, VIRTKEY, CONTROL, NOINVERT +#ifdef MOZ_SECURITY "I", ID_SECURITY, VIRTKEY, SHIFT, CONTROL, NOINVERT - "M", ID_FILE_MAILNEW, VIRTKEY, CONTROL, NOINVERT +#endif + "M", ID_FILE_MAILNEW, VIRTKEY, CONTROL, NOINVERT "N", ID_NEW_FRAME, VIRTKEY, CONTROL, NOINVERT "N", ID_EDT_NEW_DOC_BLANK, VIRTKEY, SHIFT, CONTROL, NOINVERT @@ -315,8 +322,10 @@ BEGIN "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT "E", ID_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT "F", ID_EDIT_SEARCH, VIRTKEY, CONTROL, NOINVERT +#ifdef MOZ_SECURITY "I", ID_SECURITY, VIRTKEY, SHIFT, CONTROL, NOINVERT +#endif "S", ID_FILE_SAVEAS, VIRTKEY, CONTROL, NOINVERT VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT VK_BACK, ID_EDIT_REDO, VIRTKEY, SHIFT, ALT, NOINVERT @@ -747,149 +756,149 @@ BEGIN LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP END -IDD_SEARCH DIALOG DISCARDABLE 0, 0, 324, 140 +IDD_SEARCH DIALOG DISCARDABLE 0, 0, 294, 166 STYLE WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN FONT 8, "MS Sans Serif" BEGIN - COMBOBOX IDC_COMBO_SCOPE,71,6,173,61,CBS_DROPDOWNLIST | + LTEXT "Search for items in:",IDC_STATIC,7,7,61,8 + COMBOBOX IDC_COMBO_SCOPE,7,18,173,235,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_AND_OR,10,26,155,45,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_ATTRIB1,45,45,67,60,CBS_DROPDOWNLIST | + CONTROL "Match an&y of the following",IDC_RADIO_ANY,"Button", + BS_AUTORADIOBUTTON,7,53,99,10 + CONTROL "Match al&l of the following",IDC_RADIO_ALL,"Button", + BS_AUTORADIOBUTTON,115,53,94,10 + COMBOBOX IDC_COMBO_ATTRIB1,7,70,65,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP1,116,45,75,60,CBS_DROPDOWNLIST | WS_VSCROLL | + COMBOBOX IDC_COMBO_OP1,74,70,65,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE1,195,45,64,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB2,45,60,67,57,CBS_DROPDOWNLIST | + EDITTEXT IDC_EDIT_VALUE1,141,70,86,12,ES_AUTOHSCROLL + COMBOBOX IDC_COMBO_ATTRIB2,7,84,65,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP2,116,60,75,63,CBS_DROPDOWNLIST | WS_VSCROLL | + COMBOBOX IDC_COMBO_OP2,74,84,65,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE2,195,60,64,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB3,45,75,67,60,CBS_DROPDOWNLIST | + EDITTEXT IDC_EDIT_VALUE2,141,84,86,12,ES_AUTOHSCROLL + COMBOBOX IDC_COMBO_ATTRIB3,7,98,65,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP3,116,75,75,60,CBS_DROPDOWNLIST | WS_VSCROLL | + COMBOBOX IDC_COMBO_OP3,74,98,65,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE3,195,75,64,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB4,45,90,67,60,CBS_DROPDOWNLIST | + EDITTEXT IDC_EDIT_VALUE3,141,98,86,12,ES_AUTOHSCROLL + COMBOBOX IDC_COMBO_ATTRIB4,7,112,65,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP4,116,90,75,60,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE4,195,90,64,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB5,45,105,67,60,CBS_DROPDOWNLIST | + COMBOBOX IDC_COMBO_OP4,74,112,65,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP5,116,105,75,60,CBS_DROPDOWNLIST | + EDITTEXT IDC_EDIT_VALUE4,141,112,86,12,ES_AUTOHSCROLL + COMBOBOX IDC_COMBO_ATTRIB5,7,126,65,100,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_EDIT_VALUE5,141,126,86,12,ES_AUTOHSCROLL + PUSHBUTTON "&More",IDC_MORE,7,145,35,14 + PUSHBUTTON "&Fewer",IDC_FEWER,45,145,35,14 + DEFPUSHBUTTON "&Search",IDC_FIND,237,7,50,14 + PUSHBUTTON "&Clear Search",IDC_NEW,237,24,50,14 + PUSHBUTTON "&Options...",IDC_ADVANCED_OPTIONS,237,42,50,14 + PUSHBUTTON "Save &As...",IDC_SAVE,237,60,50,14 + PUSHBUTTON "&Help",IDC_SEARCHHELP,237,78,50,14 + COMBOBOX IDC_COMBO_OP5,74,126,65,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE5,195,105,64,12,ES_AUTOHSCROLL - PUSHBUTTON "&More",IDC_MORE,45,121,29,13 - PUSHBUTTON "&Fewer",IDC_FEWER,82,121,29,13 - DEFPUSHBUTTON "&Search",IDC_FIND,267,6,47,12 - PUSHBUTTON "&Clear Search",IDC_NEW,196,121,48,13 - PUSHBUTTON "Save &As...",IDC_SAVE,267,36,48,12 - RTEXT "Search for items in",IDC_STATIC,6,9,62,9 - RTEXT "the",IDC_STATIC_THE1,30,48,11,8 - PUSHBUTTON "&Help",IDC_SEARCHHELP,267,51,48,12 - RTEXT "the",IDC_STATIC_THE2,13,62,28,9 - RTEXT "the",IDC_STATIC_THE3,13,77,28,9 - RTEXT "the",IDC_STATIC_THE4,13,89,28,9 - RTEXT "the",IDC_STATIC_THE5,13,103,28,9 - PUSHBUTTON "&Options...",IDC_ADVANCED_SEARCH,267,21,48,12 END -IDD_MAILFILTER DIALOG DISCARDABLE 0, 0, 376, 207 +IDD_MAILFILTER DIALOG DISCARDABLE 0, 0, 376, 225 STYLE DS_MODALFRAME | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION CAPTION "Filter Rules" FONT 8, "MS Sans Serif" BEGIN - EDITTEXT IDC_EDIT_NAME,50,7,83,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_AND_OR,50,25,130,45,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_ATTRIB1,50,43,73,60,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP1,183,43,72,60,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE1,256,43,107,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB2,50,57,73,59,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP2,183,57,72,59,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE2,256,57,107,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB3,50,71,73,60,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP3,183,71,72,60,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE3,256,71,107,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB4,50,85,73,60,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP4,183,85,72,60,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE4,256,85,107,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB5,50,99,73,60,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP5,183,99,72,60,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE5,256,99,107,12,ES_AUTOHSCROLL - PUSHBUTTON "More",IDC_MORE,50,115,30,14 - PUSHBUTTON "Fewer",IDC_FEWER,93,115,30,14 - COMBOBOX IDC_COMBO_ACTION,50,132,96,60,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_DEST,150,132,162,60,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_DESC,49,152,314,27,ES_AUTOHSCROLL - CONTROL "Off",IDC_RADIO_OFF,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,51,188,24,10 - CONTROL "On",IDC_RADIO_ON,"Button",BS_AUTORADIOBUTTON,76,188,25, - 10 - DEFPUSHBUTTON "OK",IDOK,206,184,50,14,WS_GROUP - PUSHBUTTON "Cancel",IDCANCEL,259,184,50,14 RTEXT "Filter name:",IDC_STATIC,7,9,39,10 - RTEXT "the",IDC_STATIC_THE1,7,45,39,8 + EDITTEXT IDC_EDIT_NAME,50,7,135,12,ES_AUTOHSCROLL + CONTROL "Match an&y of the following",IDC_RADIO_ANY,"Button", + BS_AUTORADIOBUTTON,50,37,99,10 + CONTROL "Match al&l of the following",IDC_RADIO_ALL,"Button", + BS_AUTORADIOBUTTON,158,37,94,10 + PUSHBUTTON "&Advanced...",IDC_ADVANCED_OPTIONS,319,7,50,14 + RTEXT "the",IDC_STATIC_THE1,7,55,39,8 + COMBOBOX IDC_COMBO_ATTRIB1,50,53,73,100,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP CONTROL "of the message",IDC_STATIC_OF1,"Static", - SS_LEFTNOWORDWRAP | WS_GROUP,128,46,51,8 - RTEXT "the",IDC_STATIC_THE2,7,59,39,8 + SS_LEFTNOWORDWRAP | WS_GROUP,128,56,51,8 + COMBOBOX IDC_COMBO_OP1,183,53,72,100,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_EDIT_VALUE1,256,53,113,12,ES_AUTOHSCROLL + RTEXT "the",IDC_STATIC_THE2,7,69,39,8 + COMBOBOX IDC_COMBO_ATTRIB2,50,67,73,100,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP CONTROL "of the message",IDC_STATIC_OF2,"Static", - SS_LEFTNOWORDWRAP | WS_GROUP,128,60,51,8 - RTEXT "the",IDC_STATIC_THE3,7,73,39,8 + SS_LEFTNOWORDWRAP | WS_GROUP,128,70,51,8 + COMBOBOX IDC_COMBO_OP2,183,67,72,100,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_EDIT_VALUE2,256,67,113,12,ES_AUTOHSCROLL + RTEXT "the",IDC_STATIC_THE3,7,83,39,8 + COMBOBOX IDC_COMBO_ATTRIB3,50,81,73,100,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP CONTROL "of the message",IDC_STATIC_OF3,"Static", - SS_LEFTNOWORDWRAP | WS_GROUP,128,74,51,8 - RTEXT "the",IDC_STATIC_THE4,7,87,39,8 + SS_LEFTNOWORDWRAP | WS_GROUP,128,84,51,8 + COMBOBOX IDC_COMBO_OP3,183,81,72,100,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_EDIT_VALUE3,256,81,113,12,ES_AUTOHSCROLL + RTEXT "the",IDC_STATIC_THE4,7,97,39,8 + COMBOBOX IDC_COMBO_ATTRIB4,50,95,73,100,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP CONTROL "of the message",IDC_STATIC_OF4,"Static", - SS_LEFTNOWORDWRAP | WS_GROUP,128,88,51,8 - RTEXT "the",IDC_STATIC_THE5,7,102,39,8 + SS_LEFTNOWORDWRAP | WS_GROUP,128,98,51,8 + COMBOBOX IDC_COMBO_OP4,183,95,72,100,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_EDIT_VALUE4,256,95,113,12,ES_AUTOHSCROLL + RTEXT "the",IDC_STATIC_THE5,7,112,39,8 + COMBOBOX IDC_COMBO_ATTRIB5,50,109,73,101,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP CONTROL "of the message",IDC_STATIC_OF5,"Static", - SS_LEFTNOWORDWRAP | WS_GROUP,128,102,51,8 - RTEXT "then",IDC_STATIC1,7,134,39,8 - RTEXT "Description:",IDC_STATIC2,7,153,41,8 - RTEXT "Filter is:",IDC_STATIC3,7,188,41,10 - PUSHBUTTON "&Help",IDC_NETHELP,313,184,50,14 - PUSHBUTTON "&New Folder",IDC_BUTTON_NEW_FOLDER,315,132,48,14 + SS_LEFTNOWORDWRAP | WS_GROUP,128,112,51,8 + COMBOBOX IDC_COMBO_OP5,183,109,72,101,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_EDIT_VALUE5,256,109,113,12,ES_AUTOHSCROLL + PUSHBUTTON "&More",IDC_MORE,50,125,35,14 + PUSHBUTTON "&Fewer",IDC_FEWER,88,125,35,14 + RTEXT "then",IDC_STATIC1,7,152,39,8 + COMBOBOX IDC_COMBO_ACTION,50,150,96,112,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_COMBO_DEST,150,150,167,176,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&New Folder...",IDC_BUTTON_NEW_FOLDER,319,150,50,14 + RTEXT "Description:",IDC_STATIC2,7,171,41,8 + EDITTEXT IDC_EDIT_DESC,49,170,320,27,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,212,204,50,14,WS_GROUP + PUSHBUTTON "Cancel",IDCANCEL,265,204,50,14 + PUSHBUTTON "&Help",IDC_NETHELP,319,204,50,14 END -IDD_FILTER_PICKER DIALOG DISCARDABLE 0, 0, 263, 193 +IDD_FILTER_PICKER DIALOG DISCARDABLE 0, 0, 263, 226 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Mail Filters" FONT 8, "MS Sans Serif" BEGIN - LISTBOX IDC_LIST_FILTERS,6,26,145,91,LBS_OWNERDRAWFIXED | + LISTBOX IDC_LIST_FILTERS,5,50,154,91,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | LBS_WANTKEYBOARDINPUT | WS_VSCROLL | WS_TABSTOP CONTROL "LANGUP",IDC_UP,"Button",BS_OWNERDRAW | WS_DISABLED | - WS_TABSTOP,153,47,20,20 + WS_TABSTOP,165,71,20,20 CONTROL "LANGDOWN",IDC_DOWN,"Button",BS_OWNERDRAW | WS_DISABLED | - WS_TABSTOP,153,70,20,20 - PUSHBUTTON "&New...",IDC_NEW,206,7,50,14 - PUSHBUTTON "&Edit...",IDC_EDIT,206,24,50,14 - PUSHBUTTON "&Delete",IDC_DELETE,206,42,50,14 + WS_TABSTOP,165,94,20,20 + PUSHBUTTON "&New...",IDC_NEW,206,50,50,14 + PUSHBUTTON "&Edit...",IDC_EDIT,206,68,50,14 + PUSHBUTTON "&Delete",IDC_DELETE,206,86,50,14 CONTROL "&Log Filter Use",IDC_CHECK_LOG,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,6,121,59,10 - PUSHBUTTON "&View Log",IDC_VIEW,206,116,50,14 - DEFPUSHBUTTON "OK",IDOK,94,172,50,14 - PUSHBUTTON "Cancel",IDCANCEL,150,172,50,14 - PUSHBUTTON "&Help",IDC_FILTER_HELP,206,172,50,14 - LTEXT "No Way! Filters Rule!",IDC_STATIC_DESCRIPTION,6,137,250, + WS_TABSTOP,5,145,59,10 + PUSHBUTTON "&View Log",IDC_VIEW,206,145,50,14 + DEFPUSHBUTTON "OK",IDOK,97,205,50,14 + PUSHBUTTON "Cancel",IDCANCEL,151,205,50,14 + PUSHBUTTON "&Help",IDC_FILTER_HELP,206,205,50,14 + LTEXT "No Way! Filters Rule!",IDC_STATIC_DESCRIPTION,5,166,251, 29,SS_NOPREFIX | WS_BORDER - LTEXT "Filters will be applied to mail in the following order:", - IDC_STATIC,6,7,146,17 + COMBOBOX IDC_COMBO_SERVER_SCOPE,5,17,154,91,CBS_DROPDOWNLIST | + CBS_OWNERDRAWFIXED | WS_VSCROLL | WS_TABSTOP + LTEXT "Filters for:",IDC_FILTERSFORSTATIC,5,7,31,8 + PUSHBUTTON "Filters on Server...",IDC_BUTTON_SERVER_FILTERS,191,17, + 65,14 + LTEXT "Filters will be applied in the following order:", + IDC_STATIC,5,39,134,8 END IDD_LDAPSEARCH DIALOG DISCARDABLE 0, 0, 322, 28 @@ -917,20 +926,20 @@ STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "All Groups" FONT 8, "MS Sans Serif" BEGIN - COMBOBOX IDC_COMBO_SERVER,71,6,201,112,CBS_DROPDOWNLIST | + RTEXT "&Newsgroup:",IDC_STATIC,7,25,43,9 + EDITTEXT IDC_EDIT_NEWSGROUP,56,24,214,12,ES_AUTOHSCROLL + CONTROL "",IDC_NEWSGROUPS,"Static",SS_BLACKFRAME,7,45,263,163 + PUSHBUTTON "&Add Server...",IDC_ADD_SERVER,294,7,59,14 + PUSHBUTTON "S&ubscribe",IDC_SUBSCRIBE,294,54,59,14 + PUSHBUTTON "U&nsubscribe",IDC_UNSUBSCRIBE,294,72,59,14 + PUSHBUTTON "&Refresh List",IDC_GET_DELETE,294,90,59,14 + PUSHBUTTON "&Expand",IDC_EXPAND_ALL,294,126,59,14 + PUSHBUTTON "&Collapse All",IDC_COLLAPSE_ALL,294,144,59,14 + PUSHBUTTON "S&top",IDC_STOP,294,194,59,14 + RTEXT "&Server:",IDC_STATIC,7,8,43,9 + COMBOBOX IDC_COMBO_SERVER,56,7,214,112,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Add Server...",IDC_ADD_SERVER,288,7,59,12 - EDITTEXT IDC_EDIT_NEWSGROUP,70,24,202,12,ES_AUTOHSCROLL - PUSHBUTTON "S&ubscribe",IDC_SUBSCRIBE,288,55,59,13 - PUSHBUTTON "U&nsubscribe",IDC_UNSUBSCRIBE,288,75,59,12 - PUSHBUTTON "&Refresh List",IDC_GET_DELETE,288,95,59,12 - PUSHBUTTON "&Expand",IDC_EXPAND_ALL,288,115,59,12 - PUSHBUTTON "&Collapse All",IDC_COLLAPSE_ALL,288,135,59,12 - PUSHBUTTON "S&top",IDC_STOP,288,190,59,12 - CONTROL "",IDC_NEWSGROUPS,"Static",SS_BLACKFRAME,7,48,265,160 - RTEXT "&Discussion Group:",IDC_STATIC,3,24,62,9 - RTEXT "&Server:",IDC_STATIC,3,9,62,9 END IDD_NEWSGROUP_NEW DIALOG DISCARDABLE 0, 0, 360, 215 @@ -938,19 +947,18 @@ STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "New Groups" FONT 8, "MS Sans Serif" BEGIN - COMBOBOX IDC_COMBO_SERVER,39,6,234,112,CBS_DROPDOWNLIST | + RTEXT "&Server:",IDC_STATIC,7,8,43,12 + COMBOBOX IDC_COMBO_SERVER,56,7,214,112,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Add Server...",IDC_ADD_SERVER,288,7,59,12 - PUSHBUTTON "S&ubscribe",IDC_SUBSCRIBE,288,55,59,12 - PUSHBUTTON "U&nsubscribe",IDC_UNSUBSCRIBE,288,75,59,12 - PUSHBUTTON "&Refresh List",IDC_GET_NEW,288,95,59,12 - PUSHBUTTON "&Clear List",IDC_CLEAR_NEW,288,115,59,12 - PUSHBUTTON "S&top",IDC_STOP,288,190,59,12 - CONTROL "",IDC_NEWSGROUPS,"Static",SS_BLACKFRAME,7,41,266,164 - LTEXT "This list shows all new discussion groups since you last clicked Clear New.", - IDC_STATIC,7,28,264,10 - LTEXT "&Server:",IDC_STATIC,7,7,30,12 + LTEXT "This list shows all new Newsgroups since you last clicked Clear List", + IDC_STATIC,7,35,264,10 + CONTROL "",IDC_NEWSGROUPS,"Static",SS_BLACKFRAME,7,45,263,163 + PUSHBUTTON "S&ubscribe",IDC_SUBSCRIBE,294,54,59,14 + PUSHBUTTON "U&nsubscribe",IDC_UNSUBSCRIBE,294,72,59,14 + PUSHBUTTON "&Refresh List",IDC_GET_NEW,294,90,59,14 + PUSHBUTTON "&Clear List",IDC_CLEAR_NEW,294,108,59,14 + PUSHBUTTON "S&top",IDC_STOP,294,194,59,14 END IDD_NEWSGROUP_SEARCH DIALOG DISCARDABLE 0, 0, 360, 215 @@ -958,18 +966,31 @@ STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Search for a Group" FONT 8, "MS Sans Serif" BEGIN - COMBOBOX IDC_COMBO_SERVER,52,4,218,112,CBS_DROPDOWNLIST | + RTEXT "S&earch for:",-1,7,25,43,9 + EDITTEXT IDC_EDIT_NEWSGROUP,56,24,214,12,ES_AUTOHSCROLL + CONTROL "",IDC_NEWSGROUPS,"Static",SS_BLACKFRAME,7,45,263,163 + PUSHBUTTON "Sea&rch Now",IDC_SEARCH_NOW,294,24,59,14 + PUSHBUTTON "S&ubscribe",IDC_SUBSCRIBE,294,54,59,14 + PUSHBUTTON "U&nsubscribe",IDC_UNSUBSCRIBE,294,72,59,14 + PUSHBUTTON "S&top",IDC_STOP,294,194,59,14 + RTEXT "&Server:",-1,7,8,43,9 + COMBOBOX IDC_COMBO_SERVER,56,7,214,112,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_NEWSGROUP,51,24,219,12,ES_AUTOHSCROLL - PUSHBUTTON "&Add Server...",IDC_ADD_SERVER,288,7,59,12 - PUSHBUTTON "Sea&rch Now",IDC_SEARCH_NOW,288,24,59,12 - PUSHBUTTON "S&ubscribe",IDC_SUBSCRIBE,288,55,59,12 - PUSHBUTTON "U&nsubscribe",IDC_UNSUBSCRIBE,288,75,59,12 - PUSHBUTTON "S&top",IDC_STOP,288,190,59,12 - CONTROL "",IDC_NEWSGROUPS,"Static",SS_BLACKFRAME,7,46,264,163 - RTEXT "S&earch for:",-1,7,24,39,9 - RTEXT "&Server:",-1,7,6,39,9 +END + +IDD_NEWSGROUP_SERVERTYPE DIALOG DISCARDABLE 0, 0, 209, 76 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Add Server" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Select the type of server:",IDC_STATIC,8,6,82,8 + CONTROL "&News Server (NNTP)",IDC_RADIO_NNTP,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,9,22,169,10 + CONTROL "&IMAP Server",IDC_RADIO_IMAP,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,9,38,173,10 + DEFPUSHBUTTON "Continue...",IDOK,98,55,50,14 + PUSHBUTTON "Cancel",IDCANCEL,152,55,50,14 END IDD_NEWSGROUP_ADDSERVER DIALOG DISCARDABLE 0, 0, 186, 101 @@ -979,8 +1000,10 @@ FONT 8, "MS Sans Serif" BEGIN LTEXT "&Port:",IDC_STATIC,7,29,25,10 EDITTEXT IDC_EDIT_PORT,35,28,83,12,ES_AUTOHSCROLL +#ifdef MOZ_SECURITY CONTROL "Se&cure",IDC_SECURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,47,49,13 +#endif DEFPUSHBUTTON "OK",IDOK,21,79,50,14 PUSHBUTTON "Cancel",IDCANCEL,76,79,50,14 CONTROL "&Always use name and password",IDC_USE_NAME,"Button", @@ -1003,6 +1026,7 @@ BEGIN PUSHBUTTON "Search...",IDC_DIRSEARCH,277,16,50,13 END + 1536 DIALOG DISCARDABLE 0, 0, 181, 132 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Directory" @@ -1033,7 +1057,7 @@ BEGIN WS_VISIBLE | WS_GROUP | WS_TABSTOP,123,97,50,12 END -IDD_PREF_LDAP_SERVER DIALOG DISCARDABLE 0, 0, 313, 87 +IDD_PREF_LDAP_SERVER DIALOG DISCARDABLE 0, 0, 303, 87 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "LDAP Server Properties" FONT 8, "MS Sans Serif" @@ -1049,36 +1073,40 @@ BEGIN LTEXT "&Maximum Number of Hits:",IDC_STATIC_MAX_HITS,8,68,83, 11 EDITTEXT IDC_EDIT_MAX_HITS,95,66,32,12,ES_AUTOHSCROLL +#ifdef MOZ_SECURITY CONTROL "Se&cure",IDC_SECURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,55,55,10 +#endif CONTROL "S&ave Password",IDC_SAVE_PASSWORD,"Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,155,68,75, 10 - DEFPUSHBUTTON "OK",IDOK,251,10,50,14 - PUSHBUTTON "Cancel",IDCANCEL,251,27,50,14 - PUSHBUTTON "Help",ID_HELP,251,46,50,14 + DEFPUSHBUTTON "OK",IDOK,246,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,246,25,50,14 + PUSHBUTTON "Help",ID_HELP,246,43,50,14 END -IDD_PP_FOLDER DIALOG DISCARDABLE 0, 0, 204, 157 +IDD_PP_FOLDER DIALOG DISCARDABLE 0, 0, 204, 133 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "General" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Name: ",IDC_STATIC,9,11,27,8 - EDITTEXT IDC_EDIT1,44,9,147,12,ES_AUTOHSCROLL - LTEXT "Location:",IDC_STATIC,9,28,34,9 - LTEXT "Mail Server",IDC_MAIL_SERVER_NAME,44,29,137,10 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,9,41,189,1 - LTEXT "Unread Messages:",IDC_STATIC,9,47,60,8 - LTEXT "Total Messages:",IDC_STATIC,9,60,52,8 - LTEXT "?",IDC_STATIC_UNREAD,77,48,113,8 - LTEXT "???",IDC_STATIC_TOTAL,77,61,113,8 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,9,75,191,1 - LTEXT "Space Wasted:",IDC_STATIC,9,81,49,9 - LTEXT "Total Space Used:",IDC_STATIC,9,92,59,9 - LTEXT "???",IDC_PERCENT_WASTED,77,82,113,8 - LTEXT "???",IDC_USED_SPACE,77,93,113,8 - PUSHBUTTON "&Clean Up Wasted Space",IDC_BUTTON1,111,140,91,15 + RTEXT "Folder Name: ",IDC_STATIC,6,10,60,8 + EDITTEXT IDC_EDIT1,70,7,127,12,ES_AUTOHSCROLL + RTEXT "Location:",IDC_STATIC,6,24,60,8 + LTEXT "Mail Server",IDC_MAIL_SERVER_NAME,70,24,111,8 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,47,189,1 + LTEXT "Unread Messages:",IDC_STATIC,6,53,60,8 + RTEXT "Total Messages:",IDC_STATIC,6,65,60,8 + LTEXT "?",IDC_STATIC_UNREAD,70,53,119,8 + LTEXT "???",IDC_STATIC_TOTAL,70,66,119,8 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,80,190,1 + RTEXT "Space Wasted:",IDC_STATIC,6,88,60,8 + LTEXT "Total Space Used:",IDC_STATIC,6,101,60,8 + LTEXT "???",IDC_PERCENT_WASTED,70,89,119,8 + LTEXT "???",IDC_USED_SPACE,70,100,119,8 + PUSHBUTTON "&Compact Folder",IDC_BUTTON1,122,112,75,14 + RTEXT "Type:",IDC_STATIC,6,35,60,8 + LTEXT "Mail Folder",IDC_STATIC_TYPE,70,35,121,8 END IDD_SETUPWIZARD_NAMEEMAIL DIALOG DISCARDABLE 0, 0, 229, 156 @@ -1125,18 +1153,18 @@ BEGIN IDC_TEXT1,19,54,208,19 END -IDD_NEWFOLDER DIALOG DISCARDABLE 0, 0, 255, 62 +IDD_NEWFOLDER DIALOG DISCARDABLE 0, 0, 218, 70 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION CAPTION "New Folder" FONT 8, "MS Sans Serif" BEGIN - EDITTEXT IDC_EDIT1,47,7,112,14,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO1,47,43,112,82,CBS_DROPDOWNLIST | + LTEXT "Name:",IDC_STATIC,7,7,22,8 + EDITTEXT IDC_EDIT1,7,18,131,14,ES_AUTOHSCROLL + LTEXT "Create as subfolder of:",IDC_STATIC,7,39,72,8 + COMBOBOX IDC_COMBO1,7,50,131,133,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "OK",IDOK,198,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,198,24,50,14 - LTEXT "Name: ",IDC_STATIC,7,7,36,8 - LTEXT "Create as sub-folder of: ",IDC_STATIC,7,28,91,8 + DEFPUSHBUTTON "OK",IDOK,161,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,161,24,50,14 END IDD_HISTORYBAR DIALOG DISCARDABLE 0, 0, 330, 129 @@ -1207,7 +1235,7 @@ BEGIN LTEXT "Headers",IDC_STATIC,97,49,28,8 CONTROL "&Mark remaining headers as read",IDC_CHECK1,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,19,63,114,10 - DEFPUSHBUTTON "Download",IDOK,71,85,50,14 + DEFPUSHBUTTON "Download",IDOK,75,85,50,14 PUSHBUTTON "Cancel",IDCANCEL,129,85,50,14 END @@ -1232,7 +1260,7 @@ BEGIN PUSHBUTTON "&More...",IDC_BNT_MORE,142,81,50,15 LTEXT "When it's time to clean up messages:",IDC_STATIC,8,8, 151,8 - PUSHBUTTON "&Download Now",IDC_DOWNLOAD_NOW,52,139,102,15 + PUSHBUTTON "&Download Now",IDC_DOWNLOAD_NOW,52,137,102,15 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,103,191,1 END @@ -1267,9 +1295,10 @@ BEGIN LTEXT "Enables network connections", WS_GROUP | IDC_STATIC,33,49,120,15 LTEXT "Disables network connections until you say so.", IDC_STATIC,33,86,146,19 - CONTROL "Set as &default",IDC_CHECK_ASKME_DEFAULT,"Button", - BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,21,114,105,14 - LTEXT "Changes the ""Ask Me"" preference to the above option so you won't be asked again.", + CONTROL "&Remember Previous State",IDC_CHECK_ASKME_DEFAULT, + "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,21,114, + 139,14 + LTEXT "Communicator will remember what state it was in last and start in that mode.", IDC_STATIC,33,129,141,20 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,10,109,177,1 DEFPUSHBUTTON "OK",IDOK,73,161,50,14 @@ -1280,9 +1309,8 @@ STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Download Settings" FONT 8, "MS Sans Serif" BEGIN - CONTROL "&Select this discussion for download", - IDC_CHECK_DOWNLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 16,9,168,11 + CONTROL "&Select this newsgroup for download",IDC_CHECK_DOWNLOAD, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,9,168,11 CONTROL "Use &default settings from preferences", IDC_CHECK_DEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 16,31,168,9 @@ -1292,7 +1320,7 @@ BEGIN BS_AUTOCHECKBOX | WS_TABSTOP,34,70,73,10 CONTROL "&from",IDC_RADIO_FROM,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,44,87,31,9 - COMBOBOX IDC_COMBO2,83,84,57,32,CBS_DROPDOWNLIST | WS_VSCROLL | + COMBOBOX IDC_COMBO2,82,84,57,32,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "sin&ce",IDC_RADIO_SINCE,"Button",BS_AUTORADIOBUTTON,44, 104,31,11 @@ -1322,8 +1350,8 @@ BEGIN PUSHBUTTON "Help",IDC_HELP_GO_OFFLINE,125,139,55,13 CONTROL "Download &Mail",IDC_CHECK_DOWNLOAD_MAIL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,40,47,64,11 - CONTROL "Dow&nload Discussion Groups",IDC_CHECK_DOWNLOAD_DISC, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,64,109,14 + CONTROL "Dow&nload Newsgroups",IDC_CHECK_DOWNLOAD_DISC,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,40,64,109,14 PUSHBUTTON "Select &Items For Download...",IDC_BUTTON_SELECT,40,88, 105,16 CONTROL "&Send Messages",IDC_CHECK_SEND_MESSAGES,"Button", @@ -1384,7 +1412,7 @@ END IDD_SELECT_DISCUSSIONS DIALOG DISCARDABLE 0, 0, 274, 263 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Discussion Groups" +CAPTION "Newsgroups" FONT 8, "MS Sans Serif" BEGIN PUSHBUTTON "Choose &All",IDC_BUTTON_SELECT_ALL,6,242,50,14 @@ -1405,7 +1433,8 @@ STYLE WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN FONT 8, "MS Sans Serif" BEGIN PUSHBUTTON "&Go to Message Folder",IDC_TO,7,7,85,15 - PUSHBUTTON "F&ile Message ",IDC_BUTTON_FILE_MESSAGE,98,7,85,15 + PUSHBUTTON "F&ile Message...",IDC_BUTTON_FILE_MESSAGE,97,7,66,15 + PUSHBUTTON "&Delete Message",IDC_BUTTON_DELETE_MESSAGE,168,7,66,15 END IDD_PP_NEWS_GENERAL DIALOG DISCARDABLE 0, 0, 206, 159 @@ -1417,7 +1446,7 @@ BEGIN LTEXT "Pretty Name??",IDC_PRETTY_NAME,40,9,152,8 LTEXT "(ugly.group.name)???",IDC_UGLY_NAME,40,19,152,8 LTEXT "Location:",IDC_STATIC,8,32,31,8 - LTEXT "Discussion Host",IDC_NEWS_SERVER,40,32,149,8 + LTEXT "Newsgroup Host",IDC_NEWS_SERVER,40,32,149,8 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,43,192,1 LTEXT "Unread Messages:",IDC_STATIC,7,48,59,8 LTEXT "?",IDC_STATIC_UNREAD,73,49,72,9 @@ -1428,7 +1457,7 @@ BEGIN CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,82,192,1 CONTROL "Can Receive HTML",IDC_CHECK_RECEIVE_HTML,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,8,89,84,8 - LTEXT "Unchecking this option will cause this discussion group and all discussion groups above it in the hierarchy to turn off the ability to receive HTML.", + LTEXT "Unchecking this option will cause this Newsgroup and all Newsgroups above it in the hierarchy to turn off the ability to receive HTML.", IDC_STATIC,21,103,171,28 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,131,192,1 PUSHBUTTON "&Download Now",IDC_DOWNLOAD_NOW,52,137,102,15 @@ -1569,24 +1598,15 @@ BEGIN LTEXT "Description",IDC_STATIC3,67,38,157,27 END -IDD_ADVANCED_SEARCH DIALOG DISCARDABLE 0, 0, 187, 106 +IDD_ADVANCED_SEARCH DIALOG DISCARDABLE 0, 0, 212, 117 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Options" FONT 8, "MS Sans Serif" BEGIN - CONTROL "&Search Subfolders",IDC_CHECK_SUBFOLDERS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,8,120,10 - CONTROL "on &your local system",IDC_RADIO_SEARCH_LOCAL,"Button", - BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,12,39,140,8 - CONTROL "on the s&pecified server",IDC_RADIO_SEARCH_SERVER, - "Button",BS_AUTORADIOBUTTON,12,50,140,8 - DEFPUSHBUTTON "OK",IDOK,129,86,50,14 - PUSHBUTTON "Cancel",IDCANCEL,75,86,50,14 - PUSHBUTTON "Help",IDC_ADVANCED_SEARCH_HELP,21,86,50,14 - GROUPBOX "When online, search for messages",IDC_STATIC,7,26,172, - 49,WS_GROUP - LTEXT "In offline mode, all searches are done locally.", - IDC_STATIC,24,64,150,10 + CONTROL "Search &subfolders",IDC_CHECK_SUBFOLDERS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,15,73,10 + CONTROL "Search &locally only",IDC_CHECK_SEARCH_LOCALLY,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,30,75,10 END IDD_NETPROFILE_LOGIN DIALOG DISCARDABLE 0, 0, 234, 162 @@ -1607,22 +1627,18 @@ BEGIN PUSHBUTTON "Advanced >>",IDC_ADVANCED,162,102,50,14 END -IDD_HEADER_LIST DIALOG DISCARDABLE 0, 0, 182, 116 +IDD_HEADER_LIST DIALOG DISCARDABLE 0, 0, 212, 117 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Customize" +CAPTION "Customize Headers" FONT 8, "MS Sans Serif" BEGIN - LTEXT "&Customize the message headers that you can search for and filter on.", - IDC_STATIC,9,6,161,18 - LISTBOX IDC_HEADER_LIST,8,24,107,65,LBS_SORT | LBS_USETABSTOPS | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | - WS_TABSTOP - DEFPUSHBUTTON "&New",IDC_ADD_HEADER,123,24,50,14 - PUSHBUTTON "&Edit",IDC_EDIT_HEADER_NAME,123,43,50,14 - PUSHBUTTON "&Delete",IDC_REMOVE_HEADER,123,62,50,14 - PUSHBUTTON "OK",IDOK,123,94,50,14 - PUSHBUTTON "Cancel",IDCANCEL,70,94,50,14 - PUSHBUTTON "Help",IDC_HEADER_HELP,17,94,50,14 + LTEXT "New message header:",IDC_STATIC,7,7,72,8 + EDITTEXT IDC_EDIT_NEW_HEADER,7,18,136,14,ES_AUTOHSCROLL + LISTBOX IDC_HEADER_LIST,7,33,136,77,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "&Add",IDC_ADD_HEADER,155,18,50,14 + PUSHBUTTON "&Remove",IDC_REMOVE_HEADER,155,35,50,14 + PUSHBUTTON "Re&place",IDC_REPLACE_HEADER,155,53,50,14 END IDD_EXPORTRDF DIALOG DISCARDABLE 0, 0, 249, 82 @@ -1643,51 +1659,54 @@ FONT 8, "MS Sans Serif" BEGIN END -IDD_ADVANCED_LDAP_SEARCH DIALOG DISCARDABLE 0, 0, 298, 144 -STYLE WS_CHILD | WS_DISABLED | WS_BORDER +IDD_ADVANCED_LDAP_SEARCH DIALOG DISCARDABLE 0, 0, 379, 157 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Sans Serif" BEGIN - COMBOBOX IDC_COMBO_AND_OR,39,17,146,45,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_ATTRIB1,39,34,67,60,CBS_DROPDOWNLIST | + COMBOBOX IDC_COMBO_ATTRIB1,39,46,67,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP1,110,34,75,60,CBS_DROPDOWNLIST | WS_VSCROLL | + COMBOBOX IDC_COMBO_OP1,110,46,75,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE1,189,34,105,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB2,39,49,67,57,CBS_DROPDOWNLIST | + EDITTEXT IDC_EDIT_VALUE1,189,46,105,12,ES_AUTOHSCROLL + COMBOBOX IDC_COMBO_ATTRIB2,39,61,67,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP2,110,49,75,63,CBS_DROPDOWNLIST | WS_VSCROLL | + COMBOBOX IDC_COMBO_OP2,110,61,75,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE2,189,49,105,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB3,39,64,67,60,CBS_DROPDOWNLIST | + EDITTEXT IDC_EDIT_VALUE2,189,61,105,12,ES_AUTOHSCROLL + COMBOBOX IDC_COMBO_ATTRIB3,39,76,67,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP3,110,64,75,60,CBS_DROPDOWNLIST | WS_VSCROLL | + COMBOBOX IDC_COMBO_OP3,110,76,75,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE3,189,64,105,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB4,39,79,67,60,CBS_DROPDOWNLIST | + EDITTEXT IDC_EDIT_VALUE3,189,76,105,12,ES_AUTOHSCROLL + COMBOBOX IDC_COMBO_ATTRIB4,39,91,67,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP4,110,79,75,60,CBS_DROPDOWNLIST | WS_VSCROLL | + COMBOBOX IDC_COMBO_OP4,110,91,75,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE4,189,79,105,12,ES_AUTOHSCROLL - COMBOBOX IDC_COMBO_ATTRIB5,39,94,67,60,CBS_DROPDOWNLIST | + EDITTEXT IDC_EDIT_VALUE4,189,91,105,12,ES_AUTOHSCROLL + COMBOBOX IDC_COMBO_ATTRIB5,39,106,67,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBO_OP5,110,94,75,60,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - EDITTEXT IDC_EDIT_VALUE5,189,94,105,12,ES_AUTOHSCROLL - PUSHBUTTON "&More",IDC_MORE,39,110,29,12 - PUSHBUTTON "&Fewer",IDC_FEWER,76,110,29,12 - RTEXT "Search for items in",IDC_STATIC,4,4,58,9 - LTEXT "where",IDC_STATIC,189,4,29,9 - RTEXT "the",IDC_STATIC_THE1,24,36,11,8 - RTEXT "the",IDC_STATIC_THE2,7,51,28,9 - RTEXT "the",IDC_STATIC_THE3,7,66,28,9 - RTEXT "the",IDC_STATIC_THE4,7,81,28,9 - RTEXT "the",IDC_STATIC_THE5,7,95,28,9 - LTEXT "matches",IDC_STATIC,189,20,30,8 + COMBOBOX IDC_COMBO_OP5,110,106,75,80,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_EDIT_VALUE5,189,106,105,12,ES_AUTOHSCROLL + PUSHBUTTON "&More",IDC_MORE,39,122,29,12 + PUSHBUTTON "&Fewer",IDC_FEWER,76,122,29,12 + RTEXT "Searching:",IDC_STATIC,4,4,58,9 + RTEXT "the",IDC_STATIC_THE1,24,48,11,8 + RTEXT "the",IDC_STATIC_THE2,7,63,28,9 + RTEXT "the",IDC_STATIC_THE3,7,78,28,9 + RTEXT "the",IDC_STATIC_THE4,7,93,28,9 + RTEXT "the",IDC_STATIC_THE5,7,107,28,9 LTEXT "Server Name",IDC_STATIC1,66,4,114,8 - PUSHBUTTON "&Clear Search",IDC_CLEAR_SEARCH,231,110,48,12 + PUSHBUTTON "&Clear Search",IDC_CLEAR_SEARCH,231,122,48,12 CTEXT "Search results will appear in the address book window.", - IDC_STATIC_DESC,4,126,290,8 + IDC_STATIC_DESC,4,138,290,8 + CONTROL "Match all items below (And)",IDC_RADIO_ALL,"Button", + BS_AUTORADIOBUTTON,13,15,102,10 + CONTROL "Match one or more of the items below (Or)", + IDC_RADIO_ANY,"Button",BS_AUTORADIOBUTTON,13,30,147,10 + PUSHBUTTON "Search",IDC_SEARCH,315,14,50,14 + PUSHBUTTON "Cancel",IDCANCEL,315,35,50,14 + PUSHBUTTON "Help",IDHELP,315,56,50,14 END IDD_BASIC_SEARCH DIALOG DISCARDABLE 0, 0, 298, 85 @@ -1741,14 +1760,14 @@ BEGIN WS_TABSTOP,23,205,81,10 CONTROL "Address Book",IDC_ADDBOOK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,218,81,10 - CONTROL "Navigation Center",IDC_SELECTEDBOOKMARKS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,109,179,81,10 - CONTROL "User Preferences",IDC_SUGGESTIONS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,109,192,81,10 + CONTROL "Navigation Center",IDC_SELECTEDBOOKMARKS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,109,179,81,10 + CONTROL "User Preferences",IDC_SUGGESTIONS,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,109,192,81,10 CONTROL "Java Security",IDC_JAVA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,109,205,81,10 - CONTROL "Certificates",IDC_SECURITY_TYPE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,109,218,81,10 + CONTROL "Certificates",IDC_SECURITY_TYPE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,109,218,81,10 END IDD_XPPROGRESS DIALOG DISCARDABLE 0, 0, 287, 95 @@ -1763,24 +1782,24 @@ BEGIN CTEXT "Line 2 Text",IDC_LINE2,7,21,273,8 END -IDD_PREF_CHOOSE_FOLDER DIALOG DISCARDABLE 0, 0, 230, 90 +IDD_PREF_CHOOSE_FOLDER DIALOG DISCARDABLE 0, 0, 251, 90 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Choose Folder" FONT 8, "MS Sans Serif" BEGIN LTEXT "Choose where you would like your sent mail messages to be stored:", - IDC_STATIC,5,9,218,12 + IDC_STATIC_TITLE,5,7,239,12 + COMBOBOX IDC_COMBO_SERVERS,93,25,145,70,CBS_DROPDOWNLIST | + CBS_OWNERDRAWFIXED | WS_VSCROLL | WS_TABSTOP CONTROL "&Folder ""Sent"" on",IDC_RADIO_SENT,"Button", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,10,25,82,12 CONTROL "&Other:",IDC_RADIO_OTHER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,10,45,40,12 - COMBOBOX IDC_COMBO_SERVERS,93,25,124,70,CBS_DROPDOWNLIST | - CBS_OWNERDRAWFIXED | WS_VSCROLL | WS_GROUP | WS_TABSTOP - COMBOBOX IDC_COMBO_FOLDERS,51,45,112,72,CBS_DROPDOWNLIST | - CBS_OWNERDRAWFIXED | WS_VSCROLL | WS_GROUP | WS_TABSTOP - PUSHBUTTON "&New Folder",IDC_NEW_FOLDER,168,44,49,14 - DEFPUSHBUTTON "OK",IDOK,106,68,50,14 - PUSHBUTTON "Cancel",IDCANCEL,167,68,50,14 + COMBOBOX IDC_COMBO_FOLDERS,51,45,128,72,CBS_DROPDOWNLIST | + CBS_OWNERDRAWFIXED | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&New Folder",IDC_NEW_FOLDER,190,45,49,14 + DEFPUSHBUTTON "OK",IDOK,129,69,50,14 + PUSHBUTTON "Cancel",IDCANCEL,189,69,50,14 END IDD_MAILSERVER_GENERAL DIALOG DISCARDABLE 0, 0, 240, 110 @@ -1792,8 +1811,8 @@ BEGIN EDITTEXT IDC_EDIT_SERVER,57,9,147,12,ES_AUTOHSCROLL LTEXT "Server name",IDC_STATIC_SERVER,57,9,145,12 LTEXT "&Server Type:",IDC_STATIC,10,25,45,12 - COMBOBOX IDC_COMBO_TYPE,57,24,147,38,CBS_DROPDOWN | WS_VSCROLL | - WS_TABSTOP + COMBOBOX IDC_COMBO_TYPE,57,24,147,38,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP LTEXT "&User Name:",IDC_STATIC,10,45,45,10 EDITTEXT IDC_EDIT_USERNAME,57,43,147,12,ES_AUTOHSCROLL CONTROL "Remember my mail &password.",IDC_CHECK_PASSWORD,"Button", @@ -1821,12 +1840,23 @@ FONT 8, "MS Sans Serif" BEGIN CONTROL "Set &new folders for offline download", IDC_CHECK_IMAP_LOCAL,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,10,10,200,10 - CONTROL "Move &deleted messages into Trash",IDC_CHECK_IMAP_TRASH, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,30,200,10 + WS_TABSTOP,11,7,200,10 +#ifdef MOZ_SECURITY CONTROL "&Server supports encrypted connections (SSL)", IDC_CHECK_IMAP_SSL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 10,50,200,10 + 11,22,200,10 +#endif + CONTROL "&Empty Trash on exit",IDC_CHECK_EMPTY_TRASH,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,11,36,212,13 + CONTROL "&Clean up Inbox on exit",IDC_CHECK_EMPTY_INBOX,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,11,52,212,13 + CONTROL "Use IMAP Delete Model",IDC_RADIO_IMAP_DELETE,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,10,68,188,10 + CONTROL "Move delete messages into Trash", + IDC_RADIO_MOVE_TO_TRASH,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,10,79,188,10 + CONTROL "Delete the messages from server",IDC_RADIO_REAL_DELETE, + "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,10,90,188,10 END IDD_MAILSERVER_ADVANCED DIALOG DISCARDABLE 0, 0, 240, 110 @@ -1847,20 +1877,38 @@ BEGIN 5,91,220,13 END -IDD_NEWSGROUP_SERVERTYPE DIALOG DISCARDABLE 0, 0, 209, 76 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Add Server" +IDD_PP_SHARING DIALOG DISCARDABLE 0, 0, 204, 133 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Sharing" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "Continue...",IDOK,76,55,50,14 - PUSHBUTTON "Cancel",IDCANCEL,144,55,50,14 - LTEXT "Select the type of server:",IDC_STATIC,8,6,168,12 - CONTROL "&News Server (NNTP)",IDC_RADIO_NNTP,"Button", - BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,9,22,169,11 - CONTROL "&IMAP Server",IDC_RADIO_IMAP,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,9,38,173,12 + LTEXT "Folder Type:",IDC_STATIC,6,8,44,10 + CONTROL "",IDC_STATIC4,"Static",SS_ETCHEDHORZ,7,65,189,1 + LTEXT "Share this and other folders with network users and display and set access privileges.", + IDC_STATIC5,7,71,160,18 + PUSHBUTTON "&Privileges",IDC_PRIVILEGES,9,94,58,14 + LTEXT "Mail Folder",IDC_STATIC_TYPE,54,8,64,9 + LTEXT "This is a personal folder. It is not shared.", + IDC_STATIC_DESCRIPTION,6,19,184,10 + LTEXT "You have the following permissions:",IDC_STATIC2,6,36, + 187,10 + LTEXT "read, write, append, delete",IDC_STATIC_ACLRIGHTS,23,47, + 166,10 END +IDD_SYNCHRONIZE_EXIT DIALOG DISCARDABLE 0, 0, 218, 71 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Exit Communicator" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "&Yes",IDYES,14,49,50,14 + PUSHBUTTON "&No",IDNO,75,49,50,14 + PUSHBUTTON "&Cancel",IDCANCEL,136,49,50,14 + CONTROL "&Don't ask me again",IDC_DONTASKAGAIN,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,14,31,77,10 + LTEXT "Do you want to Synchronize before you exit Communicator? ", + IDC_STATIC,14,15,195,8 +END ///////////////////////////////////////////////////////////////////////////// // @@ -1970,15 +2018,15 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 369 TOPMARGIN, 7 - BOTTOMMARGIN, 200 + BOTTOMMARGIN, 218 END IDD_FILTER_PICKER, DIALOG BEGIN - LEFTMARGIN, 6 + LEFTMARGIN, 5 RIGHTMARGIN, 256 TOPMARGIN, 7 - BOTTOMMARGIN, 186 + BOTTOMMARGIN, 219 END IDD_LDAPSEARCH, DIALOG @@ -2010,12 +2058,12 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 353 TOPMARGIN, 7 - BOTTOMMARGIN, 209 + BOTTOMMARGIN, 208 END IDD_NEWSGROUP_SEARCH, DIALOG BEGIN - LEFTMARGIN, 6 + LEFTMARGIN, 7 RIGHTMARGIN, 353 TOPMARGIN, 7 BOTTOMMARGIN, 208 @@ -2029,17 +2077,10 @@ BEGIN BOTTOMMARGIN, 94 END - IDD_ADDRESSBOOK, DIALOG - BEGIN - RIGHTMARGIN, 330 - TOPMARGIN, 7 - BOTTOMMARGIN, 30 - END - IDD_PREF_LDAP_SERVER, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 306 + RIGHTMARGIN, 296 TOPMARGIN, 7 BOTTOMMARGIN, 80 END @@ -2047,9 +2088,9 @@ BEGIN IDD_PP_FOLDER, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 198 + RIGHTMARGIN, 197 TOPMARGIN, 7 - BOTTOMMARGIN, 149 + BOTTOMMARGIN, 126 END IDD_NEWMAIL, DIALOG @@ -2063,9 +2104,9 @@ BEGIN IDD_NEWFOLDER, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 248 + RIGHTMARGIN, 211 TOPMARGIN, 7 - BOTTOMMARGIN, 55 + BOTTOMMARGIN, 63 END IDD_HISTORYBAR, DIALOG @@ -2094,7 +2135,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 198 TOPMARGIN, 7 - BOTTOMMARGIN, 154 + BOTTOMMARGIN, 152 END IDD_MORE_DISK_CHOICES, DIALOG @@ -2197,14 +2238,31 @@ BEGIN BOTTOMMARGIN, 99 END - IDD_ADVANCED_SEARCH, DIALOG + IDD_ADVANCED_SEARCH, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 180 + RIGHTMARGIN, 205 TOPMARGIN, 7 - BOTTOMMARGIN, 99 + BOTTOMMARGIN, 110 END + IDD_PP_SHARING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 197 + TOPMARGIN, 7 + BOTTOMMARGIN, 126 + END + + IDD_SYNCHRONIZE_EXIT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 211 + TOPMARGIN, 7 + BOTTOMMARGIN, 64 + END +END + IDD_NETPROFILE_LOGIN, DIALOG BEGIN LEFTMARGIN, 7 @@ -2216,9 +2274,17 @@ BEGIN IDD_HEADER_LIST, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 175 + RIGHTMARGIN, 205 TOPMARGIN, 7 - BOTTOMMARGIN, 109 + BOTTOMMARGIN, 110 + END + + IDD_SEARCH, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 287 + TOPMARGIN, 7 + BOTTOMMARGIN, 159 END IDD_NOTIFY, DIALOG @@ -2232,12 +2298,13 @@ BEGIN IDD_ADVANCED_LDAP_SEARCH, DIALOG BEGIN LEFTMARGIN, 4 - RIGHTMARGIN, 294 + RIGHTMARGIN, 375 TOPMARGIN, 4 BOTTOMMARGIN, 140 END - IDD_BASIC_SEARCH, DIALOG + + IDD_BASIC_SEARCH, DIALOG BEGIN LEFTMARGIN, 4 RIGHTMARGIN, 294 @@ -2264,7 +2331,7 @@ BEGIN IDD_PREF_CHOOSE_FOLDER, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 223 + RIGHTMARGIN, 244 TOPMARGIN, 7 BOTTOMMARGIN, 83 END @@ -2338,12 +2405,6 @@ BEGIN IDC_COMBO_SCOPE, 0x403, 24, 0 0x6e69, 0x5320, 0x6c65, 0x6365, 0x6574, 0x2064, 0x654e, 0x7377, 0x7267, 0x756f, 0x7370, 0x0020, - IDC_COMBO_AND_OR, 0x403, 33, 0 -0x614d, 0x6374, 0x2068, 0x6c61, 0x206c, 0x666f, 0x7420, 0x6568, 0x6620, -0x6c6f, 0x6f6c, 0x6977, 0x676e, 0x7720, 0x6568, 0x6572, "\000" - IDC_COMBO_AND_OR, 0x403, 33, 0 -0x614d, 0x6374, 0x2068, 0x6e61, 0x2079, 0x666f, 0x7420, 0x6568, 0x6620, -0x6c6f, 0x6f6c, 0x6977, 0x676e, 0x7720, 0x6568, 0x6572, "\000" 0 END @@ -2373,7 +2434,7 @@ BEGIN IDC_COMBO_AND_OR, 0x403, 33, 0 0x614d, 0x6374, 0x2068, 0x6c61, 0x206c, 0x666f, 0x7420, 0x6568, 0x6620, 0x6c6f, 0x6f6c, 0x6977, 0x676e, 0x7720, 0x6568, 0x6572, "\000" - IDC_COMBO_AND_OR, 0x403, 33, 0 + 1503, 0x403, 33, 0 0x614d, 0x6374, 0x2068, 0x6e61, 0x2079, 0x666f, 0x7420, 0x6568, 0x6620, 0x6c6f, 0x6f6c, 0x6977, 0x676e, 0x7720, 0x6568, 0x6572, "\000" 0 @@ -2401,6 +2462,7 @@ BEGIN IDS_TRANSFER_STATUS " " IDS_SECURITY_STATUS " " IDS_SIGNED_STATUS " " + IDS_ONLINE_STATUS " " END STRINGTABLE DISCARDABLE @@ -2509,11 +2571,14 @@ BEGIN IDS_PROFILE_DELETED "The profile has been deleted from the profile list.\r\nNote that this does NOT remove the files from your disk." IDS_CONFIRM_DELETE "Delete profile: %s?" IDS_BAD_DIRECTORY2 "Error: The profile directory: \n%s\ndoesn't exist.\n\nPress OK to run the SetupWizard or Cancel to Quit" + IDS_NEWADDRESSBOOK "New Address Book..." + IDS_NEWDIRECTORY "New Directory..." + IDS_DELETEFROMALL "Delete &From All Lists" IDS_INSUFFICIENT_DISKSPACE_MOVE "Insufficient disk space!\n\nUnable to move %s:\n %s\nto directory:\n %s\n\nPlease free up %s MB of disk space and then press O.K.\n\nIf you press Cancel, this directory will not get moved and you will not be able to access your old data files." IDS_INSUFFICIENT_DISKSPACE_COPY "Insufficient disk space!\n\nUnable to copy %s:\n %s\nto directory:\n %s\n\nPlease free up %s MB of disk space and then press O.K.\n\nIf you press Cancel, this directory will not get copied and you will not be able to access your old data files." - IDS_PROFDIR_EXISTS "The selected profile directory already exists and may contain data files. To continue creating the new profile, choose Continue. To change the profile directory, choose Cancel and then use Back to return and change the profile directory." + IDS_PROFDIR_EXISTS "The selected profile directory already exists and may contain data files. To continue creating the new profile, choose OK. To change the profile directory, choose Cancel and then use Back to return and change the profile directory." IDS_PROFILE_SELECTOR_TITLE "Select Profile" IDS_PE_INTROPAGE_TEXT "If you are the only person using this copy of Communicator, you may create several profiles for yourself. If you are sharing this copy of Communicator with other users, each user should create his or her own profile." END @@ -2527,7 +2592,10 @@ END STRINGTABLE DISCARDABLE BEGIN +#ifdef MOZ_SECURITY IDS_STATBAR_SECURITY "Show security information for this page" +#endif + IDS_STATBAR_ONLINE "Show online/offline state" END STRINGTABLE DISCARDABLE @@ -2585,6 +2653,8 @@ END STRINGTABLE DISCARDABLE BEGIN + ID_MESSAGE_FORWARDBUTTON + "Forward the selected message\nForward selected message\nForward" ID_MESSAGE_REPLYBUTTON "Reply to one or more recipients\nReply to the message\nReply" ID_MESSAGE_MARKBUTTON "Mark message\nMark Messages\nMark" ID_WINDOW_NETCASTER "Netcaster" @@ -2643,14 +2713,14 @@ BEGIN ID_PERSONAL_TOOLBAR "Personal Toolbar" ID_LOCATION_TOOLBAR "Location Toolbar" IDS_TOOLBARFOLDER "Personal Toolbar Folder" - IDS_MENU_DELETENEWSGROUP "&Delete Discussion Group" + IDS_MENU_DELETENEWSGROUP "Unsu&bscribe" END STRINGTABLE DISCARDABLE BEGIN IDS_POPUP_HIGH "&High" IDS_POPUP_HIGHEST "Highes&t" - IDS_MSGSTODOWNLOAD "There are %ld new message headers to download for this discussion:" + IDS_MSGSTODOWNLOAD "There are %ld new message headers to download for this newsgroup:" IDS_PROGRESS "Progress" IDS_SET_PERSONALTOOLBAR "Set as Toolbar &Folder" IDS_TURNOFF_PERSONALTOOLBAR "Turn Off Toolbar &Folder" @@ -2693,8 +2763,10 @@ END STRINGTABLE DISCARDABLE BEGIN + IDS_SYNCHRONIZING "Synchronizing" IDS_NETCASTER_MENU "N&etcaster\tCtrl+8" IDS_OPENING_FILE "Opening:\n%s using %s." + IDS_MULTIPLE_MATCHES "" END STRINGTABLE DISCARDABLE @@ -2744,7 +2816,7 @@ BEGIN IDS_JSAPP "[JavaScript Application]" IDS_IS_ENCRYPTED "ENCRYPTED" IDS_NOT_ENCRYPTED "NOT ENCRYPTED" - IDS_NOTHING_SUBSCRIBED "You must first subscribe to one or more discussion groups before\nyou can select anything for downloading. Goto ""Join\nDiscussions"" under the main ""File"" menu option, and\nsubrscribe to the desired discussion groups." + IDS_NOTHING_SUBSCRIBED "You must first subscribe to one or more Newsgroups before\nyou can select anything for downloading. Goto ""Subscribe\nto Newsgroups"" under the main ""File"" menu option, and\nsubscribe to the desired Newsgroups." IDS_NO_TEMP_DIRECTORY "No default temp directory exists!" IDS_STUB_PREFIX "cmd" END @@ -2820,7 +2892,7 @@ STRINGTABLE DISCARDABLE BEGIN IDS_TASKBAR "(TASKBAR)" IDS_NOTIFY_MAIL1_TIP "Mailbox" - IDS_NOTIFY_NEWS_TIP "Discussion Groups" + IDS_NOTIFY_NEWS_TIP "Newsgroups" IDS_NOTIFY_WEB_TIP "Navigator" ID_OPTIONS_TITLELOCATION_BAR "Show or hide the location bar" ID_FILE_VIEWSOURCE "View the source of the current page" @@ -2940,7 +3012,7 @@ BEGIN ID_FILE_SAVEAS "Save this address book to a file\nSave As" IDS_POPUP_COPYEMBEDDATA "&Copy " ID_OPTIONS_SHOWJAVACONSOLE "Open the Java Console" - ID_FILE_MAILNEW "Create a new mail or discussion message\nCompose (Ctrl+M)\nCompose" + ID_FILE_MAILNEW "Create a new mail or newsgroup message\nCompose (Ctrl+M)\nCompose" END STRINGTABLE DISCARDABLE @@ -3049,7 +3121,7 @@ END STRINGTABLE DISCARDABLE BEGIN - ID_NEWS_POSTNEW "Create a new mail or discussion message\nNew Message (Ctrl+N)\nNew Msg" + ID_NEWS_POSTNEW "Create a new mail or newsgroup message\nNew Message (Ctrl+N)\nNew Msg" ID_MESSAGE_MARKASREAD "Mark selected messages as read\nMark Read" ID_MESSAGE_MARKASUNREAD "Mark selected messages as unread\nMark Unread" ID_MESSAGE_MARK "Flag the current message" @@ -3065,13 +3137,13 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_ADD_MAIL_SERVER "Add Mail Server" - IDS_MAIL_SERVER_PROPERTY "Mail Server Property" + IDS_MAIL_SERVER_PROPERTY "Mail Server Properties" + IDS_NO_ACLSHARING "This server does not support shared folders." IDS_SERVER_POP3_STATIC "POP3 Server" IDS_SERVER_IMAP_STATIC "IMAP Server" IDS_POP3_ONLY_ONE "You cannot add another server, because you are using POP." IDS_REMOVE_MAILHOST_CONFIRM - "Are you sure you want to delete this server? All mail downloaded from this server will be erased from your hard drive, and you cannot undo." + "Are you sure you want to delete this server?" IDS_MAIL_SERVER "Mail Server:" IDS_HELP_BUTTON "Help" IDS_BROWSE_BUTTON "Browse..." @@ -3082,9 +3154,9 @@ BEGIN ID_FILE_OPENFOLDER "Open selected folder or group" ID_FILE_OPENFOLDERNEW "Open selected folder or group in new window" ID_FILE_OPENFOLDERREUSE "Open selected folder or group in existing window if possible" - ID_FILE_GETNEWMAIL "Gets mail and discussion group messages\nGet messages (Ctrl+T)\nGet Msg" + ID_FILE_GETNEWMAIL "Gets mail and Newsgroup messages\nGet messages (Ctrl+T)\nGet Msg" ID_FILE_DELIVERMAILNOW "Send messages in outbox folder now" - ID_FILE_NEWFOLDER "Create a new mail folder or a new discussion group\nNew mail folder\nNew Folder" + ID_FILE_NEWFOLDER "Create a new mail folder or a new Newsgroup\nNew mail folder\nNew Folder" ID_FILE_COMPRESSTHISFOLDER "Remove deleted messages from folder\nCompress Folder" ID_FILE_COMPRESSALLFOLDERS "Compress all mail folders" @@ -3093,6 +3165,11 @@ END STRINGTABLE DISCARDABLE BEGIN + ID_EDIT_DELETE_3PANE "Delete the selected message\nDelete selected message\nDelete" + IDS_DELETEMESSAGE_STATUS "Delete the selected message" + IDS_DELETEFOLDER_STATUS "Delete the selected folder" + IDS_DELETEMESSAGE_TOOLTIP "Delete selected message" + IDS_DELETEFOLDER_TOOLTIP "Delete selected folder" ID_EDIT_DELETEMESSAGE "Delete the selected message\nDelete selected message \nDelete" ID_EDIT_SELECTTHREAD "Select all messages in this thread or folder" ID_EDIT_SELECTMARKEDMESSAGES "Select all flagged messages in this folder" @@ -3113,10 +3190,10 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_MENU_DELETENEWSHOST "&Delete Discussion Group Server" + IDS_MENU_DELETENEWSHOST "&Delete Newsgroup Server" IDS_MENU_DELETESELECTION "&Delete Selection" - IDS_STATUS_DELETENEWSGROUP "Unsubscribe from this discussion" - IDS_STATUS_DELETENEWSHOST "Remove this discussion group server" + IDS_STATUS_DELETENEWSGROUP "Unsubscribe from this newsgroup" + IDS_STATUS_DELETENEWSHOST "Remove this Newsgroup server" IDS_STATUS_DELETESELECTION "Delete the currently selected items" IDS_CREATEDON "Created On" IDS_SEARCHING "Searching..." @@ -3150,6 +3227,20 @@ BEGIN IDS_SPECIAL_FOLDER "&Folder ""%s"" on" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_READNEWS_STATIC5 "You do not have to enter this information now. Click Finish when you are done." + IDS_SERVER_EXISTS "This server is already added to the list. " + IDS_INVALID_EMAIL "Please enter a valid email address. (e.g. jdoe@company.com)" + IDS_READNEWS_STATIC2 "&Port" + IDS_PE_ACCT_SETUP "Acct. Setup" + IDS_CREATING_FOLDER "Creating Mail Folder" + IDS_DEFAULT_STRING " (Default)" + IDS_COPY_NEWS_MSG "Choose where you would like your sent newsgroup messages to be stored:" + IDS_COPY_DRAFTS "Choose where you would like your drafts to be stored:" + IDS_COPY_TEMPLATES "Choose where you would like your templates to be stored:" +END + STRINGTABLE DISCARDABLE BEGIN IDS_SENDNOW "Sen&d Now" @@ -3176,13 +3267,13 @@ BEGIN IDS_ADD_LDAP_SERVER "Add Directory Server" IDS_LDAP_SERVER_PROPERTY "Directory Server Property" IDS_ADD_NEWS_SERVER "Add News Server" - IDS_NEWS_SERVER_PROPERTY "News Server Property" + IDS_NEWS_SERVER_PROPERTY "Newsgroup Server Properties" END STRINGTABLE DISCARDABLE BEGIN IDS_TEXT_FOLDERS_SELECTED "Mail Folder(s)" - IDS_TEXT_DISCUSSIONS_SELECTED "Discussion Group(s)" + IDS_TEXT_DISCUSSIONS_SELECTED "Newsgroup(s)" IDS_NO_RUN_WHILE_PROFILING "Cannot restart Communicator while ""Profile Manager"" is running. Either exit or complete ""Profile Manger"" and then try again." IDS_SENDINGMESSAGE "Sending Message" @@ -3193,7 +3284,9 @@ BEGIN IDS_BOTTOMMARGINERROR "Bottom Margin" IDS_RIGHTMARGINERROR "Right Margin" IDS_LEFTMARGINERROR "Left Margin" - IDS_VIRTUALNEWSGROUP "Virtual Discussion Group" + IDS_VIRTUALNEWSGROUP "Virtual Newsgroup" + IDS_VIRTUALNEWSGROUPDESC + "Saving search criteria will create a Virtual Newsgroup based on that criteria. The Virtual Newsgroup will be available from the Message Center" IDS_PHONE "Phone" IDS_CHECKING "Checking..." IDS_DEFAULTSAVEAS "untitled.txt" @@ -3236,7 +3329,7 @@ BEGIN ID_VIEW_SHOWSUBJECT "Show the Subject field" ID_VIEW_SHOWATTACHMENT "Show the attachments field" ID_FILE_ADDNEWSGROUP "Add and subsribe to discussions\nAdd a discussions\nAdd Group" - ID_FILE_GETMOREMESSAGES "Get mail and discussion messages\nGet messages (Ctrl+T)\nGet Msg" + ID_FILE_GETMOREMESSAGES "Get mail and newsgroup messages\nGet messages (Ctrl+T)\nGet Msg" ID_EDIT_CANCELMESSAGE "Remove the selected message from the newsgroup" ID_MESSAGE_FORWARDQUOTED "Forward the current message as quoted text\nForward Quoted" @@ -3296,6 +3389,7 @@ BEGIN IDS_MENU_POSTMAILREPLY "Reply to Sender and Gro&up" IDS_MENU_FORWARD "&Forward" IDS_MENU_FORWARDQUOTED "Forward &Quoted" + IDS_MENU_FORWARDINLINE "Forward &Inline" IDS_MENU_REPLY "&Reply to Sender\tCtrl+R" IDS_MENU_REPLYALL "Reply to Sender and &All Recipients\tCtrl+Shift+R" IDS_CLOSEWINDOWS_EXIT "Close all windows and exit Mozilla?" @@ -3434,7 +3528,7 @@ END STRINGTABLE DISCARDABLE BEGIN - ID_EDIT_SEARCH "Search mail and discussion group messages" + ID_EDIT_SEARCH "Search mail and Newsgroup messages" ID_VIEW_ATTACHINLINE "Message attachments are viewed as inline objects" ID_VIEW_ATTACHLINKS "Attachments are presented as links" ID_OPTIONS_IMMEDIATEDELIVERY "Send Now" @@ -3490,8 +3584,8 @@ END STRINGTABLE DISCARDABLE BEGIN - ID_MESSAGE_POSTREPLY "Post a reply to the discussion group\nPost reply\nRe:Msg" - ID_MESSAGE_POSTANDREPLY "Post reply to the discussion group and mail a reply to the author\nPost and reply\nRe:Both" + ID_MESSAGE_POSTREPLY "Post a reply to the Newsgroup\nPost reply\nRe:Msg" + ID_MESSAGE_POSTANDREPLY "Post reply to the Newsgroup and mail a reply to the author\nPost and reply\nRe:Both" ID_FILE_SAVEMESSAGES "Save selected message(s) to a file\nSave As" ID_MESSAGE_STOP "Interrupt the current transfer\nStop loading (ESC)\nStop" ID_MESSAGE_PREVIOUSUNREAD "Go to the previous unread message" @@ -3499,7 +3593,7 @@ END STRINGTABLE DISCARDABLE BEGIN - ID_FILE_NEWMESSAGE "Create a new mail or discussion message\nNew Message (Ctrl+M)\nNew Msg" + ID_FILE_NEWMESSAGE "Create a new mail or newsgroup message\nNew Message (Ctrl+M)\nNew Msg" ID_FILE_OPENMESSAGE "Open the selected messages\nOpen Message\nOpen" ID_FILE_OPENMESSAGENEW "Open the selected message in a new window" ID_FILE_OPENMESSAGEREUSE @@ -3528,7 +3622,7 @@ END STRINGTABLE DISCARDABLE BEGIN ID_TOOLS_MAIL "Access mail folders" - ID_TOOLS_NEWS "Access Discussion Groups" + ID_TOOLS_NEWS "Access Newsgroups" END STRINGTABLE DISCARDABLE @@ -3542,7 +3636,7 @@ STRINGTABLE DISCARDABLE BEGIN ID_DIRECTORY "Search for a directory entry\nLook up an address\nDirectory" ID_FILE_NEWNEWSGROUP "Create a new newsgroup" - ID_FILE_SUBSCRIBE "Subscribe to discussion groups\nAdd a discussion group\nSubscribe" + ID_FILE_SUBSCRIBE "Subscribe to Newsgroups\nAdd a Newsgroup\nSubscribe" ID_MESSAGE_MARKALLREAD "Mark all messages read\nMark all read\nAll Read" END @@ -3577,6 +3671,7 @@ BEGIN ID_VIEW_NEWTHREADS "View threads with new messages" ID_VIEW_KILLEDTHREADS "Show all ignored threads" ID_EDIT_LDAPSEARCH "Search for a directory entry" + ID_MESSAGE_FIRSTUNREAD "Go to the first unread message" ID_MESSAGE_KILLCATEGORY "Ignore this category" END @@ -3630,10 +3725,10 @@ STRINGTABLE DISCARDABLE BEGIN IDS_BREADCRUMB_QF_TIP "Breadcrumb QuickFile" ID_CUSTOMIZE_TOOLBAR "Customize Toolbar" - IDS_NEWSGROUP_NAME "Discussion group name" + IDS_NEWSGROUP_NAME "Newsgroup name" IDS_SUBSCRIBE "S&ubscribe" IDS_POSTINGS "Messages" - IDS_SUBSCRIBE_GROUP "Communicator: Subscribe to Folders and Discussion Groups" + IDS_SUBSCRIBE_GROUP "Communicator: Subscribe to Newsgroups" IDS_MAIL_THISFOLDER "This Folder" IDS_HIDE_COMMANDTOOLBAR "Hide &Navigation Toolbar" IDS_SHOW_COMMANDTOOLBAR "Show &Navigation Toolbar" @@ -3662,7 +3757,7 @@ BEGIN ID_CREATE_CARD "Create and edit your address book card" ID_WINDOW_CALENDAR "Calendar" ID_BIG_SWITCH "Switch network connectedness mode\nBig Switch\nBig Switch" - ID_EDIT_SERVER "Go to discussion group server administration page" + ID_EDIT_SERVER "Go to Newsgroup server administration page" END STRINGTABLE DISCARDABLE @@ -3680,7 +3775,7 @@ BEGIN IDS_PORT_RANGE "Port number should be between 0 and 65535." IDS_WIZARD_SENDMAIL "The information below is needed before you can send mail. If you do not know the information requested, please contact your system administrator or Internet Service Provider." IDS_WIZARD_READMAIL "The information below is needed before you can receive mail. If you do not know the information requested, please contact your system administrator or Internet Service Provider." - IDS_WIZARD_READNEWS "The information below is needed before you can read discussion groups. If you do not know the information requested, please contact your system administrator or Internet Service Provider." + IDS_WIZARD_READNEWS "The information below is needed before you can read newsgroups. If you do not know the information requested, please contact your system administrator or Internet Service Provider." END STRINGTABLE DISCARDABLE @@ -3703,13 +3798,13 @@ BEGIN IDS_READMAIL_EG1 "(e.g. jsmith)" IDS_FINISH "Finish" IDS_NEXT "Next >" - IDS_WIZARD_COVER "This wizard will help you set up Preferences information that is needed so you can send and receive mail and discussion group messages. To edit this information in the future, change the preferences for Mail && Groups, which are found in the Edit menu." + IDS_WIZARD_COVER "This wizard will help you set up Preferences information that is needed so you can send and receive mail and newsgroup messages. To edit this information in the future, change the preferences for Mail && Groups, which are found in the Edit menu." IDS_COVER_STATIC1 "To begin entering information, click Next." IDS_SENDMAIL_STATIC2 "E&mail Address:" IDS_SENDMAIL_EG1 "(e.g. John Smith)" IDS_SENDMAIL_EG2 "(e.g. jsmith@company.com)" IDS_SENDMAIL_STATIC3 "O&utgoing mail (SMTP) server:" - IDS_READNEWS_STATIC1 "&Discussion groups (news) server:" + IDS_READNEWS_STATIC1 "&Newsgroups (news) server:" IDS_SENDREADMAIL_STATIC5 "You do not have to enter this information now. Click next to continue." END @@ -3741,15 +3836,6 @@ BEGIN ID_POPUP_MAILTO "Send the current page to a recipient" END -STRINGTABLE DISCARDABLE -BEGIN - IDS_READNEWS_STATIC5 "You do not have to enter this information now. Click Finish when you are done." - IDS_SERVER_EXISTS "This server is already added to the list. " - IDS_INVALID_EMAIL "Please enter a valid email address. (e.g. jsmith@company.com)" - IDS_READNEWS_STATIC2 "&Port" - IDS_PE_ACCT_SETUP "Acct. Setup" -END - STRINGTABLE DISCARDABLE BEGIN ID_FILE_NEWCATEGORY "Create a new category" @@ -3760,14 +3846,15 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_POPUP_OPENNEWSGROUP "&Open Discussion Group" - IDS_POPUP_OPENNEWSGROUPNEWWINDOW "Open Discussion Group in New Windo&w" - IDS_POPUP_REMOVENEWSGROUP "&Remove Discussion Group" + IDS_POPUP_PROPERTIES "&Properties" + IDS_POPUP_OPENNEWSGROUP "&Open Newsgroup" + IDS_POPUP_OPENNEWSGROUPNEWWINDOW "Open Newsgroup in New Windo&w" + IDS_POPUP_REMOVENEWSGROUP "&Remove Newsgroup" IDS_OPENACCEL "\tCtrl+O" - IDS_POPUP_MARKNEWSGROUPREAD "Mar&k Discussion Group Read" + IDS_POPUP_MARKNEWSGROUPREAD "Mar&k Newsgroup Read" IDS_POPUP_UPDATEMESSAGECOUNT "&Update Message Count" - IDS_POPUP_JOINNEWSGROUP "&Subscribe to Discussion Groups..." - IDS_POPUP_REMOVENEWSHOST "&Remove Discussion Group Server" + IDS_POPUP_JOINNEWSGROUP "&Subscribe to Newsgroups..." + IDS_POPUP_REMOVENEWSHOST "&Remove Newsgroup Server" IDS_POPUP_NEWFOLDER "&New Folder" IDS_POPUP_OPENMESSAGE "&Open Message" IDS_POPUP_OPENMESSAGENEWWINDOW "Open Message in New Windo&w" @@ -3796,7 +3883,7 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_MAILSERVERPROP "Mail Server Properties" - IDS_NEWSHOSTPROP "Discussion Group Server Properties" + IDS_NEWSHOSTPROP "Newgroup Server Properties" IDS_CATEGORYPROP "Category Properties" IDS_SEARCHMESSAGES "Search Messages" IDS_SEARCHLDAP "Search Directory" @@ -3805,8 +3892,8 @@ BEGIN IDS_MENU_ALLCATEGORIES "&All Categories\tCtrl+A" IDS_POPUP_FOLDERPROP "Folder Propertie&s" IDS_POPUP_MAILSERVERPROP "Mail Server Propertie&s" - IDS_POPUP_NEWSHOSTPROP "Discussion Group Server Propertie&s" - IDS_POPUP_NEWSGROUPPROP "Discussion Group Propertie&s" + IDS_POPUP_NEWSHOSTPROP "Newsgroup Server Propertie&s" + IDS_POPUP_NEWSGROUPPROP "Newsgroup Propertie&s" IDS_POPUP_SETTOTOOLBAR "Set as Toolbar Folde&r" IDS_POPUP_UNSETTOOLBAR "Remove as Toolbar Folde&r" IDS_POPUP_SAVEAS "&Save As..." @@ -3857,7 +3944,7 @@ STRINGTABLE DISCARDABLE BEGIN IDS_PATHNAME "PathName" IDS_SIZE "Size" - IDS_MENU_GETNEXT "Ne&xt %d" + IDS_MENU_GETNEXT "Get Ne&xt %d" IDS_UNKNOWN_DOCTYPE "Unknown Document Type" IDS_SAVE_VIEWER "Viewer:" IDS_UNKNOWN_TIMELEFT "Unknown" @@ -3866,7 +3953,15 @@ BEGIN IDS_CANT_CLOSE "Error while closing file." IDS_CANT_CLEANUP "Error removing interrupted download from disk." IDS_FOLDERPROP "Folder Properties" - IDS_NEWSGROUPPROP "Discussion Group Properties" + IDS_NEWSGROUPPROP "Newsgroup Properties" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DOWNLOAD "&Download" + IDS_DOWNLOAD_LIST "Offline Item Name" + IDS_ADDSENDER "Add Sender to Address Book" + IDS_ADDALL "Add All to AddressBook" END STRINGTABLE DISCARDABLE @@ -3885,7 +3980,7 @@ END STRINGTABLE DISCARDABLE BEGIN ID_SORT_BYSTATUS "Sort message by status" - ID_FILE_NEWNEWSHOST "Add a discussion group server (news host)" + ID_FILE_NEWNEWSHOST "Add a Newsgroup server (news host)" ID_SORT_BYSIZE "Sort messages by message size" ID_SORT_BYUNREAD "Sort message by unread status" ID_EDIT_MANAGEMAILACCOUNT @@ -3942,7 +4037,7 @@ BEGIN IDS_FINDINPAGE "&Find in Page...\tCtrl+F" IDS_FINDINFRAME "&Find in Frame...\tCtrl+F" IDS_BROWSER_STOP_TIP "Stop loading this page" - IDS_MENU_NEWNEWSGROUP "Ne&w Discussion Group" + IDS_MENU_NEWNEWSGROUP "Ne&w Newsgroup" IDS_POPUP_OPENSELECTION "&Open Selection" IDS_MENU_IGNORETHREAD "Ignor&e Thread\tK" IDS_MENU_IGNORECATEGORY "Ignor&e Category\tK" @@ -3975,8 +4070,10 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_VIRTUALNEWSGROUPDESC - "Saving search criteria will create a Virtual Discussion Group based on that criteria. The Virtual Discussion Group will be available from the Message Center" + IDS_MENU_COMPRESSFOLDERS "Compress Fol&ders" + IDS_MENU_COMPRESSFOLDER "Compress Fol&der" + IDS_SEARCHRESULTS "" + IDS_GETINFO "Get Info" END STRINGTABLE DISCARDABLE @@ -4001,6 +4098,21 @@ BEGIN IDS_ADRSEARCH "Search" IDS_ADVSEARCH_TITLE "Advanced Search" IDS_BASICSEARCH_TITLE "Basic Search" + IDS_ADVSEARCH_PROPERTY_SHEET "Search Options" + IDS_ADVFILTER_PROPERTY_SHEET "Advanced Options" + IDS_ITEMSMATCHING "Items Matching" + IDS_CONFERENCE_MENU "Conference\tCtrl+5" + IDS_WINDOW_MENU "Window" + IDS_NAMECOMPLETIONON "Autocomplete Address\tCtrl+D" + IDS_NAMECOMPLETIONOFF "Do Not Autcomplete Address\tCtrl+D" + ID_MIGRATION_TOOLS "Migrate from other applications such as Eudora and Outlook" + IDS_SENDONLINE "Send unsent message when going online?" + IDS_GOONLINE "Go Online" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_SYNCHRONIZE "Synchronize\nSetup offline items and synchronize\nSetup offine items and synchronize" END STRINGTABLE DISCARDABLE diff --git a/mozilla/cmd/winfe/msgfrm.cpp b/mozilla/cmd/winfe/msgfrm.cpp index 0ce7ed1906c..4a1fba4d5a4 100755 --- a/mozilla/cmd/winfe/msgfrm.cpp +++ b/mozilla/cmd/winfe/msgfrm.cpp @@ -33,6 +33,8 @@ #include "msgview.h" #include "template.h" #include "mailqf.h" +#include "abcom.h" +#include "addrfrm.h" //for MOZ_NEWADDR #ifdef _DEBUG #undef THIS_FILE @@ -61,7 +63,7 @@ CMessageFrame::CMessageFrame() // All our favorite hotkeys LoadAccelerators( IDR_ONEKEYMESSAGE ); - m_iAttachMenuPos = 2; + m_iAttachMenuPos = 1; } CMessageFrame::~CMessageFrame() @@ -80,8 +82,8 @@ CMessageFrame::~CMessageFrame() extern UINT MailCodes[10]; extern int MailIndices[10]; -extern UINT NewsCodes[10]; -extern int NewsIndices[10]; +extern UINT NewsCodes[11]; +extern int NewsIndices[11]; BOOL CMessageFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { @@ -114,6 +116,9 @@ BOOL CMessageFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext m_pMaster = WFE_MSGGetMaster(); m_pPane = MSG_CreateMessagePane( pWinCX->GetContext(), m_pMaster ); +#ifdef MOZ_NEWADDR + AB_SetShowPropertySheetForEntryFunc(m_pPane, ShowPropertySheetForEntry); +#endif m_pMessagePane = m_pPane; MSG_SetFEData(m_pPane, (LPVOID) (LPUNKNOWN) this ); @@ -260,6 +265,7 @@ static const UINT BASED_CODE indicators[] = IDS_SIGNED_STATUS, IDS_TRANSFER_STATUS, ID_SEPARATOR, + IDS_ONLINE_STATUS, IDS_TASKBAR }; @@ -430,7 +436,7 @@ void CMessageFrame::OnContinue() void CMessageFrame::OnContainer() { - MSG_FolderInfo* folderInfo; + MSG_FolderInfo* folderInfo = NULL; MessageKey key; MSG_ViewIndex viewIndex; @@ -439,7 +445,8 @@ void CMessageFrame::OnContainer() &key, &viewIndex); - C3PaneMailFrame::Open( folderInfo, key ); + if (folderInfo) + C3PaneMailFrame::Open( folderInfo, key ); } void CMessageFrame::OnUpdateContainer( CCmdUI * pCmdUI ) @@ -536,7 +543,7 @@ void CMessageFrame::PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, MSG_PANE_CHANGED_NOTIFY_CODE notify, int32 value) { if ( notify == MSG_PaneNotifyLastMessageDeleted || - notify == MSG_PaneNotifyMessageDeleted ) { + (notify == MSG_PaneNotifyMessageDeleted && GetCurMessage() == value)) { PostMessage( WM_CLOSE, (WPARAM) 0, (LPARAM) 0 ); } else if (notify == MSG_PaneNotifyFolderLoaded) { MSG_FolderInfo *folderInfo = GetCurFolder(); @@ -592,7 +599,9 @@ void CMessageFrame::SwitchUI( ) int nButtons = (m_bNews ? sizeof(NewsCodes) : sizeof(MailCodes)) /sizeof(UINT); for(int i = 0; i < nButtons; i++) { - if ( aidButtons[i] == ID_MESSAGE_FILE ) { + UINT id = aidButtons[i]; + + if ( id == ID_MESSAGE_FILE ) { CMailQFButton *pFileButton = new CMailQFButton; pFileButton->Create( CRect(0,0,0,0), pToolWnd, ID_MESSAGE_FILE); pIToolBar->AddButton(pFileButton, i); @@ -603,16 +612,19 @@ void CMessageFrame::SwitchUI( ) WFE_ParseButtonString( aidButtons[i], statusStr, toolTipStr, textStr ); DWORD dwButtonStyle = 0; - switch (aidButtons[i]) { - case ID_MESSAGE_REPLYBUTTON: + switch (id) { case ID_MESSAGE_MARKBUTTON: dwButtonStyle |= TB_HAS_IMMEDIATE_MENU; break; + case ID_MESSAGE_REPLYBUTTON: case ID_MESSAGE_NEXTUNREAD: dwButtonStyle |= TB_HAS_TIMED_MENU; break; - + case ID_EDIT_DELETE_3PANE: + //we don't want to do 3pane delete in this window + id = ID_EDIT_DELETEMESSAGE; + break; case ID_NAVIGATE_MSG_BACK: break; default: @@ -625,7 +637,7 @@ void CMessageFrame::SwitchUI( ) textStr, toolTipStr, statusStr, m_bNews ? IDR_NEWSTHREAD : IDR_MAILTHREAD, aidxButtons[i], CSize(23,21), - aidButtons[i], -1, dwButtonStyle); + id, -1, dwButtonStyle); pIToolBar->AddButton(pCommandButton, i); } diff --git a/mozilla/cmd/winfe/msgtmpl.cpp b/mozilla/cmd/winfe/msgtmpl.cpp index 965a8d97699..9f8a22bec81 100644 --- a/mozilla/cmd/winfe/msgtmpl.cpp +++ b/mozilla/cmd/winfe/msgtmpl.cpp @@ -69,12 +69,8 @@ void CMsgTemplate::_InitialUpdate(CFrameWnd *pFrame, CFrameWnd *pPrevFrame, // Sanity check size if (size.cx > sx) size.cx = sx; - if (size.cx < 300) - size.cx = 300; if (size.cy > sy) size.cy = sy; - if (size.cy < 300) - size.cy = 300; // Sanity check position if (ptPos.x + size.cx > sx) diff --git a/mozilla/cmd/winfe/msgview.cpp b/mozilla/cmd/winfe/msgview.cpp index 4a7251b4100..8e5f17c7fb5 100644 --- a/mozilla/cmd/winfe/msgview.cpp +++ b/mozilla/cmd/winfe/msgview.cpp @@ -51,6 +51,8 @@ public: CAttachmentDataSource(LPCTSTR lpszURL, LPCTSTR lpszName); virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal); + virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile); + virtual BOOL OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium); }; CAttachmentDataSource::CAttachmentDataSource(LPCTSTR lpszURL, LPCSTR lpszName) @@ -63,13 +65,54 @@ BOOL CAttachmentDataSource::OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* { BOOL bRes = FALSE; - if (!*phGlobal) { + if (sysInfo.m_bWinNT && !*phGlobal) + { bRes = CSaveCX::SaveToGlobal(phGlobal, m_csURL, m_csName); } return bRes; } +BOOL CAttachmentDataSource::OnRenderFileData(LPFORMATETC lpFormatEtc, CFile *pFile) +{ + BOOL bRes = FALSE; + + if (pFile) { + bRes = CSaveCX::SaveToFile(pFile, m_csURL, m_csName); + } + + return bRes; +} + +BOOL CAttachmentDataSource::OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM + lpStgMedium) +{ + if (lpFormatEtc->tymed & TYMED_ISTREAM) + { + COleStreamFile file; + if (lpStgMedium->tymed == TYMED_ISTREAM) + { + ASSERT(lpStgMedium->pstm != NULL); + file.Attach(lpStgMedium->pstm); + } + else + { + if (!file.CreateMemoryStream()) + AfxThrowMemoryException(); + } + // get data into the stream + if (OnRenderFileData(lpFormatEtc, &file)) + { + lpStgMedium->tymed = TYMED_ISTREAM; + lpStgMedium->pstm = file.Detach(); + return TRUE; + } + if (lpStgMedium->tymed == TYMED_ISTREAM) + file.Detach(); + } + return COleDataSource::OnRenderData(lpFormatEtc, lpStgMedium); +} + #endif ///////////////////////////////////////////////////////////////////// @@ -470,7 +513,10 @@ void CAttachmentTray::OnLButtonDown( UINT nFlags, CPoint point ) formatEtc.ptd = NULL; formatEtc.dwAspect = DVASPECT_CONTENT; formatEtc.lindex = 0; - formatEtc.tymed = TYMED_HGLOBAL; + if (sysInfo.m_bWinNT) + formatEtc.tymed = TYMED_HGLOBAL; + else + formatEtc.tymed = TYMED_ISTREAM; pDataSource->DelayRenderFileData(cfFileContents, &formatEtc); #else @@ -620,14 +666,23 @@ void CMessageBodyView::OnSetFocus(CWnd *pOldWnd) { CNetscapeView::OnSetFocus(pOldWnd); - ((CMessageView*)GetParent())->UpdateFocusFrame(); + CMessageView* pParentView = (CMessageView*)GetParent(); + if (pParentView->GetParentFrame()->IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) + { + pParentView->UpdateFocusFrame(); + ((C3PaneMailFrame*)pParentView->GetParentFrame())->SetFocusWindow(this); + } } void CMessageBodyView::OnKillFocus(CWnd *pOldWnd) { CNetscapeView::OnKillFocus(pOldWnd); - ((CMessageView*)GetParent())->UpdateFocusFrame(); + CMessageView* pParentView = (CMessageView*)GetParent(); + if (pParentView->GetParentFrame()->IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) + { + ((CMessageView*)GetParent())->UpdateFocusFrame(); + } } ///////////////////////////////////////////////////////////////////// @@ -723,7 +778,7 @@ void CMessageView::OnDraw(CDC* pDC) CWnd* pFocusWnd = GetFocus(); if (pFocusWnd && (pFocusWnd == this || pFocusWnd == m_pViewMessage || pFocusWnd == m_pWndAttachments)) - hBrush = ::CreateSolidBrush( GetSysColor( COLOR_HIGHLIGHT ) ); + hBrush = ::CreateSolidBrush( RGB(0, 0, 0) ); else hBrush = ::CreateSolidBrush( GetSysColor( COLOR_WINDOW ) ); @@ -832,14 +887,23 @@ void CMessageView::OnSetFocus(CWnd *pOldWnd) { CView::OnSetFocus(pOldWnd); - UpdateFocusFrame(); + if (GetParentFrame()->IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) + { + UpdateFocusFrame(); + ((C3PaneMailFrame*)GetParentFrame())->SetFocusWindow(m_pViewMessage); + } + else + m_pViewMessage->SetFocus(); } void CMessageView::OnKillFocus(CWnd *pOldWnd) { CView::OnKillFocus(pOldWnd); - UpdateFocusFrame(); + if (GetParentFrame()->IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) + { + UpdateFocusFrame(); + } } void CMessageView::OnLButtonDown( UINT nFlags, CPoint point ) @@ -886,6 +950,16 @@ void CMessageView::SetCSID(int16 doc_csid) m_pWndAttachments->SetCSID(doc_csid); } +BOOL CMessageView::HasFocus() +{ + CWnd* pFocusWnd = CWnd::GetFocus(); + + return(pFocusWnd == this || pFocusWnd == m_pWndAttachments || + pFocusWnd == m_pViewMessage); + +} + + #ifndef _AFXDLL #undef new #endif diff --git a/mozilla/cmd/winfe/msgview.h b/mozilla/cmd/winfe/msgview.h index fe41f8cec72..c088d3aff35 100644 --- a/mozilla/cmd/winfe/msgview.h +++ b/mozilla/cmd/winfe/msgview.h @@ -107,6 +107,9 @@ public: BOOL AttachmentsVisible() const; void UpdateFocusFrame(); void SetCSID(int16 doc_csid); + //Does this view or its children have focus + BOOL HasFocus(); + CWnd* GetMessageBodyView() { return m_pViewMessage; } protected: diff --git a/mozilla/cmd/winfe/nabapi/maindll.cpp b/mozilla/cmd/winfe/nabapi/maindll.cpp new file mode 100644 index 00000000000..2ef8ba9d4e1 --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/maindll.cpp @@ -0,0 +1,81 @@ +/* -*- 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. + */ +// +// DLLMain to get a handle on an hInstance +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +#include + +// +// global variables +// +HINSTANCE hInstance; + +// +// DLL entry +// +#ifdef WIN32 +/**************************************************************************** + FUNCTION: DllMain(HANDLE, DWORD, LPVOID) + + PURPOSE: DllMain is called by Windows when + the DLL is initialized, Thread Attached, and other times. + Refer to SDK documentation, as to the different ways this + may be called. + + The DllMain function should perform additional initialization + tasks required by the DLL. In this example, no initialization + tasks are required. DllMain should return a value of 1 if + the initialization is successful. + +*******************************************************************************/ +BOOL APIENTRY DllMain(HANDLE hInstLocal, DWORD ul_reason_being_called, LPVOID lpReserved) +{ + hInstance = (HINSTANCE)hInstLocal; + + if (hInstance != NULL) + return 1; + else + return 0; +} + +#else // WIN16 + + +//-------------------------------------------------------------------- +// LibMain( hInstance, wDataSegment, wHeapSize, lpszCmdLine ) : WORD +// +// hInstance library instance handle +// wDataSegment library data segment +// wHeapSize default heap size +// lpszCmdLine command line arguments +// +//-------------------------------------------------------------------- + +int CALLBACK LibMain(HINSTANCE hInstLocal, WORD wDataSegment, WORD wHeapSize, LPSTR lpszCmdLine) +{ + hInstance = hInstLocal; + /* return result 1 = success; 0 = fail */ + if (hInstance != NULL) + return 1; + else + return 0; +} + +#endif // WIN16 + diff --git a/mozilla/cmd/winfe/nabapi/nabapi.cpp b/mozilla/cmd/winfe/nabapi/nabapi.cpp new file mode 100644 index 00000000000..9870e6d63b6 --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/nabapi.cpp @@ -0,0 +1,1907 @@ +/* -*- 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. + */ +// +// Address Book API +// Written by: Rich Pizzarro (rhp@netscape.com) +// March 1998 +// +#include +#include +#include + +#include +#include + +#include "xpapi.h" +#include "trace.h" +#include "nabipc.h" +#include "nabutl.h" +#include "nsstrseq.h" +#include "nabmem.h" + +#include "abapi.h" +#include "nabapi.h" + +#define MAX_MEMARRAY_ENTRIES 2000 + +// +// Necessary tracking variables... +// +nabMemTrackerType *memArray = NULL; + +// +// For remembering memory...how ironic. +// +void +SetPointerArray(LPVOID ptr, BYTE type) +{ +int i; + + if (!memArray) + return; + + for (i=0; im_dwSize = memSize; + openPtr = (NAB_OpenType *)sMem->m_buf; + + // memcpy(sMem->m_buf, ptr to my args, size of my args); + // or openPtr->(type specific thing) = whatever + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_Open, &ipcInfo); + + // Check for IPC completion + if (!openPtr->ipcWorked) + { + result = NAB_FAILURE; + } + + // + // If successfull, then we need to get the information + if (result == NAB_SUCCESS) + { + *id = openPtr->abConnection; + *majorVerNumber = openPtr->majorVerNumber; + *minorVerNumber = openPtr->minorVerNumber; + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + + TRACE("NAB_Open: Returning connection ID=%d\n", *id); + TRACE("NAB_Open: API Version %d.%d\n", *majorVerNumber, *minorVerNumber); + + return(result); +} + +/* + * This closes the connection to the API. Any subsequent call to the NABAPI will fail with + * an NAB_NOT_OPEN return code. + */ +NABError +NAB_Close(NABConnectionID id) +{ + NABIPCType ipcInfo; + + if (id == 0) + return NAB_INVALID_CONNID; + + TRACE("NAB_Close()\n"); + if (!memArray) + { + free(memArray); + memArray = NULL; + } + + // + // Close IPC stuff... + // + nsNAB_CloseAPI(); + + // + // This call locates a Communicator Window, if one is not running, + // it bails out now. + // + if (Is_16_OR_32_BIT_CommunitorRunning() == 0) + { + TRACE("NAB_Close: Communicator not Running\n"); + return NAB_FAILURE; + } + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_Close: Can't get Window\n"); + return NAB_FAILURE; + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for close call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_CloseType *closePtr; + + memSize = sizeof(NAB_CloseType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_Close: SMEM Failure\n"); + return NAB_FAILURE; + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + closePtr = (NAB_CloseType *)sMem->m_buf; + closePtr->abConnection = id; + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + NABError result = SendNABRequest(hWndIPC, NSCP_NAB_Close, &ipcInfo); + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + + TRACE("NAB_Close: Done\n"); + return result; +} + +/******************************************************** + * Address Book Information Calls + ********************************************************/ + +/* + * This call will return a list of pointers to the list of available address + * books in NABAddrBookDescType format. The memory for this array will be allocated + * by the NABAPI and the caller is responsible for freeing the memory with a call + * to the NAB_FreeMemory() function call. NOTE: The call to NAB_FreeMemory() must be + * made for each entry in the returned array and not just a pointer to the array itself. + * The number of address books found will also be returned in the abookCount + * argument to the call. If the returned list is NULL or the abookCount value is + * less than or equal to ZERO, no address books were found. + */ +NABError +NAB_GetAddressBookList(NABConnectionID id, UINT_32 *abookCount, NABAddrBookDescType **aBooks[]) +{ + NABError result; + NABIPCType ipcInfo; + + TRACE("NAB_GetAddressBookList()\n"); + // Some sanity checking... + if (id == 0) + return( NAB_INVALID_CONNID ); + + if (!abookCount) + return( NAB_MEMORY_FAILURE ); + + *abookCount = 0; // Set the address book count to zero + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_GetAddressBookList: Can't get Window\n"); + return(NULL); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_GetAddressBookListType *getPtr; + + memSize = sizeof(NAB_GetAddressBookListType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_GetAddressBookList: SMEM Failure\n"); + return(NULL); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + getPtr = (NAB_GetAddressBookListType *)sMem->m_buf; + getPtr->abConnection = id; + + // memcpy(sMem->m_buf, ptr to my args, size of my args); + // or openPtr->(type specific thing) = whatever + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_GetAddressBookList, &ipcInfo); + + // Check for IPC completion + if (!getPtr->ipcWorked) + { + result = NAB_FAILURE; + } + + // + // If successfull, then we need to get the information + if (result == NAB_SUCCESS) + { + *abookCount = getPtr->abookCount; + + if (getPtr->abookCount > 0) + { + *aBooks = (NABAddrBookDescType **)malloc(getPtr->abookCount * sizeof(NABAddrBookDescType *) ); + if (!*aBooks) + { + result = NAB_MEMORY_FAILURE; + goto EARLYOUT; + } + + for (DWORD i=0; i < getPtr->abookCount; i++) + { + (*aBooks)[i] = (NABAddrBookDescType *)malloc(sizeof(NABAddrBookDescType) ); + if (!(*aBooks)[i]) + { + result = NAB_MEMORY_FAILURE; + goto EARLYOUT; + } + } + + NSstringSeq seq = (NSstringSeq) LoadBlobToMemory((LPSTR) getPtr->blobFileName); + if (seq) + { + DWORD loc = 0; + for (DWORD i=0; iabookCount; i++) + { + // Get the combinations of: + // char *description; // Description of address book - MUST BE UNIQUE + // char *fileName; // The file name of the address book + LPSTR desc = NSStrSeqGet(seq, loc++); + (*aBooks)[i]->description = strdup(CheckNullString(desc)); + TRACE("Description %d: %s\n", i, desc); + + LPSTR fName = NSStrSeqGet(seq, loc++); + (*aBooks)[i]->fileName = strdup(CheckNullString(fName)); + TRACE("Description %d: %s\n", i, fName); + + SetPointerArray(aBooks[i], NAB_ADDRBOOK_STRUCT); + } + } + } + } + + // + // Now time to do some cleanup... + // +EARLYOUT: + NSCloseSharedMemory(sMem, hSharedMemory); + TRACE("NAB_GetAddressBookList: Total entries found =%d\n", *abookCount); + return(result); +} + +/* + * This call will return the default address book for the client. If the + * returned value is NULL, no default address book was found. The memory + * for this return value will be allocated by the ABAPI and the caller is + * responsible for freeing the memory with a call to the NAB_FreeMemory() + * function call. + */ +NABError +NAB_GetDefaultAddressBook(NABConnectionID id, NABAddrBookDescType **aBook) +{ + TRACE("NAB_GetDefaultAddressBook()\n"); + NABError result; + NABIPCType ipcInfo; + + // Some sanity checking... + if (id == 0) + return( NAB_INVALID_CONNID ); + + *aBook = NULL; + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_GetDefaultAddressBook: Can't get Window\n"); + return(NULL); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_GetDefaultAddressBookType *getPtr; + + memSize = sizeof(NAB_GetDefaultAddressBookType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_GetDefaultAddressBook: SMEM Failure\n"); + return(NULL); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + getPtr = (NAB_GetDefaultAddressBookType *)sMem->m_buf; + getPtr->abConnection = id; + getPtr->defaultFound = FALSE; + + // memcpy(sMem->m_buf, ptr to my args, size of my args); + // or openPtr->(type specific thing) = whatever + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_GetDefaultAddressBook, &ipcInfo); + + // Check for IPC completion + if (!getPtr->ipcWorked) + { + result = NAB_FAILURE; + } + + // + // If successfull, then we need to get the information + if (result == NAB_SUCCESS) + { + if (getPtr->defaultFound) + { + *aBook = (NABAddrBookDescType *)malloc( sizeof(NABAddrBookDescType) ); + if (!*aBook) + { + result = NAB_MEMORY_FAILURE; + goto EARLYOUT; + } + + // Get the combinations of: + // char *description; // Description of address book - MUST BE UNIQUE + // char *fileName; // The file name of the address book + (*aBook)->description = strdup(CheckNullString(getPtr->abookDesc)); + (*aBook)->fileName = strdup(CheckNullString(getPtr->abookFileName)); + SetPointerArray(*aBook, NAB_ADDRBOOK_STRUCT); + } + } + + // + // Now time to do some cleanup... + // +EARLYOUT: + NSCloseSharedMemory(sMem, hSharedMemory); + TRACE("NAB_GetDefaultAddressBook: Returning\n"); + return(result); +} + +/* + * This call will create a local/personal address book with the name given. + */ +NABError +NAB_CreatePersonalAddressBook(NABConnectionID id, char *addrBookName, NABAddrBookDescType **addrBook) +{ + NABError result; + NABIPCType ipcInfo; + + TRACE("NAB_CreatePersonalAddressBook()\n"); + + if (id == 0) + return(NAB_INVALID_CONNID); + + if (!ValidNonNullString(addrBookName)) + return(NAB_INVALID_NAME); + + if (!addrBook) + return(NAB_MEMORY_FAILURE); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_CreatePersonalAddressBook: Can't get Window\n"); + return(NAB_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + srand( (unsigned)time( NULL ) ); + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_CreatePersonalAddressBookType *createPtr; + + memSize = sizeof(NAB_CreatePersonalAddressBookType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_CreatePersonalAddressBook: SMEM Failure\n"); + return(NAB_MEMORY_FAILURE); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + createPtr = (NAB_CreatePersonalAddressBookType *)sMem->m_buf; + createPtr->abConnection = id; + + + // Copy the name for the new address book... + lstrcpy(createPtr->abookName, addrBookName); + createPtr->abookFileName[0] = '\0'; + + // memcpy(sMem->m_buf, ptr to my args, size of my args); + // or openPtr->(type specific thing) = whatever + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_CreatePersonalAddressBook, &ipcInfo); + + // Check for IPC completion + if (!createPtr->ipcWorked) + { + result = NAB_FAILURE; + } + + // + // If successfull, then we need to get the information + if (result == NAB_SUCCESS) + { + (*addrBook) = (NABAddrBookDescType * )malloc(sizeof(NABAddrBookDescType)); + if (!(*addrBook)) + { + NSCloseSharedMemory(sMem, hSharedMemory); + return(NAB_MEMORY_FAILURE); + } + (*addrBook)->description = strdup(CheckNullString((LPSTR) createPtr->abookName)); + (*addrBook)->fileName = strdup(CheckNullString((LPSTR) createPtr->abookFileName)); + SetPointerArray(*addrBook, NAB_ADDRBOOK_STRUCT); + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + + TRACE("NAB_CreatePersonalAddressBook: Returning ABook Name = %s\n", (*addrBook)->description); + TRACE("NAB_CreatePersonalAddressBook: Returning ABook Fname = %s\n", (*addrBook)->fileName); + return(result); +} + +/******************************************************** + * Memory Handling Calls + ********************************************************/ + +/* + * This call frees memory allocated by the NABAPI. + */ +NABError +NAB_FreeMemory(void *ptr) +{ + int i; + BOOL found = FALSE; + + TRACE("NAB_FreeMemory()\n"); + if (!ptr) + return(NAB_SUCCESS); + + if (!memArray) + return(NAB_SUCCESS); + + for (i=0; idescription)) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(fileName)) + return(NAB_FILE_ERROR); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_SaveAddressBookToHTML(): Can't get Window\n"); + return(NAB_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + srand( (unsigned)time( NULL ) ); + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_SaveAddressBookToHTMLType *savePtr; + + memSize = sizeof(NAB_SaveAddressBookToHTMLType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_SaveAddressBookToHTML(): SMEM Failure\n"); + return(NAB_MEMORY_FAILURE); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + savePtr = (NAB_SaveAddressBookToHTMLType *)sMem->m_buf; + savePtr->abConnection = id; + + // Copy the input parameters for this call... + lstrcpy(savePtr->abookName, CheckNullString(addrBook->description)); + lstrcpy(savePtr->abookFileName, CheckNullString(addrBook->fileName)); + lstrcpy(savePtr->HTMLFileName, CheckNullString(fileName)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_SaveAddressBookToHTML, &ipcInfo); + + // Check for IPC completion + if (!savePtr->ipcWorked) + { + result = NAB_FAILURE; + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + + TRACE("NAB_SaveAddressBookToHTML(): Returning %d\n", result); + return(result); +} + +/* + * This call will import an LDIF formatted file from a disk file to the address + * book specified by the addrBook parameter. + */ +NABError +NAB_ImportLDIFFile(NABConnectionID id, NABAddrBookDescType *addrBook, char *fileName, NABBool deleteFileWhenFinished) +{ + NABError result; + NABIPCType ipcInfo; + + TRACE("NAB_ImportLDIFFile()\n"); + + if (id == 0) + return(NAB_INVALID_CONNID); + + if (!addrBook) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(addrBook->description)) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(fileName)) + return(NAB_FILE_NOT_FOUND); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_ImportLDIFFile(): Can't get Window\n"); + return(NAB_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + srand( (unsigned)time( NULL ) ); + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_ImportLDIFFileType *importPtr; + + memSize = sizeof(NAB_ImportLDIFFileType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_ImportLDIFFile(): SMEM Failure\n"); + return(NAB_MEMORY_FAILURE); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + importPtr = (NAB_ImportLDIFFileType *)sMem->m_buf; + importPtr->abConnection = id; + + // Copy the input parameters for this call... + lstrcpy(importPtr->abookName, CheckNullString(addrBook->description)); + lstrcpy(importPtr->abookFileName, CheckNullString(addrBook->fileName)); + lstrcpy(importPtr->LDIFFileName, CheckNullString(fileName)); + importPtr->deleteImportFile = deleteFileWhenFinished; + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_ImportLDIFFile, &ipcInfo); + + // Check for IPC completion + if (!importPtr->ipcWorked) + { + result = NAB_FAILURE; + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + + TRACE("NAB_ImportLDIFFile(): Returning %d\n", result); + return(result); +} + +/* + * This call will export the contents of an address book specified by the + * addrBook parameter to an LDIF formatted disk file. + */ +NABError +NAB_ExportLDIFFile(NABConnectionID id, NABAddrBookDescType *addrBook, char *fileName) +{ + NABError result; + NABIPCType ipcInfo; + TRACE("NAB_ExportLDIFFile()\n"); + + if (id == 0) + return(NAB_INVALID_CONNID); + + if (!addrBook) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(addrBook->description)) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(fileName)) + return(NAB_FILE_ERROR); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_ExportLDIFFile(): Can't get Window\n"); + return(NAB_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + srand( (unsigned)time( NULL ) ); + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_ExportLDIFFileType *exportPtr; + + memSize = sizeof(NAB_ExportLDIFFileType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_ExportLDIFFile(): SMEM Failure\n"); + return(NAB_MEMORY_FAILURE); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + exportPtr = (NAB_ExportLDIFFileType *)sMem->m_buf; + exportPtr->abConnection = id; + + // Copy the input parameters for this call... + lstrcpy(exportPtr->abookName, CheckNullString(addrBook->description)); + lstrcpy(exportPtr->abookFileName, CheckNullString(addrBook->fileName)); + lstrcpy(exportPtr->LDIFFileName, CheckNullString(fileName)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_ExportLDIFFile, &ipcInfo); + + // Check for IPC completion + if (!exportPtr->ipcWorked) + { + result = NAB_FAILURE; + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + + TRACE("NAB_ExportLDIFFile(): Returning %d\n", result); + return(result); +} + +/******************************************************** + * Individual Entry Calls + ********************************************************/ + +/* + * This call will get the User ID for the first person in the specified address + * book and it will also return the attributes for the user in the ldifEntry field. The memory for + * this field must be freed by a call to NAB_FreeMemory(). The addrBook argument is + * passed back via the calls that return NABAddrBookDescType structures. + * The call will also return the time this entry was last updated via the NABUpdateTime + * paramenter. The memory for this structure should be allocated by the + * calling application. It will return NAB_SUCCESS if an entry was found or NAB_NOT_FOUND + * if no entries are found. If a user is found, ID for the user returned is + * stored in the userID argument. + */ +NABError +NAB_GetFirstAddressBookEntry(NABConnectionID id, NABAddrBookDescType *addrBook, + NABUserID *userID, char **ldifEntry, + NABUpdateTime *updTime) +{ + NABError result; + NABIPCType ipcInfo; + TRACE("NAB_GetFirstAddressBookEntry()\n"); + + if (id == 0) + return(NAB_INVALID_CONNID); + + if (!addrBook) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(addrBook->description)) + return(NAB_INVALID_ABOOK); + + // Reset time + *updTime = 0; + *userID = 0; + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_GetFirstAddressBookEntry(): Can't get Window\n"); + return(NAB_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + srand( (unsigned)time( NULL ) ); + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_GetFirstAddressBookEntryType *getPtr; + + memSize = sizeof(NAB_GetFirstAddressBookEntryType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_GetFirstAddressBookEntry(): SMEM Failure\n"); + return(NAB_MEMORY_FAILURE); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + getPtr = (NAB_GetFirstAddressBookEntryType *)sMem->m_buf; + getPtr->abConnection = id; + + // Copy the input parameters for this call... + lstrcpy(getPtr->abookName, CheckNullString(addrBook->description)); + lstrcpy(getPtr->abookFileName, CheckNullString(addrBook->fileName)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_GetFirstAddressBookEntry, &ipcInfo); + + // Check for IPC completion + if (!getPtr->ipcWorked) + { + result = NAB_FAILURE; + } + + if (result == NAB_SUCCESS) + { + *userID = getPtr->userID; + *updTime = getPtr->updateTime; + *ldifEntry = strdup(CheckNullString(getPtr->userInfo)); + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + TRACE("NAB_GetFirstAddressBookEntry(): Returning %d\n", result); + return(result); +} + +/* + * This call will get the next address book entry from the specified address book and it will also + * return the attributes for the user in the ldifEntry field. The memory for + * this field must be freed by a call to NAB_FreeMemory(). The addrBook argument is passed back + * via the calls that return NABAddrBookDescType structures. The call will also return the time this + * entry was last updated via the NABUpdateTime paramenter. The memory for this structure should be allocated by the + * calling application. It will return NAB_SUCCESS if an entry was found or NAB_NOT_FOUND if the + * final entry has already been returned. If a user is found, ID for the user returned is stored + * in the userID argument. + */ +NABError +NAB_GetNextAddressBookEntry(NABConnectionID id, NABUserID *userID, + char **ldifEntry, NABUpdateTime *updTime) +{ + NABError result; + NABIPCType ipcInfo; + TRACE("NAB_GetNextAddressBookEntry()\n"); + + if (id == 0) + return(NAB_INVALID_CONNID); + + // Reset time + *updTime = 0; + *userID = 0; + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_GetNextAddressBookEntry(): Can't get Window\n"); + return(NAB_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + srand( (unsigned)time( NULL ) ); + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_GetNextAddressBookEntryType *getPtr; + + memSize = sizeof(NAB_GetNextAddressBookEntryType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_GetNextAddressBookEntry(): SMEM Failure\n"); + return(NAB_MEMORY_FAILURE); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + getPtr = (NAB_GetNextAddressBookEntryType *)sMem->m_buf; + getPtr->abConnection = id; + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_GetNextAddressBookEntry, &ipcInfo); + + // Check for IPC completion + if (!getPtr->ipcWorked) + { + result = NAB_FAILURE; + } + + if (result == NAB_SUCCESS) + { + *userID = getPtr->userID; + *updTime = getPtr->updateTime; + *ldifEntry = strdup(CheckNullString(getPtr->userInfo)); + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + TRACE("NAB_GetNextAddressBookEntry(): Returning %d\n", result); + return(result); +} + +/* + * This call will perform a query on the specified ldif attribute pair. The memory for the ldifEntry + * will be allocated by the API and must be freed by a call to NAB_FreeMemory(). The addrBook argument + * is passed back via the calls that return NABAddrBookDescType structures. The call will also return the time + * this entry was last updated via the NABUpdateTime paramenter. The memory for this structure should be + * allocated by the calling application. It will return NAB_SUCCESS if an entry was found or NAB_NOT_FOUND + * if the search failed. + */ +NABError +NAB_FindAddressBookEntry(NABConnectionID id, NABAddrBookDescType *addrBook, + NABUserID *userID, char *ldifSearchAttribute, + char **ldifEntry, NABUpdateTime *updTime) +{ + NABError result; + NABIPCType ipcInfo; + TRACE("NAB_FindAddressBookEntry()\n"); + + if (id == 0) + return(NAB_INVALID_CONNID); + + /** + if (!addrBook) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(addrBook->description)) + return(NAB_INVALID_ABOOK); + ***/ + + if (ValidNonNullString(ldifSearchAttribute)) + *userID = 0; + + // Reset time + *updTime = 0; + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_FindAddressBookEntry(): Can't get Window\n"); + return(NAB_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + srand( (unsigned)time( NULL ) ); + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_FindAddressBookEntryType *findPtr; + + memSize = sizeof(NAB_FindAddressBookEntryType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_FindAddressBookEntry(): SMEM Failure\n"); + return(NAB_MEMORY_FAILURE); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + findPtr = (NAB_FindAddressBookEntryType *)sMem->m_buf; + findPtr->abConnection = id; + + // Copy the input parameters for this call... + findPtr->abookName[0] = '\0'; + findPtr->abookFileName[0] = '\0'; + + if (!ValidNonNullString(ldifSearchAttribute)) + { + findPtr->userID = *userID; + } + + if (addrBook) + { + if (ValidNonNullString(addrBook->description)) + { + lstrcpy(findPtr->abookName, CheckNullString(addrBook->description)); + lstrcpy(findPtr->abookFileName, CheckNullString(addrBook->fileName)); + } + } + + if (ValidNonNullString(ldifSearchAttribute)) + lstrcpy(findPtr->ldifSearchAttribute, CheckNullString(ldifSearchAttribute)); + else + findPtr->ldifSearchAttribute[0] = '\0'; + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_FindAddressBookEntry, &ipcInfo); + + // Check for IPC completion + if (!findPtr->ipcWorked) + { + result = NAB_FAILURE; + } + + if (result == NAB_SUCCESS) + { + *userID = findPtr->userID; + *updTime = findPtr->updateTime; + *ldifEntry = strdup(CheckNullString(findPtr->userInfo)); + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + TRACE("NAB_FindAddressBookEntry(): Returning %d\n", result); + return(result); +} + +/* + * This call will insert an individual address book entry (in LDIF format) into the (addrBookID) address + * book. The addrBook argument is passed back via the calls that return NABAddrBookDescType structures. + * If this user already exists in the specified address book, the operation will fail. + */ +NABError +NAB_InsertAddressBookEntry(NABConnectionID id, NABAddrBookDescType *addrBook, + char *ldifEntry, NABUserID *userID) +{ + NABError result; + NABIPCType ipcInfo; + TRACE("NAB_InsertAddressBookEntry()\n"); + + if (id == 0) + return(NAB_INVALID_CONNID); + + if (!addrBook) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(addrBook->description)) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(ldifEntry)) + return(NAB_INVALID_ENTRY); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_InsertAddressBookEntry(): Can't get Window\n"); + return(NAB_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + srand( (unsigned)time( NULL ) ); + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_InsertAddressBookEntryType *insertPtr; + + memSize = sizeof(NAB_InsertAddressBookEntryType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_InsertAddressBookEntry(): SMEM Failure\n"); + return(NAB_MEMORY_FAILURE); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + insertPtr = (NAB_InsertAddressBookEntryType *)sMem->m_buf; + insertPtr->abConnection = id; + insertPtr->userID = 0; + + // Copy the input parameters for this call... + lstrcpy(insertPtr->abookName, CheckNullString(addrBook->description)); + lstrcpy(insertPtr->abookFileName, CheckNullString(addrBook->fileName)); + lstrcpy(insertPtr->userInfo, CheckNullString(ldifEntry)); + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_InsertAddressBookEntry, &ipcInfo); + + // Check for IPC completion + if (!insertPtr->ipcWorked) + { + result = NAB_FAILURE; + } + else + { + *userID = insertPtr->userID; + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + + TRACE("NAB_InsertAddressBookEntry(): Returning %d\n", result); + return(result); +} + +/* This call will update the specified address book entry in the specified address book with the + * information passed in via the LDIF formatted entry. Attributes that exists will be replaced by the + * new entry and new attributes will be added to the user record. The addrBook argument is passed back + * via the calls that return NABAddrBookDescType structures. If the entry is not found, the call will fail. + */ +NABError +NAB_UpdateAddressBookEntry(NABConnectionID id, NABAddrBookDescType *addrBook, + NABUserID userID, char *ldifEntry) +{ + NABError result; + NABIPCType ipcInfo; + TRACE("NAB_UpdateAddressBookEntry()\n"); + + if (id == 0) + return(NAB_INVALID_CONNID); + + if (!addrBook) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(addrBook->description)) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(ldifEntry)) + return(NAB_INVALID_ENTRY); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_UpdateAddressBookEntry(): Can't get Window\n"); + return(NAB_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + srand( (unsigned)time( NULL ) ); + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_UpdateAddressBookEntryType *updatePtr; + + memSize = sizeof(NAB_UpdateAddressBookEntryType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_UpdateAddressBookEntry(): SMEM Failure\n"); + return(NAB_MEMORY_FAILURE); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + updatePtr = (NAB_UpdateAddressBookEntryType *)sMem->m_buf; + updatePtr->abConnection = id; + + // Copy the input parameters for this call... + lstrcpy(updatePtr->abookName, CheckNullString(addrBook->description)); + lstrcpy(updatePtr->abookFileName, CheckNullString(addrBook->fileName)); + lstrcpy(updatePtr->userInfo, CheckNullString(ldifEntry)); + updatePtr->userID = userID; + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_UpdateAddressBookEntry, &ipcInfo); + + // Check for IPC completion + if (!updatePtr->ipcWorked) + { + result = NAB_FAILURE; + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + TRACE("NAB_UpdateAddressBookEntry(): Returning %d\n", result); + return(result); +} + +/* + * This call will delete the specified address book entry in the specified address book. The addrBook + * argument is passed back via the calls that return NABAddrBookDescType structures. If the entry is + * not found, the call will fail. + */ +NABError +NAB_DeleteAddressBookEntry(NABConnectionID id, NABAddrBookDescType *addrBook, + NABUserID userID) +{ + NABError result; + NABIPCType ipcInfo; + TRACE("NAB_DeleteAddressBookEntry()\n"); + + if (id == 0) + return(NAB_INVALID_CONNID); + + if (!addrBook) + return(NAB_INVALID_ABOOK); + + if (!ValidNonNullString(addrBook->description)) + return(NAB_INVALID_ABOOK); + + // + // This call locates a Communicator Window, if one is not running, + // it will start up an instance of Communicator and grab that window. + // + HWND hWndIPC = GetCommunicatorIPCWindow(TRUE); + if (NULL == hWndIPC) + { + TRACE("NAB_DeleteAddressBookEntry(): Can't get Window\n"); + return(NAB_FAILURE); + } + + // + // Build the IPC structure of information that needs to be provided + // to get information into Communicator + // + srand( (unsigned)time( NULL ) ); + BuildMemName((LPSTR)ipcInfo.smemName, rand()); + + // + // Build the shared memory segment of information to pass into + // Communicator for the login call. + // + CSharedMem *sMem; + DWORD memSize; + HANDLE hSharedMemory; + NAB_DeleteAddressBookEntryType *deletePtr; + + memSize = sizeof(NAB_DeleteAddressBookEntryType); + + // + // Create the shared memory... + // + sMem = NSCreateSharedMemory(memSize, (LPSTR) ipcInfo.smemName, &hSharedMemory); + if (!sMem) + { + TRACE("NAB_DeleteAddressBookEntry(): SMEM Failure\n"); + return(NAB_MEMORY_FAILURE); + } + + // + // Here is where we would set any values in the share memory segment (sMem) + // and copy the information into the memory segment. + // + sMem->m_dwSize = memSize; + deletePtr = (NAB_DeleteAddressBookEntryType *)sMem->m_buf; + deletePtr->abConnection = id; + + // Copy the input parameters for this call... + lstrcpy(deletePtr->abookName, CheckNullString(addrBook->description)); + lstrcpy(deletePtr->abookFileName, CheckNullString(addrBook->fileName)); + deletePtr->userID = userID; + + // + // Now set the size of the shared memory segment for the + // WM_COPYDATA argument that will be sent across. + // + ipcInfo.smemSize = memSize; + + // For Win16, we actually pass in the pointer to the structure, + // so just assign the variable here. +#ifdef WIN16 + ipcInfo.lpsmem = sMem; +#else + ipcInfo.lpsmem = NULL; +#endif + + // + // Ok, time to do the SendMessage() to Communicator... + // + result = SendNABRequest(hWndIPC, NSCP_NAB_DeleteAddressBookEntry, &ipcInfo); + + // Check for IPC completion + if (!deletePtr->ipcWorked) + { + result = NAB_FAILURE; + } + + // + // Now time to do some cleanup... + // + NSCloseSharedMemory(sMem, hSharedMemory); + TRACE("NAB_DeleteAddressBookEntry(): Returning %d\n", result); + return(result); +} + +BOOL +TackOnNextAttribute(LPSTR retLine, LPSTR attribValue, LPSTR attribName) +{ + if ( (!attribValue) || (!(*attribValue)) ) + return 0; + + lstrcat(retLine, attribName); + lstrcat(retLine, attribValue); + lstrcat(retLine, NAB_CRLF); + return TRUE; +} + +DWORD +StringOK(LPSTR attribValue, LPSTR attribName) +{ + if ( (!attribValue) || (!(*attribValue)) ) + return 0; + else + return ( (lstrlen(attribValue) + 1) + (lstrlen(attribName) + 2 /* 2 for CRLF */) ); +} + +char FAR * +NAB_FormatLDIFLine(char *firstName, + char *lastName, + char *generalNotes, + char *city, + char *state, + char *email, + char *title, + char *addrLine1, + char *addrLine2, + char *zipCode, + char *country, + char *businessPhone, + char *faxPhone, + char *homePhone, + char *organization, + char *nickname, + char *useHTML) +{ +#define TOTAL_ATTRIBS 17 + + LPSTR retLine = NULL; + DWORD totalSize = 0; + + totalSize += StringOK(firstName, "sn: "); + totalSize += StringOK(lastName, "givenname: "); + totalSize += StringOK(generalNotes, "description: "); + totalSize += StringOK(city, "locality: "); + totalSize += StringOK(state, "st: "); + totalSize += StringOK(email, "mail: "); + totalSize += StringOK(title, "title: "); + totalSize += StringOK(addrLine1, "postOfficeBox: "); + totalSize += StringOK(addrLine2, "streetaddress: "); + totalSize += StringOK(zipCode, "postalcode: "); + totalSize += StringOK(country, "countryname: "); + totalSize += StringOK(businessPhone, "telephonenumber: "); + totalSize += StringOK(faxPhone, "facsimiletelephonenumber :"); + totalSize += StringOK(homePhone, "homephone: "); + totalSize += StringOK(organization, "o: "); + totalSize += StringOK(nickname, "xmozillanickname: "); + totalSize += StringOK(useHTML, "xmozillausehtmlmail: "); + + if (totalSize == 0) + return NULL; + + totalSize++; // Add one for NULL + + retLine = (char *)malloc(totalSize); + if (!retLine) + return NULL; + memset(retLine, 0, totalSize); + + TackOnNextAttribute(retLine, firstName, "sn: "); + TackOnNextAttribute(retLine, lastName, "givenname: "); + TackOnNextAttribute(retLine, generalNotes, "description: "); + TackOnNextAttribute(retLine, city, "locality: "); + TackOnNextAttribute(retLine, state, "st: "); + TackOnNextAttribute(retLine, email, "mail: "); + TackOnNextAttribute(retLine, title, "title: "); + TackOnNextAttribute(retLine, addrLine1, "postOfficeBox: "); + TackOnNextAttribute(retLine, addrLine2, "streetaddress: "); + TackOnNextAttribute(retLine, zipCode, "postalcode: "); + TackOnNextAttribute(retLine, country, "countryname: "); + TackOnNextAttribute(retLine, businessPhone, "telephonenumber: "); + TackOnNextAttribute(retLine, faxPhone, "facsimiletelephonenumber: "); + TackOnNextAttribute(retLine, homePhone, "homephone: "); + TackOnNextAttribute(retLine, organization, "o: "); + TackOnNextAttribute(retLine, nickname, "xmozillanickname: "); + TackOnNextAttribute(retLine, useHTML, "xmozillausehtmlmail: "); + + return retLine; +} diff --git a/mozilla/cmd/winfe/nabapi/nabapi32.def b/mozilla/cmd/winfe/nabapi/nabapi32.def new file mode 100644 index 00000000000..5281e10a947 --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/nabapi32.def @@ -0,0 +1,17 @@ +EXPORTS + NAB_Open + NAB_Close + NAB_GetAddressBookList + NAB_GetDefaultAddressBook + NAB_CreatePersonalAddressBook + NAB_FreeMemory + NAB_SaveAddressBookToHTML + NAB_ImportLDIFFile + NAB_ExportLDIFFile + NAB_GetFirstAddressBookEntry + NAB_GetNextAddressBookEntry + NAB_FindAddressBookEntry + NAB_InsertAddressBookEntry + NAB_UpdateAddressBookEntry + NAB_DeleteAddressBookEntry + NAB_FormatLDIFLine diff --git a/mozilla/cmd/winfe/nabapi/nabapi32.mak b/mozilla/cmd/winfe/nabapi/nabapi32.mak new file mode 100644 index 00000000000..f71e9adb66d --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/nabapi32.mak @@ -0,0 +1,485 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** +/* -*- 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. + */ +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=nabapi32 - Win32 Debug +!MESSAGE No configuration specified. Defaulting to nabapi32 - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "nabapi32 - Win32 Release" && "$(CFG)" !=\ + "nabapi32 - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "nabapi32.mak" CFG="nabapi32 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "nabapi32 - Win32 Release" (based on\ + "Win32 (x86) Dynamic-Link Library") +!MESSAGE "nabapi32 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "nabapi32 - Win32 Debug" +CPP=cl.exe +MTL=mktyplib.exe +RSC=rc.exe + +!IF "$(CFG)" == "nabapi32 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "x86Rel" +# PROP Intermediate_Dir "x86Rel" +# PROP Target_Dir "" +OUTDIR=.\x86Rel +INTDIR=.\x86Rel + +ALL : "$(OUTDIR)\nabapi32.dll" + +CLEAN : + -@erase "$(INTDIR)\maindll.obj" + -@erase "$(INTDIR)\mapismem.obj" + -@erase "$(INTDIR)\nabapi.obj" + -@erase "$(INTDIR)\nabapi32.res" + -@erase "$(INTDIR)\nabipc.obj" + -@erase "$(INTDIR)\nabmem.obj" + -@erase "$(INTDIR)\nabutl.obj" + -@erase "$(INTDIR)\nsstrseq.obj" + -@erase "$(INTDIR)\trace.obj" + -@erase "$(INTDIR)\xpapi.obj" + -@erase "$(OUTDIR)\nabapi32.dll" + -@erase "$(OUTDIR)\nabapi32.exp" + -@erase "$(OUTDIR)\nabapi32.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "\ns\cmd\winfe" /I "\ns\cmd\winfe\nabapi" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "NABAPIDLL" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "\ns\cmd\winfe" /I "\ns\cmd\winfe\nabapi"\ + /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "NABAPIDLL" /Fp"$(INTDIR)/nabapi32.pch"\ + /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\x86Rel/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/nabapi32.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/nabapi32.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\ + /pdb:"$(OUTDIR)/nabapi32.pdb" /machine:I386 /def:".\nabapi32.def"\ + /out:"$(OUTDIR)/nabapi32.dll" /implib:"$(OUTDIR)/nabapi32.lib" +DEF_FILE= \ + ".\nabapi32.def" +LINK32_OBJS= \ + "$(INTDIR)\maindll.obj" \ + "$(INTDIR)\mapismem.obj" \ + "$(INTDIR)\nabapi.obj" \ + "$(INTDIR)\nabapi32.res" \ + "$(INTDIR)\nabipc.obj" \ + "$(INTDIR)\nabmem.obj" \ + "$(INTDIR)\nabutl.obj" \ + "$(INTDIR)\nsstrseq.obj" \ + "$(INTDIR)\trace.obj" \ + "$(INTDIR)\xpapi.obj" + +"$(OUTDIR)\nabapi32.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "nabapi32 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "x86Dbg" +# PROP Intermediate_Dir "x86Dbg" +# PROP Target_Dir "" +OUTDIR=.\x86Dbg +INTDIR=.\x86Dbg + +ALL : "$(OUTDIR)\nabapi32.dll" + +CLEAN : + -@erase "$(INTDIR)\maindll.obj" + -@erase "$(INTDIR)\mapismem.obj" + -@erase "$(INTDIR)\nabapi.obj" + -@erase "$(INTDIR)\nabapi32.res" + -@erase "$(INTDIR)\nabipc.obj" + -@erase "$(INTDIR)\nabmem.obj" + -@erase "$(INTDIR)\nabutl.obj" + -@erase "$(INTDIR)\nsstrseq.obj" + -@erase "$(INTDIR)\trace.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(INTDIR)\xpapi.obj" + -@erase "$(OUTDIR)\nabapi32.dll" + -@erase "$(OUTDIR)\nabapi32.exp" + -@erase "$(OUTDIR)\nabapi32.ilk" + -@erase "$(OUTDIR)\nabapi32.lib" + -@erase "$(OUTDIR)\nabapi32.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "\ns\cmd\winfe" /I "\ns\cmd\winfe\nabapi" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "NABAPIDLL" /YX /c +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "\ns\cmd\winfe" /I\ + "\ns\cmd\winfe\nabapi" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "NABAPIDLL"\ + /Fp"$(INTDIR)/nabapi32.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\x86Dbg/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/nabapi32.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/nabapi32.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes\ + /pdb:"$(OUTDIR)/nabapi32.pdb" /debug /machine:I386 /def:".\nabapi32.def"\ + /out:"$(OUTDIR)/nabapi32.dll" /implib:"$(OUTDIR)/nabapi32.lib" +DEF_FILE= \ + ".\nabapi32.def" +LINK32_OBJS= \ + "$(INTDIR)\maindll.obj" \ + "$(INTDIR)\mapismem.obj" \ + "$(INTDIR)\nabapi.obj" \ + "$(INTDIR)\nabapi32.res" \ + "$(INTDIR)\nabipc.obj" \ + "$(INTDIR)\nabmem.obj" \ + "$(INTDIR)\nabutl.obj" \ + "$(INTDIR)\nsstrseq.obj" \ + "$(INTDIR)\trace.obj" \ + "$(INTDIR)\xpapi.obj" + +"$(OUTDIR)\nabapi32.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "nabapi32 - Win32 Release" +# Name "nabapi32 - Win32 Debug" + +!IF "$(CFG)" == "nabapi32 - Win32 Release" + +!ELSEIF "$(CFG)" == "nabapi32 - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\maindll.cpp + +"$(INTDIR)\maindll.obj" : $(SOURCE) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\nabapi.cpp + +!IF "$(CFG)" == "nabapi32 - Win32 Release" + +DEP_CPP_NABAP=\ + ".\nabipc.h"\ + ".\nabmem.h"\ + ".\nabutl.h"\ + ".\port.h"\ + ".\trace.h"\ + ".\xpapi.h"\ + "\ns\cmd\winfe\abapi.h"\ + "\ns\cmd\winfe\mapismem.h"\ + "\ns\cmd\winfe\nabapi.h"\ + "\ns\cmd\winfe\nsstrseq.h"\ + +NODEP_CPP_NABAP=\ + "..\abcom.h"\ + "..\msgcom.h"\ + + +"$(INTDIR)\nabapi.obj" : $(SOURCE) $(DEP_CPP_NABAP) "$(INTDIR)" + + +!ELSEIF "$(CFG)" == "nabapi32 - Win32 Debug" + +DEP_CPP_NABAP=\ + ".\nabipc.h"\ + ".\nabmem.h"\ + ".\nabutl.h"\ + ".\port.h"\ + ".\trace.h"\ + ".\xpapi.h"\ + "\ns\cmd\winfe\abapi.h"\ + "\ns\cmd\winfe\mapismem.h"\ + "\ns\cmd\winfe\nabapi.h"\ + "\ns\cmd\winfe\nsstrseq.h"\ + +NODEP_CPP_NABAP=\ + "..\abcom.h"\ + "..\msgcom.h"\ + + +"$(INTDIR)\nabapi.obj" : $(SOURCE) $(DEP_CPP_NABAP) "$(INTDIR)" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\nabapi32.rc +DEP_RSC_NABAPI=\ + ".\resource.h"\ + + +"$(INTDIR)\nabapi32.res" : $(SOURCE) $(DEP_RSC_NABAPI) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\nabipc.cpp +DEP_CPP_NABIP=\ + ".\nabipc.h"\ + ".\port.h"\ + ".\trace.h"\ + "\ns\cmd\winfe\abapi.h"\ + "\ns\cmd\winfe\mapismem.h"\ + "\ns\cmd\winfe\nabapi.h"\ + +NODEP_CPP_NABIP=\ + "..\abcom.h"\ + "..\msgcom.h"\ + + +"$(INTDIR)\nabipc.obj" : $(SOURCE) $(DEP_CPP_NABIP) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\nabmem.cpp +DEP_CPP_NABME=\ + ".\nabmem.h"\ + ".\nabutl.h"\ + ".\trace.h"\ + ".\xpapi.h"\ + "\ns\cmd\winfe\abapi.h"\ + "\ns\cmd\winfe\nabapi.h"\ + "\ns\cmd\winfe\nsstrseq.h"\ + +NODEP_CPP_NABME=\ + "..\abcom.h"\ + "..\msgcom.h"\ + + +"$(INTDIR)\nabmem.obj" : $(SOURCE) $(DEP_CPP_NABME) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\nabutl.cpp +DEP_CPP_NABUT=\ + ".\nabipc.h"\ + ".\nabutl.h"\ + ".\port.h"\ + ".\trace.h"\ + ".\xpapi.h"\ + "\ns\cmd\winfe\abapi.h"\ + "\ns\cmd\winfe\nabapi.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + +NODEP_CPP_NABUT=\ + "..\abcom.h"\ + "..\msgcom.h"\ + + +"$(INTDIR)\nabutl.obj" : $(SOURCE) $(DEP_CPP_NABUT) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\trace.cpp +DEP_CPP_TRACE=\ + ".\trace.h"\ + + +"$(INTDIR)\trace.obj" : $(SOURCE) $(DEP_CPP_TRACE) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\xpapi.cpp +DEP_CPP_XPAPI=\ + ".\nabutl.h"\ + ".\xpapi.h"\ + "\ns\cmd\winfe\nabapi.h"\ + + +"$(INTDIR)\xpapi.obj" : $(SOURCE) $(DEP_CPP_XPAPI) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\ns\cmd\winfe\abapi.h + +!IF "$(CFG)" == "nabapi32 - Win32 Release" + +!ELSEIF "$(CFG)" == "nabapi32 - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\ns\cmd\winfe\nabapi.h + +!IF "$(CFG)" == "nabapi32 - Win32 Release" + +!ELSEIF "$(CFG)" == "nabapi32 - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\ns\cmd\winfe\mapismem.cpp +DEP_CPP_MAPIS=\ + "\ns\cmd\winfe\mapismem.h"\ + + +"$(INTDIR)\mapismem.obj" : $(SOURCE) $(DEP_CPP_MAPIS) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\nabapi32.def + +!IF "$(CFG)" == "nabapi32 - Win32 Release" + +!ELSEIF "$(CFG)" == "nabapi32 - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\ns\cmd\winfe\nsstrseq.cpp +DEP_CPP_NSSTR=\ + "\ns\cmd\winfe\nsstrseq.h"\ + + +"$(INTDIR)\nsstrseq.obj" : $(SOURCE) $(DEP_CPP_NSSTR) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/mozilla/cmd/winfe/nabapi/nabapi32.rc b/mozilla/cmd/winfe/nabapi/nabapi32.rc new file mode 100644 index 00000000000..dbef50266c0 --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/nabapi32.rc @@ -0,0 +1,162 @@ +// Insert copyright and license here 1997 +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" +/* -*- 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. + */ +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +ID_DIALOG_NAB DIALOGEX 0, 0, 186, 111 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Netscape NAB Support" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,41,95,50,14 + PUSHBUTTON "Cancel",IDCANCEL,104,95,50,14 + GROUPBOX "Diagnostic Information",IDC_STATIC,2,2,182,91 + CTEXT "This window will contain NAB relative\ninformation for Netscape Communicator", + IDC_STATIC,11,14,159,30 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + ID_DIALOG_NAB, DIALOG + BEGIN + LEFTMARGIN, 2 + RIGHTMARGIN, 184 + TOPMARGIN, 2 + BOTTOMMARGIN, 109 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "Address Book API DLL\0" + VALUE "CompanyName", "Netscape Communications Corporation\0" + VALUE "FileDescription", "nabapi32\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "nabapi32\0" + VALUE "LegalCopyright", "Copyright © 1997\0" + VALUE "LegalTrademarks", "Netscape and Netscape Navigator are registered trademarks of Netscape Communications Corporation.\0" + VALUE "OriginalFilename", "nab32.dll\0" + VALUE "ProductName", "Netscape Communications Address Book API\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/cmd/winfe/nabapi/nabipc.cpp b/mozilla/cmd/winfe/nabapi/nabipc.cpp new file mode 100644 index 00000000000..970caba6369 --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/nabipc.cpp @@ -0,0 +1,230 @@ +/* -*- 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. + */ +// +// NAB IPC Routines +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// +#include +#include + +#include "resource.h" + +#include +#include "nabipc.h" +#include "trace.h" + +#ifndef WIN32 +#include +#endif + +// +// Necessary variables... +// +static LONG instanceCount = 0; +HWND hWndNAB = NULL; +char szClassName[] = "NetscapeNABClient"; +char szWindowName[] = "NetscapeNAB"; + +// +// External declares... +// +extern HINSTANCE hInstance; + +void +ProcessCommand(HWND hWnd, int id, HWND hCtl, UINT codeNotify) +{ + switch (id) + { + case IDOK: + case IDCANCEL: + { + ShowWindow(hWnd, SW_HIDE); + } + + default: + ; + } +} + +BOOL CALLBACK LOADDS +MyDlgProc(HWND hWndMain, UINT wMsg, WPARAM wParam, LPARAM lParam) +{ + switch (wMsg) + { + case WM_INITDIALOG: + { + hWndNAB = hWndMain; + } + break; + + case WM_CLOSE: +// DestroyWindow(hWndMain); + break; + + case WM_DESTROY: + hWndMain = NULL; + break; + + case WM_COMMAND: + HANDLE_WM_COMMAND(hWndNAB, wParam, lParam, ProcessCommand); + break; + + default: + return FALSE; + } + + return TRUE; +} + +BOOL +InitInstance(HINSTANCE hInstance) +{ + // + // Create a main window for this application instance. + // + /* RICHIE - TRY SOME CHANGES!!! + hWndNABI = CreateDialog((HINSTANCE) hInstance, + MAKEINTRESOURCE(ID_DIALOG_QAHOOK), + (HWND) NULL, (DLGPROC) MyDlgProc); + ******/ + hWndNAB = CreateWindow( + szClassName, // pointer to registered class name + szWindowName, // pointer to window name + WS_CHILD, // window style + -10, // horizontal position of window + -10, // vertical position of window + 1, // window width + 1, // window height + GetDesktopWindow(), // handle to parent or owner window + NULL, // handle to menu or child-window identifier + hInstance, // handle to application instance + NULL // pointer to window-creation data + ); + if (!hWndNAB) + return FALSE; + else + return TRUE; +} + +BOOL +InitApp(void) +{ +#ifdef WIN32 + WNDCLASS wc; + wc.style = 0; + wc.lpfnWndProc = DefDlgProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = DLGWINDOWEXTRA; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(ID_ICON_APP)); + wc.hCursor = LoadCursor(0, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszMenuName = NULL; + wc.lpszClassName = szClassName; + + if(!RegisterClass(&wc)) + return FALSE; +#endif + + return TRUE; +} // end InitApp + +BOOL +InitDLL(void) +{ + if (hWndNAB != NULL) + return TRUE; + + if (!InitApp()) + { + return FALSE; + } + + if (!InitInstance(hInstance)) + { + return FALSE; + } + +// ShowWindow(hWndNAB, SW_SHOW); Just for jollies + return(TRUE); +} + +//************************************************************* +//* Calls exposed for rest of DLL... +//************************************************************* +// +// Purpose: Open the API +// Return: 1 on success +// 0 on failure +// +DWORD nsNAB_OpenAPI(void) +{ + if (instanceCount > 0) + { + return(1); + } + + ++instanceCount; + return(1); +} + +// +// Purpose: Close the API +// +void nsNAB_CloseAPI(void) +{ + --instanceCount; + if (instanceCount <= 0) + { + instanceCount = 0; + } + + return; +} + +// +// Send the actual request to Communicator +// +LRESULT +SendNABRequest(HWND hWnd, + DWORD nabRequestID, + NABIPCType *ipcInfo) +{ +LRESULT returnVal = 0; +COPYDATASTRUCT cds; + + if (!InitDLL()) + { + return 0; + } + + cds.dwData = nabRequestID; + cds.cbData = sizeof(NABIPCType); + cds.lpData = ipcInfo; + + // Make the call into Communicator + returnVal = SendMessage(hWnd, WM_COPYDATA, (WPARAM) hWndNAB, (LPARAM) &cds); + + // Now kill the window... + DestroyWindow(hWndNAB); + hWndNAB = NULL; + UnregisterClass(szClassName, hInstance); + + return returnVal; +} diff --git a/mozilla/cmd/winfe/nabapi/nabipc.h b/mozilla/cmd/winfe/nabapi/nabipc.h new file mode 100644 index 00000000000..130bcb51a3a --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/nabipc.h @@ -0,0 +1,44 @@ +/* -*- 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. + */ +#ifndef __NABIPC_HPP__ +#define __NABIPC_HPP__ + +#include "abapi.h" +#include "port.h" + +//******************************************************** +// Open and close functions for API +//******************************************************** +// Open the API +// Return: 1 on success, 0 on failure +// +DWORD nsNAB_OpenAPI(void); + +// +// Purpose: Close the API +// +void nsNAB_CloseAPI(void); + +// +// Send the actual request to Communicator +// +LRESULT SendNABRequest(HWND hWnd, + DWORD nabRequestID, + NABIPCType *ipcInfo); + +#endif // __NABIPC_HPP__ diff --git a/mozilla/cmd/winfe/nabapi/nabmem.cpp b/mozilla/cmd/winfe/nabapi/nabmem.cpp new file mode 100644 index 00000000000..fd98cf87295 --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/nabmem.cpp @@ -0,0 +1,69 @@ +/* -*- 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. + */ +// +// mem.cpp +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// This implements various memory management functions for use with +// Address Book API features of Communicator +// +#include +#include +#include +#include // lives in communicator winfe + +#include "nabmem.h" +#include "nsstrseq.h" +#include "trace.h" +#include "nabutl.h" +#include "xpapi.h" + +LPSTR +CheckNullString(LPSTR inStr) +{ + static UCHAR str[1]; + + str[0] = '\0'; + if (inStr == NULL) + return((LPSTR)str); + else + return(inStr); +} + +void +FreeAddrStruct(NABAddrBookDescType *ptr) +{ + if (!ptr) + return; + if (ptr->description != NULL) + free(ptr->description); + if (ptr->fileName != NULL) + free(ptr->fileName); +} + +BOOL +ValidNonNullString(LPSTR ptr) +{ + if (!ptr) + return(FALSE); + + if (ptr[0] == '\0') + return(FALSE); + + return(TRUE); +} \ No newline at end of file diff --git a/mozilla/cmd/winfe/nabapi/nabmem.h b/mozilla/cmd/winfe/nabapi/nabmem.h new file mode 100644 index 00000000000..95bd5177444 --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/nabmem.h @@ -0,0 +1,32 @@ +/* -*- 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. + */ +#ifndef __MY_MEM_HPP__ +#define __MY_MEM_HPP__ + +// +// Needed for turning NULL's into ""'s for string sequence routines... +// +LPSTR CheckNullString(LPSTR inStr); +void FreeAddrStruct(NABAddrBookDescType *ptr); +BOOL ValidNonNullString(LPSTR ptr); + +// +// Memory allocation functions... +// + +#endif // __MY_MEM_HPP__ \ No newline at end of file diff --git a/mozilla/cmd/winfe/nabapi/nabutl.cpp b/mozilla/cmd/winfe/nabapi/nabutl.cpp new file mode 100644 index 00000000000..2cafb6ef0bd --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/nabutl.cpp @@ -0,0 +1,412 @@ +/* -*- 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. + */ +// +// Various utils needed for the Address book functions +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// +#include +#include +#include +#include +#include "xpapi.h" +#include "trace.h" +#include "nabipc.h" +#include "nabutl.h" + +#define ONE_SEC 20 +#define STARTUP "Start" +#define STARTUP_TIME 20 +#define EXIT "Exit" +#define EXIT_TIME 10 + +// +// Global variables +// +BOOL gLoggingEnabled = FALSE; + +void +SetLoggingEnabled(BOOL val) +{ + gLoggingEnabled = val; +} + +// Log File +void +LogString(LPCSTR pStr1) +{ + // Off of the declaration line... + LPCSTR pStr2 = NULL; + BOOL useStr1 = TRUE; + + if (gLoggingEnabled) + { + char tempPath[_MAX_PATH] = ""; + if (getenv("TEMP")) + { + lstrcpy((LPSTR) tempPath, getenv("TEMP")); // environmental variable + } + + int len = lstrlen(tempPath); + if ((len > 1) && tempPath[len - 1] != '\\') + { + lstrcat(tempPath, "\\"); + } + lstrcat(tempPath, szNABLog); + HFILE hFile = _lopen(tempPath, OF_WRITE); + if (hFile == HFILE_ERROR) + { + hFile = _lcreat(tempPath, 0); + } + if (hFile != HFILE_ERROR) + { + _llseek(hFile, 0, SEEK_END); // seek to the end of the file + LPCSTR pTemp = useStr1 ? pStr1 : pStr2; + _lwrite(hFile, pTemp, lstrlen(pTemp)); + _lclose(hFile); + } + } +} + +void +BuildMemName(LPSTR name, ULONG winSeed) +{ + static DWORD id = 0; + + if (id == 0) + { + // Seed the random-number generator with current time so that + // the numbers will be different every time we run. + srand( (unsigned)time( NULL ) ); + id = rand(); + } + + wsprintf(name, "NAB_IPC_SMEM-%d", (winSeed + id++)); + TRACE("Shared Memory Name = [%s]\n", name); +} + +DWORD +ValidateFile(LPCSTR szFile) +{ + struct _stat buf; + int result; + + result = _stat( szFile, &buf ); + if (result != 0) + return(1); + + if (!(buf.st_mode & S_IREAD)) + return(2); + + return(0); +} + +DWORD +GetFileCount(LPSTR pFiles, LPSTR delimChar) +{ + DWORD count = 1; + if ((!pFiles) || (!*pFiles)) + return(0); + + for (DWORD i=0; i + + +#ifndef CDECL +#define CDECL __cdecl +#endif // CDECL + +#ifndef PASCAL +#define PASCAL __pascal +#endif // PASCAL + +#ifdef FASTCALL +#error FASTCALL defined +#endif // FASTCALL + + +#ifdef NDEBUG +#define FASTCALL __fastcall +#else +#define FASTCALL PASCAL +#endif // NDEBUG + + + +#ifndef HWND2DWORD +# ifdef WIN32 +# define HWND2DWORD(X_hWnd) ( (DWORD)(X_hWnd) ) +# else // WIN16 +# define HWND2DWORD(X_hWnd) ( (DWORD)MAKELONG(((WORD)(X_hWnd)), 0) ) +# endif +#endif // HWND2DWORD + + +/* + * WIN16 - WIN32 compatibility stuff + */ + +#ifdef WIN32 + +# define DLLEXPORT __declspec( dllexport ) +# define EXPORT +# define LOADDS +# define HUGE +# ifndef FAR +# define FAR +# endif // FAR +# ifndef NEAR +# define NEAR +# endif // NEAR +# ifdef UNICODE +# define SIZEOF(x) (sizeof(x)/sizeof(WCHAR)) +# else +# define SIZEOF(x) sizeof(x) +# endif + +#else // !WIN32 == WIN16 + +# define DLLEXPORT +# define EXPORT __export +# define LOADDS __loadds +# define HUGE __huge +# ifndef FAR +# define FAR __far +# define NEAR __near +# endif // FAR +# define CONST const +# define SIZEOF(x) sizeof(x) +# define CHAR char +# define TCHAR char +# define WCHAR char +# ifndef LPTSTR +# define LPTSTR LPSTR +# endif +# ifndef LPCTSTR +# define LPCTSTR LPCSTR +# endif +# define UNREFERENCED_PARAMETER(x) x; +# ifndef TEXT +# define TEXT(x) x +# endif +# define GetWindowTextW GetWindowText +# define lstrcpyW lstrcpy + +# define BN_DBLCLK BN_DOUBLECLICKED // ~~MRJ needed for custom control. +// ~~MRJ begin Win95 backward compat section +# define LPWSTR LPSTR +# define LPCWSTR LPCSTR + +// button check state for WIN16 +#ifndef BST_UNCHECKED +#define BST_UNCHECKED 0x0000 +#endif + +#ifndef BST_CHECKED +#define BST_CHECKED 0x0001 +#endif + + +#ifndef WIN95_COMPAT +# define WIN95_COMPAT +#endif + +// ~~MRJ end Win95 compat section. + +// critical section API stubs +typedef DWORD CRITICAL_SECTION; +typedef CRITICAL_SECTION FAR * LPCRITICAL_SECTION; +#ifdef __cplusplus +inline void InitializeCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void DeleteCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void EnterCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void LeaveCriticalSection(LPCRITICAL_SECTION lpSection) {} +#endif // __cplusplus + +// Added for nssock16 ---Neeti +#ifndef ZeroMemory +#include +#define ZeroMemory(PTR, SIZE) memset(PTR, 0, SIZE) +#endif // ZeroMemory + +#endif // WIN16 + +/* + * unix - windows compatibility stuff + */ +typedef DWORD u_int32; +typedef WORD u_int16; +typedef BYTE u_int8; +#ifdef WIN32 +typedef short int Bool16; +#else // WIN16 +typedef BOOL Bool16; +#endif // WIN16 + +/* + * Cross Platform Compatibility + */ +#ifndef UNALIGNED +# ifdef _M_ALPHA +# define UNALIGNED __unaligned +# else // !_M_ALPHA +# define UNALIGNED +# endif // !_M_ALPHA +#endif // UNALIGNED + +// +// RICHIE - for the Alpha port +// +#ifdef _M_ALPHA +# undef pascal +# undef PASCAL +# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) +# define pascal __stdcall +# define PASCAL __stdcall +# else +# define PASCAL +# endif +#endif + + +/* + * Useful Types + */ +typedef char HUGE *HPSTR; +typedef const char HUGE *HPCSTR; +typedef unsigned char HUGE *HPBYTE; +typedef WORD HUGE *HPWORD; +typedef UINT FAR *LPUINT; +typedef BOOL (CALLBACK *USERABORTPROC)(); +typedef BOOL (CALLBACK *PROGRESSPROC)(UINT uPos, UINT uRange); +typedef int INT; // ~~MRJ a function needed this defined. +typedef MINMAXINFO FAR *LPMINMAXINFO; // ~~MRJ + +// +// stuff missing from windows.h +// +#ifndef MAKEWORD +#define MAKEWORD(low, high) ((WORD)(((BYTE)(low)) | (((WORD)((BYTE)(high))) << 8))) +#endif // MAKEWORD + +#ifdef WIN32 +# ifndef hmemcpy +# define hmemcpy memcpy +# endif // !defined(hmemcpy) +# define _fmemset memset + +# include + +#ifdef __cplusplus + +inline BOOL IsGDIObject(HGDIOBJ hObj) { return (hObj != 0); } +inline void *_halloc(long num, unsigned int size) { return malloc(num * size); } +inline void _hfree( void *memblock ) { free(memblock); } +/* +inline BOOL IsInstance(HINSTANCE hInst) { +# ifdef WIN32 + return (hInst != 0); +# else // WIN16 + return (hInst > HINSTANCE_ERROR); +# endif +} +*/ + +#endif // __cplusplus + + WINUSERAPI HANDLE WINAPI LoadImageA(HINSTANCE, LPCSTR, UINT, int, int, UINT); + +#endif // WIN32 + +#ifdef __cplusplus +inline BOOL IsInstance(HINSTANCE hInst) { +# ifdef WIN32 + return (hInst != 0); +# else // WIN16 + return (hInst > HINSTANCE_ERROR); +# endif +} +inline void SetWindowSmallIcon(HINSTANCE hInst, HWND hWnd, UINT uIconResourceId) { +#ifdef WIN32 +# ifndef WM_SETICON +# define WM_SETICON 0x0080 +# endif // WM_SETICON +# ifndef IMAGE_ICON +# define IMAGE_ICON 1 +# endif + assert(IsWindow(hWnd)); + HICON hIcon = (HICON)LoadImageA(hInst, MAKEINTRESOURCE(uIconResourceId), IMAGE_ICON, + 16, 16, 0); + if(NULL != hIcon) { + SendMessage(hWnd, WM_SETICON, FALSE, (LPARAM)hIcon); + } else { + HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(uIconResourceId)); + assert(hIcon != 0); + SendMessage(hWnd, WM_SETICON, FALSE, (LPARAM)hIcon); + } +#endif // WIN32 +} +#endif // __cplusplus + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* PORT_H */ diff --git a/mozilla/cmd/winfe/nabapi/resource.h b/mozilla/cmd/winfe/nabapi/resource.h new file mode 100644 index 00000000000..1f2fabbb66a --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/resource.h @@ -0,0 +1,35 @@ +/* -*- 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. + */ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by mapi32.rc +// +#define ID_DIALOG_QAHOOK 101 +#define ID_DIALOG_NAB 101 +#define ID_ICON_APP 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mozilla/cmd/winfe/nabapi/trace.cpp b/mozilla/cmd/winfe/nabapi/trace.cpp new file mode 100644 index 00000000000..1d2351cd021 --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/trace.cpp @@ -0,0 +1,49 @@ +/* -*- 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. + */ +#include +#include +#include +#include +#include "trace.h" + +#ifdef _DEBUG + +#ifndef WIN16 +void CDECL AfxTrace(LPCTSTR lpszFormat, ...) +#else +void CDECL AfxTrace(LPCSTR lpszFormat, ...) +#endif +{ + va_list args; + va_start(args, lpszFormat); + + int nBuf; + TCHAR szBuffer[512]; + + nBuf = _vstprintf(szBuffer, lpszFormat, args); + va_end(args); + OutputDebugString(szBuffer); + return; +} + +BOOL AfxAssertFailedLine(LPCSTR lpszFileName, int nLine) +{ + return TRUE; +} + +#endif diff --git a/mozilla/cmd/winfe/nabapi/trace.h b/mozilla/cmd/winfe/nabapi/trace.h new file mode 100644 index 00000000000..389525a065d --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/trace.h @@ -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. + */ +#include + +#ifdef _DEBUG +BOOL AfxAssertFailedLine(LPCSTR lpszFileName, int nLine); + +#ifndef WIN16 +void CDECL AfxTrace(LPCTSTR lpszFormat, ...); +#else +void CDECL AfxTrace(LPCSTR lpszFormat, ...); +#endif + +#define TRACE ::AfxTrace +#define THIS_FILE __FILE__ +#define ASSERT(f) \ + do \ + { \ + if (!(f) && AfxAssertFailedLine(THIS_FILE, __LINE__)) \ + AfxDebugBreak(); \ + } while (0) \ + +#define VERIFY(f) ASSERT(f) +#define TRACE_FN(name) LogFn __logFn(name) +class LogFn +{ +public: + LogFn(LPCSTR pFnName) {m_pFnName = pFnName; TRACE("--%s: In--\n", pFnName);} + ~LogFn() {TRACE("--%s: Out--\n", m_pFnName);} +private: + LPCSTR m_pFnName; +}; +#else +// NDEBUG +#define ASSERT(f) ((void)0) +#define VERIFY(f) ((void)(f)) +#define ASSERT_VALID(pOb) ((void)0) +#define DEBUG_ONLY(f) ((void)0) +#ifdef WIN32 +inline void CDECL AfxTrace(LPCTSTR, ...) { } +#else +inline void CDECL AfxTrace(LPCSTR, ...) { } +#endif +#define TRACE 1 ? (void)0 : ::AfxTrace +#define TRACE_FN(name) +#endif // _DEBUG + diff --git a/mozilla/cmd/winfe/nabapi/xpapi.cpp b/mozilla/cmd/winfe/nabapi/xpapi.cpp new file mode 100644 index 00000000000..7d0c0b231b5 --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/xpapi.cpp @@ -0,0 +1,329 @@ +/* -*- 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. + */ +// +// XPAPI.CPP +// API implementation file for nab16.dll and nab32.dll +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// +#include +#include +#include +#include "xpapi.h" +#include +#include "nabutl.h" + +WORD LOAD_DS XP_CallProcess(LPCSTR pPath, LPCSTR pCmdLine) +{ + WORD wReturn = 0; +#ifndef WIN16 + STARTUPINFO startupInfo; + PROCESS_INFORMATION processInfo; + + memset(&startupInfo, 0, sizeof(startupInfo)); + startupInfo.cb = sizeof(startupInfo); + if (wReturn = CreateProcess(pPath, (LPTSTR)pCmdLine, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_PROCESS_GROUP, NULL, NULL, &startupInfo, &processInfo)) + { + WaitForInputIdle(processInfo.hProcess, 120000); + } +#else + // char szMsg[80]; + char szExecute[512]; + lstrcpy(szExecute, pPath); + lstrcat(szExecute, " "); + lstrcat(szExecute, pCmdLine); + wReturn = WinExec(szExecute,SW_SHOW); + + if (wReturn < 32) + { + wReturn = 0; + } +#endif + return wReturn; +} + +HKEY LOAD_DS RegOpenParent(LPCSTR pSection, HKEY hRootKey, REGSAM access) +{ + HKEY hKey; +#ifndef WIN16 + if (RegOpenKeyEx(hRootKey, pSection, 0, access, &hKey) != ERROR_SUCCESS) + { + return(NULL); + } +#else + if (RegOpenKey(hRootKey, pSection, &hKey) != ERROR_SUCCESS) + { + return(NULL); + } +#endif + return(hKey); +} + +HKEY LOAD_DS RegCreateParent(LPCSTR pSection, HKEY hMasterKey) +{ + HKEY hKey; + if (RegCreateKey(hMasterKey, pSection, &hKey) != ERROR_SUCCESS) + { + return(NULL); + } + return(hKey); +} + +BOOL LOAD_DS GetConfigInfoStr(LPCSTR pSection, LPCSTR pKey, LPSTR pBuf, int lenBuf, HKEY hMasterKey) +{ + HKEY hKey; + hKey = RegOpenParent(pSection, hMasterKey, KEY_QUERY_VALUE); + if (!hKey) + { + return(FALSE); + } + + DWORD len = (DWORD)lenBuf; +#ifndef WIN16 + BOOL retVal = (RegQueryValueEx(hKey, pKey, NULL, NULL, (LPBYTE)pBuf, &len) == ERROR_SUCCESS); +#else + BOOL retVal = (RegQueryValue(hKey, pKey, pBuf, (long far*)&len) == ERROR_SUCCESS); +#endif + RegCloseKey(hKey); + return(retVal); +} + +BOOL LOAD_DS GetConfigInfoNum(LPCSTR pSection, LPCSTR pKey, DWORD* pVal, HKEY hMasterKey) +{ + HKEY hKey; + hKey = RegOpenParent(pSection, hMasterKey, KEY_QUERY_VALUE); + if (!hKey) + { + return(FALSE); + } + + DWORD len = sizeof(DWORD); +#ifndef WIN16 + BOOL retVal = (RegQueryValueEx(hKey, pKey, NULL, NULL, (LPBYTE)pVal, &len) == ERROR_SUCCESS); +#else + BOOL retVal = (RegQueryValue(hKey, pKey, (char far*)pVal, (long far*)&len) == ERROR_SUCCESS); +#endif + RegCloseKey(hKey); + return(retVal); +} + +BOOL LOAD_DS SetConfigInfoStr(LPCSTR pSection, LPCSTR pKey, LPSTR pStr, HKEY hMasterKey) +{ + HKEY hKey; + hKey = RegCreateParent(pSection, hMasterKey); + if (!hKey) + { + return(FALSE); + } +#ifndef WIN16 + BOOL retVal = (RegSetValueEx(hKey, pKey, 0, REG_SZ, (LPBYTE)pStr, lstrlen(pStr) + 1) == ERROR_SUCCESS); +#else + BOOL retVal = (RegSetValue(hKey, pKey, REG_SZ, pStr, lstrlen(pStr) + 1) == ERROR_SUCCESS); +#endif + RegCloseKey(hKey); + return(retVal); +} + + +BOOL LOAD_DS XP_GetInstallDirectory(LPCSTR pcurVersionSection, LPCSTR pInstallDirKey, LPSTR path, UINT nSize, HKEY hKey) +{ +#ifdef WIN32 + if (!GetConfigInfoStr(pcurVersionSection, pInstallDirKey, path, nSize, hKey)) + { + return FALSE; + } + else + { + return TRUE; + } +#else + if ( 0 < GetPrivateProfileString(pcurVersionSection, pInstallDirKey,"ERROR", path, nSize, szNetscapeINI)) + { + return TRUE; + } + else + { + return FALSE; + } +#endif +} + + +BOOL LOAD_DS XP_GetVersionInfoString(LPCSTR pNavigatorSection, LPCSTR pCurrentVersionKey, LPSTR pcurVersionStr, UINT nSize, HKEY hKey) +{ +#ifdef WIN32 + if (!GetConfigInfoStr(pNavigatorSection, pCurrentVersionKey, pcurVersionStr, nSize, HKEY_LOCAL_MACHINE)) + { + return FALSE; + } + else + { + return TRUE; + } +#else + if ( 0 < GetPrivateProfileString(pNavigatorSection, pCurrentVersionKey,"ERROR", pcurVersionStr, nSize, szNetscapeINI)) + { + return TRUE; + } + else + { + return FALSE; + } +#endif + +} + +DWORD LOAD_DS XP_GetInstallLocation(LPSTR pPath, UINT nSize) +{ +char curVersionStr[256]; +char curVersionSection[256]; + + if (!pPath) + return NAB_FAILURE; + +#ifdef WIN32 + if (!XP_GetVersionInfoString(szNavigatorSection, szCurrentVersionKey, curVersionStr, + sizeof(curVersionStr), HKEY_LOCAL_MACHINE)) + { + return (NAB_FAILURE); + } + + wsprintf(curVersionSection, szNavigatorCurVersionSection, curVersionStr); + + if (!XP_GetInstallDirectory(curVersionSection, szInstallDirKey, pPath, + nSize, HKEY_LOCAL_MACHINE)) + { + return (NAB_FAILURE); + + } + + lstrcat(pPath, "\\"); + lstrcat(pPath, "Program\\netscape.exe"); + + return NAB_SUCCESS; +#else + if (32 == Is_16_OR_32_BIT_CommunitorRunning()) + { + if (!GetConfigInfoStr("snews\\shell\\open", "command", curVersionStr, sizeof(curVersionStr), HKEY_CLASSES_ROOT)) + { + return (NAB_FAILURE); + } + else + { + char *pFind = strstr(curVersionStr,"-h"); + + if (pFind) + { + *pFind=0; + lstrcpy(pPath,curVersionStr); + } + else + { + return (NAB_FAILURE); + } + } + + return NAB_SUCCESS; + } + else //setup up to start navstart since we are a sixteen bit DLL. + { + if (!XP_GetVersionInfoString(szNavigatorSection, szCurrentVersionKey, curVersionStr, sizeof(curVersionStr), HKEY_LOCAL_MACHINE)) + { + return (NAB_FAILURE); + } + + wsprintf(curVersionSection, szNavigatorCurVersionSection, curVersionStr); + + if (!XP_GetInstallDirectory(curVersionSection, szInstallDirKey, pPath,nSize, HKEY_LOCAL_MACHINE)) + { + return (NAB_FAILURE); + } + + lstrcat(pPath, "\\"); + lstrcat(pPath, "NAVSTART.EXE"); + return NAB_SUCCESS; + } +#endif +} + +int LOAD_DS Is_16_OR_32_BIT_CommunitorRunning() +{ + if (FindWindow("AfxFrameOrView", NULL) && !FindWindow("aHiddenFrameClass", NULL)) + return(16); + else if (FindWindow("aHiddenFrameClass", NULL)) + return(32); + else + return 0; +} + +// size of buffer to use for copying files. +#define COPYBUFSIZE 1024 + +#ifdef WIN16 + +BOOL Win16CopyFile(LPCSTR a_Src, LPCSTR a_Dest, BOOL a_bOverwrite) +{ + OFSTRUCT ofSrc, ofDest; + HFILE hSrc, hDest; + BOOL bResult; + + ofDest.cBytes = ofSrc.cBytes = sizeof(OFSTRUCT); + hDest = OpenFile(a_Dest, &ofDest, OF_EXIST); + if (hDest != HFILE_ERROR && !a_bOverwrite) + bResult = FALSE; // file exists but caller doesn't want file overwritten + else { // file either doesn't exist, or caller wants it overwritten. + hSrc = OpenFile(a_Src, &ofSrc, OF_READ); + hDest = OpenFile(a_Dest, &ofDest, OF_WRITE | OF_CREATE); + if (hSrc != HFILE_ERROR && hDest != HFILE_ERROR) { + unsigned char buf[COPYBUFSIZE]; + UINT bufsize = COPYBUFSIZE; + UINT bytesread; + + bResult = TRUE; + while (0 != (bytesread = _lread(hSrc, (LPVOID)buf, bufsize))) { + if ((bytesread == HFILE_ERROR) || // check for read error... + // and write error + (bytesread != _lwrite(hDest, (LPVOID)buf, bytesread))) { + bResult = FALSE; // could be out of diskspace + break; + } + } + } + else + bResult = FALSE; + + if (hSrc != HFILE_ERROR) + _lclose(hSrc); + if (hDest != HFILE_ERROR) + _lclose(hDest); + } + + return bResult; +} + +#endif // WIN16 + +BOOL LOAD_DS +XP_CopyFile(LPCSTR lpExistingFile, LPCSTR lpNewFile, BOOL bFailifExist) +{ +#ifdef WIN32 + return CopyFile(lpExistingFile, lpNewFile, bFailifExist); +#else + return Win16CopyFile(lpExistingFile, lpNewFile, TRUE); +#endif +} diff --git a/mozilla/cmd/winfe/nabapi/xpapi.h b/mozilla/cmd/winfe/nabapi/xpapi.h new file mode 100644 index 00000000000..2489b117eff --- /dev/null +++ b/mozilla/cmd/winfe/nabapi/xpapi.h @@ -0,0 +1,102 @@ +/* -*- 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. + */ +// +// Various routines for Address Book functions. +// Written by: Rich Pizzarro (rhp@netscape.com) +// November 1997 +// +#ifndef __XPAPI_H +#define __XPAPI_H + +#ifdef WIN16 + +#include +#include +#include +#include +#else +#include +#endif + +#ifdef WIN16 +#define _MAX_PATH 260 /* max. length of full pathname*/ +#define INVALID_HANDLE_VALUE (HANDLE)-1 +#define KEY_QUERY_VALUE 0x0001 +#define HKEY_LOCAL_MACHINE ((HKEY)0x80000002) +#define HKEY_ROOT HKEY_CLASSES_ROOT +#else +#define HKEY_ROOT ((HKEY)0x80000002) +#endif + +#ifdef WIN32 +#define NAB_IMPLEMENT(param) param PASCAL +#define LOAD_DS +#else +#define LOAD_DS __loadds +#define NAB_IMPLEMENT(param) extern "C" param FAR PASCAL +#endif + +// +// registry keys +// +#ifdef WIN32 +static char szNavigatorSection[] = "Software\\Netscape\\Netscape Navigator"; +static char szNavigatorCurVersionSection[] = "Software\\Netscape\\Netscape Navigator\\%s\\Main"; +static char szCurrentVersionKey[] = "CurrentVersion"; +static char szInstallDirKey[] = "Install Directory"; +static char szTempFiles[] = "TempFiles"; +static char szNABLog[] = "NAB32.LOG"; +#else +//32 bit key strings for trying to read the 32bit registry +static char szNavigatorSection32[] = "Software\\Netscape\\Netscape Navigator"; +static char szNavigatorCurVersionSection32[] = "Software\\Netscape\\Netscape Navigator\\%s\\Main"; + +// ini section and key strings +static char szNetscapeINI[] = "nscp.ini"; +static char szNavigatorSection[] = "Netscape Navigator"; +static char szNavigatorCurVersionSection[] = "Netscape Navigator-%s"; +static char szCurrentVersionKey[] = "CurrentVersion"; +static char szInstallDirKey[] = "Install Directory"; +static char szTempFiles[] = "TempFiles"; +static char szExeName[] = "NAVSTART.EXE"; +static char szNABLog[] = "NAB16.LOG"; +#endif + +//Since REGSAM is just an ACCESS_MASK which is just a DWORD and it's not +//declared in win16 we'll make one hear for the purpose of keeping parameters +//the same even though the access rights don't get used for win16. + +typedef DWORD REGSAM; + + +// XP declarations + +int LOAD_DS Is_16_OR_32_BIT_CommunitorRunning(); +WORD LOAD_DS XP_CallProcess(LPCSTR pPath, LPCSTR pCmdLine); +HKEY LOAD_DS RegOpenParent(LPCSTR pSection, HKEY hRootKey, REGSAM access); +HKEY LOAD_DS RegCreateParent(LPCSTR pSection, HKEY hMasterKey); +BOOL LOAD_DS GetConfigInfoStr(LPCSTR pSection, LPCSTR pKey, LPSTR pBuf, int lenBuf, HKEY hMasterKey); +BOOL LOAD_DS GetConfigInfoNum(LPCSTR pSection, LPCSTR pKey, DWORD* pVal, HKEY hMasterKey); +BOOL LOAD_DS SetConfigInfoStr(LPCSTR pSection, LPCSTR pKey, LPSTR pStr, HKEY hMasterKey); + +BOOL LOAD_DS XP_GetInstallDirectory(LPCSTR pcurVersionSection, LPCSTR pInstallDirKey, LPSTR path, UINT nSize, HKEY hKey); +BOOL LOAD_DS XP_GetVersionInfoString(LPCSTR pNavigatorSection, LPCSTR pCurrentVersionKey, LPSTR pcurVersionStr, UINT nSize, HKEY hKey); +DWORD LOAD_DS XP_GetInstallLocation(LPSTR pPath, UINT nSize); +BOOL LOAD_DS XP_CopyFile(LPCSTR lpExistingFile, LPCSTR lpNewFile, BOOL bFailifExist); + +#endif // __XPAPI_H \ No newline at end of file diff --git a/mozilla/cmd/winfe/nabtest/ldifdiag.cpp b/mozilla/cmd/winfe/nabtest/ldifdiag.cpp new file mode 100644 index 00000000000..52f20f7368e --- /dev/null +++ b/mozilla/cmd/winfe/nabtest/ldifdiag.cpp @@ -0,0 +1,180 @@ +/* -*- 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. + */ +// +#include +#include +#include "port.h" +#include "resource.h" + +// +// Variables... +// +extern HINSTANCE hInst; +LPSTR ldifRetPtr = NULL; +extern HINSTANCE m_hInstNAB; + +// +// Forward declarations... +// +LPSTR DoLDIFDiag(HWND hWnd); +extern void ShowMessage(HWND hWnd, LPSTR msg); +extern void SetFooter(LPSTR msg); +void ProcessOK(HWND hWnd); + +void +SetDefaults(HWND hWndDiag) +{ + // Start with the basics... + SetDlgItemText(hWndDiag, FIRSTNAME, "firstName"); + SetDlgItemText(hWndDiag, LASTNAME, "lastName"); + SetDlgItemText(hWndDiag, NOTES, "generalNotes"); + SetDlgItemText(hWndDiag, CITY, "city"); + SetDlgItemText(hWndDiag, STATE, "state"); + SetDlgItemText(hWndDiag, EMAIL, "email"); + SetDlgItemText(hWndDiag, TITLE, "title"); + SetDlgItemText(hWndDiag, ADDR1, "addrLine1"); + SetDlgItemText(hWndDiag, ADDR2, "addrLine2"); + SetDlgItemText(hWndDiag, ZIPCODE, "zipCode"); + SetDlgItemText(hWndDiag, COUNTRY, "country"); + SetDlgItemText(hWndDiag, BUSINESSPHONE, "businessPhone"); + SetDlgItemText(hWndDiag, FAXPHONE, "faxPhone"); + SetDlgItemText(hWndDiag, HOMEPHONE, "homePhone"); + SetDlgItemText(hWndDiag, ORG, "organization"); + SetDlgItemText(hWndDiag, NICKNAME, "nickname"); + SetDlgItemText(hWndDiag, USEHTML, "TRUE"); +} + +void +ProcessLDIFCommand(HWND hWnd, int id, HWND hCtl, UINT codeNotify) +{ + switch (id) + { + case IDCANCEL: + ldifRetPtr = NULL; + EndDialog(hWnd, 0); + break; + + case IDDEFAULTS: + SetDefaults(hWnd); + break; + + case IDOK: + ProcessOK(hWnd); + break; + + default: + break; + } +} + +BOOL CALLBACK LOADDS +LDIFDlgProc(HWND hWndMail, UINT wMsg, WPARAM wParam, LPARAM lParam) +{ + switch (wMsg) + { + case WM_INITDIALOG: + { + } + break; + + case WM_COMMAND: + HANDLE_WM_COMMAND(hWndMail, wParam, lParam, ProcessLDIFCommand); + break; + + default: + return FALSE; + } + + return TRUE; +} + +LPSTR +DoLDIFDiag(HWND hWnd) +{ + if (!ldifRetPtr) + free(ldifRetPtr); + + DialogBox(hInst, MAKEINTRESOURCE(ID_DIALOG_LDIF), hWnd, (DLGPROC)LDIFDlgProc); + return ldifRetPtr; +} + +void +ProcessOK(HWND hWndDiag) +{ + char *(FAR PASCAL *lpfnNAB_FormatLDIFLine) + ( char *firstName, char *lastName, char *generalNotes, char *city, + char *state, char *email, char *title, char *addrLine1, char *addrLine2, + char *zipCode, char *country, char *businessPhone, char *faxPhone, + char *homePhone, char *organization, char *nickname, char *useHTML); +#ifdef WIN16 + (FARPROC&) lpfnNAB_FormatLDIFLine = GetProcAddress(m_hInstNAB, "NAB_FORMATLDIFLINE"); +#else + (FARPROC&) lpfnNAB_FormatLDIFLine = GetProcAddress(m_hInstNAB, "NAB_FormatLDIFLine"); +#endif + + if (!lpfnNAB_FormatLDIFLine) + { + ShowMessage(hWndDiag, "Unable to locate NAB function."); + return; + } + +#define VARSIZE 64 + +char firstName[VARSIZE]; +char lastName[VARSIZE]; +char generalNotes[VARSIZE]; +char city[VARSIZE]; +char state[VARSIZE]; +char email[VARSIZE]; +char title[VARSIZE]; +char addrLine1[VARSIZE]; +char addrLine2[VARSIZE]; +char zipCode[VARSIZE]; +char country[VARSIZE]; +char businessPhone[VARSIZE]; +char faxPhone[VARSIZE]; +char homePhone[VARSIZE]; +char organization[VARSIZE]; +char nickname[VARSIZE]; +char useHTML[VARSIZE]; + + GetDlgItemText(hWndDiag, FIRSTNAME, firstName, VARSIZE); + GetDlgItemText(hWndDiag, LASTNAME, lastName, VARSIZE); + GetDlgItemText(hWndDiag, NOTES, generalNotes, VARSIZE); + GetDlgItemText(hWndDiag, CITY, city, VARSIZE); + GetDlgItemText(hWndDiag, STATE, state, VARSIZE); + GetDlgItemText(hWndDiag, EMAIL, email, VARSIZE); + GetDlgItemText(hWndDiag, TITLE, title, VARSIZE); + GetDlgItemText(hWndDiag, ADDR1, addrLine1, VARSIZE); + GetDlgItemText(hWndDiag, ADDR2, addrLine2, VARSIZE); + GetDlgItemText(hWndDiag, ZIPCODE, zipCode, VARSIZE); + GetDlgItemText(hWndDiag, COUNTRY, country, VARSIZE); + GetDlgItemText(hWndDiag, BUSINESSPHONE, businessPhone, VARSIZE); + GetDlgItemText(hWndDiag, FAXPHONE, faxPhone, VARSIZE); + GetDlgItemText(hWndDiag, HOMEPHONE, homePhone, VARSIZE); + GetDlgItemText(hWndDiag, ORG, organization, VARSIZE); + GetDlgItemText(hWndDiag, NICKNAME, nickname, VARSIZE); + GetDlgItemText(hWndDiag, USEHTML, useHTML, VARSIZE); + + ldifRetPtr = (*lpfnNAB_FormatLDIFLine) + ( firstName, lastName, generalNotes, city, + state, email, title, addrLine1, addrLine2, + zipCode, country, businessPhone, faxPhone, + homePhone, organization, nickname, useHTML); + EndDialog(hWndDiag, 0); +} diff --git a/mozilla/cmd/winfe/nabtest/main.cpp b/mozilla/cmd/winfe/nabtest/main.cpp new file mode 100644 index 00000000000..cfd84efbb19 --- /dev/null +++ b/mozilla/cmd/winfe/nabtest/main.cpp @@ -0,0 +1,218 @@ +/* -*- 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. + */ +// +#include +#include +#include +#include + +#include "port.h" +#include "resource.h" +#include "nabapi.h" + +#ifndef WM_PAINTICON +#define WM_PAINTICON 0x26 +#endif // WM_PAINTICON + +/* + * Forward Declarations... + */ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow); +BOOL CALLBACK LOADDS MyDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam); +extern void ProcessCommand(HWND hWnd, int id, HWND hCtl, UINT codeNotify); +BOOL OpenNAB(void); +void CloseNAB(void); + +/* + * Global variables + */ +HINSTANCE hInst; +HWND hWnd; + +#ifdef WIN16 +HICON hIconApp; +#endif + +char NEAR szAppName[] = "Netscape AB Test"; +char NEAR szShortAppName[] = "ABTEST"; +char szClassName[] = "Netscape_ABTest_Class_Name"; + +void +AppCleanup(void) +{ + extern void DoNAB_Close(HWND hWnd); + static BOOL isDone = FALSE; + + if (isDone) + return; + + extern NABConnectionID nabConn; + + if (nabConn != 0) + { + DoNAB_Close(hWnd); + } + + CloseNAB(); + isDone = TRUE; +} + +BOOL +InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + /* Create a main window for this application instance. */ + hWnd = CreateDialog((HINSTANCE) hInstance, + MAKEINTRESOURCE(ID_DIALOG), + (HWND) NULL, (DLGPROC) MyDlgProc); + + if (!hWnd) + return FALSE; + else + return TRUE; +} + +BOOL InitApp(void) +{ +#ifndef WIN16 + WNDCLASS wc; + wc.style = 0; + wc.lpfnWndProc = DefDlgProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = DLGWINDOWEXTRA; + wc.hInstance = hInst; + wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_APP)); + wc.hCursor = LoadCursor(0, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszMenuName = NULL; + wc.lpszClassName = szClassName; + + if(!RegisterClass(&wc)) + return FALSE; + +#else + hIconApp = LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON_APP)); +#endif + + return TRUE; +} // end InitApp + +// Win Main +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + hInst = hInstance; + + if (!InitApp()) + { + return FALSE; + } + + if (!InitInstance(hInstance, nCmdShow)) + { + return FALSE; + } + + if (!OpenNAB()) + { + return FALSE; + } + + ShowWindow(hWnd, SW_SHOW); + + // Start the application + while ((GetMessage(&msg, (HWND) NULL, (UINT) NULL, (UINT) NULL))) + { + if(IsDialogMessage(hWnd, &msg)) + continue; + + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return(msg.wParam); +} + +BOOL CALLBACK LOADDS +MyDlgProc(HWND hWndMain, UINT wMsg, WPARAM wParam, LPARAM lParam) +{ + switch (wMsg) + { + case WM_INITDIALOG: + { + hWnd = hWndMain; + SetDlgItemText(hWnd, ID_EDIT_ROW, "0"); + } + break; + + case WM_CLOSE: + { + DestroyWindow(hWnd); + break; + } + + case WM_DESTROY: + { + AppCleanup(); + +#ifndef WIN16 + UnregisterClass(szClassName, hInst); +#else + // Destroy the 16 bit windows icon + if(hIconApp != 0) + DestroyIcon(hIconApp); +#endif + + PostQuitMessage(0); + break; + } + case WM_COMMAND: + HANDLE_WM_COMMAND(hWnd, wParam, lParam, ProcessCommand); + break; + + case WM_QUERYDRAGICON: +#ifdef WIN16 + return (BOOL)hIconApp; +#endif + + case WM_PAINTICON: +#ifdef WIN16 + SetClassWord(hWnd, GCW_HICON, 0); + + // fall trough + case WM_PAINT: + { + if(!IsIconic(hWnd)) + return FALSE; + PAINTSTRUCT ps; + HDC hDC = BeginPaint(hWnd, &ps); + SetMapMode(hDC, MM_TEXT); + DrawIcon(hDC, 2, 2, hIconApp); + EndPaint(hWnd, &ps); + break; + } +#endif //WIN16 + break; // RICHIE - if this is not here NT 3.51 Pukes!!!! + + default: + return FALSE; + } + + //~~av return (DefWindowProc(hWnd, wMsg, wParam, lParam)); + return TRUE; +} diff --git a/mozilla/cmd/winfe/nabtest/nabproc.cpp b/mozilla/cmd/winfe/nabtest/nabproc.cpp new file mode 100644 index 00000000000..31e7c17bac5 --- /dev/null +++ b/mozilla/cmd/winfe/nabtest/nabproc.cpp @@ -0,0 +1,1075 @@ +/* -*- 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. + */ +// +#include +#include +#include + +#include "port.h" +#include "resource.h" +#include "nabapi.h" + +// +// Variables... +// +extern HINSTANCE hInst; +HINSTANCE m_hInstNAB; +NABConnectionID nabConn; + +void SetFooter(LPSTR msg); +LPSTR GetNABError(LONG errorCode); + +void DoNAB_Open(HWND hWnd); +void DoNAB_Close(HWND hWnd); +void DoNAB_GetAddressBookList(HWND hWnd); +void DoNAB_GetDefaultAddressBook(HWND hWnd); +void DoNAB_CreatePersonalAddressBook(HWND hWnd); +void DoNAB_FreeMemory(HWND hWnd, LPVOID buf, BOOL alert); +void DoNAB_SaveAddressBookToHTML(HWND hWnd); +void DoNAB_ImportLDIFFile(HWND hWnd); +void DoNAB_ExportLDIFFile(HWND hWnd); +void DoNAB_GetFirstAddressBookEntry(HWND hWnd); +void DoNAB_FindAddressBookEntry(HWND hWnd); +void DoNAB_InsertAddressBookEntry(HWND hWnd); +void DoNAB_UpdateAddressBookEntry(HWND hWnd); +void DoNAB_DeleteAddressBookEntry(HWND hWnd); +LPSTR DoLDIFDiag(HWND hWnd); + +void +HackIt(NABAddrBookDescType **arrayPtr[]) +{ + *arrayPtr = (NABAddrBookDescType **) malloc(sizeof(NABAddrBookDescType)); + *arrayPtr[0] = (NABAddrBookDescType *) malloc(sizeof(NABAddrBookDescType)); +} + +void +DoTheHack(void) +{ + NABAddrBookDescType **descType; + + HackIt(&descType); + int x = 1; +} + +void +ProcessCommand(HWND hWnd, int id, HWND hCtl, UINT codeNotify) +{ + switch (id) + { + case ID_BUTTON_LDIFDIAG: + { + LPSTR ptr = DoLDIFDiag(hWnd); + SetDlgItemText(hWnd, ID_EDIT_FINDLDIF, ptr); + } + break; + + case ID_LIST_USERS: + switch(codeNotify) + { + case LBN_SELCHANGE: + { + char abookInfo[512]; + DWORD selected = ListBox_GetCurSel(GetDlgItem(hWnd, ID_LIST_USERS)); + if (selected == LB_ERR) + break; + ListBox_GetText(GetDlgItem(hWnd, ID_LIST_USERS), selected, abookInfo); + SetDlgItemText(hWnd, ID_EDIT_FINDLDIF, abookInfo); + break; + } + default: + break; + } + break; + + case ID_BUTTON_OPEN: + DoNAB_Open(hWnd); + break; + + case ID_BUTTON_CLOSE: + DoNAB_Close(hWnd); + break; + + case ID_BUTTON_GETADDRLIST: + DoNAB_GetAddressBookList(hWnd); + break; + + case ID_BUTTON_GETDEF_ADDR: + DoNAB_GetDefaultAddressBook(hWnd); + break; + + case ID_BUTTON_CREATEABOOK: + DoNAB_CreatePersonalAddressBook(hWnd); + break; + + case ID_BUTTON_SAVETOHTML: + DoNAB_SaveAddressBookToHTML(hWnd); + break; + + case ID_BUTTON_EXPORTLDIF: + DoNAB_ExportLDIFFile(hWnd); + break; + + case ID_BUTTON_IMPORTLDIF: + DoNAB_ImportLDIFFile(hWnd); + break; + + case ID_BUTTON_LISTAB: + DoNAB_GetFirstAddressBookEntry(hWnd); + break; + + case ID_BUTTON_FINDAB: + DoNAB_FindAddressBookEntry(hWnd); + break; + + case ID_BUTTON_INSERT: + DoNAB_InsertAddressBookEntry(hWnd); + break; + + case ID_BUTTON_UPDATE: + DoNAB_UpdateAddressBookEntry(hWnd); + break; + + case ID_BUTTON_DELETE: + DoNAB_DeleteAddressBookEntry(hWnd); + break; + + case ID_MENU_MYEXIT: + DestroyWindow(hWnd); + break; + + case ID_BUTTON_CLEAR: + case ID_MENU_CLEARRESULTS: + ListBox_ResetContent(GetDlgItem(hWnd, ID_LIST_ABOOK)); + ListBox_ResetContent(GetDlgItem(hWnd, ID_LIST_USERS)); + break; + + case ID_MENU_MYABOUT: + MessageBox(hWnd, + "Netscape Address Book API Test Harness\nWritten by: Rich Pizzarro (rhp@netscape.com)", + "About", + MB_ICONINFORMATION); + break; + + default: + break; + } +} + +// +// This is all needed to process a MAPIReadMail operation +// +static LPSTR +CheckNull(LPSTR inStr) +{ + static LPSTR str = ""; + + str[0] = '\0'; + if (inStr == NULL) + return((LPSTR)str); + else + return(inStr); +} + +void +SetFooter(LPSTR msg) +{ + extern HWND hWnd; + + SetDlgItemText(hWnd, ID_STATIC_RESULT, msg); +} + +LPSTR +GetNABError(LONG errorCode) +{ + static char FAR msg[128]; + + switch (errorCode) + { + case NAB_SUCCESS: + lstrcpy(msg, "The API call succeeded."); + break; + case NAB_FAILURE: + lstrcpy(msg, "This is a generic NAB API failure."); + break; + case NAB_INVALID_CONNID: + lstrcpy(msg, "Invalid Connection ID for request"); + break; + case NAB_NOT_OPEN: + lstrcpy(msg, "This will be returned when a call is made to the API without NAB_Open() being called first."); + break; + case NAB_NOT_FOUND: + lstrcpy(msg, "The requested information was not found."); + break; + case NAB_PERMISSION_DENIED: + lstrcpy(msg, "User does not have write permission to perform the operation"); + break; + case NAB_DISK_FULL: + lstrcpy(msg, "Disk full condition encountered attempting to perform the operation"); + break; + case NAB_INVALID_NAME: + lstrcpy(msg, "The name specified for the operation is invalid"); + break; + case NAB_INVALID_ABOOK: + lstrcpy(msg, "The address book specified is invalid"); + break; + case NAB_FILE_NOT_FOUND: + lstrcpy(msg, "The disk file for the operation was not found"); + break; + case NAB_ALREADY_EXISTS: + lstrcpy(msg, "The user entry already exists in the address book being updated"); + break; + case NAB_MAXCON_EXCEEDED: + lstrcpy(msg, "The maximum number of API connections has been exceeded"); + break; + case NAB_MEMORY_FAILURE: + lstrcpy(msg, "Memory condition, such as malloc() failures"); + break; + case NAB_FILE_ERROR: + lstrcpy(msg, "Error on file creation"); + break; + case NAB_INVALID_ENTRY: + lstrcpy(msg, "Invalid entry for operation"); + break; + case NAB_MULTIPLE_USERS_FOUND: + lstrcpy(msg, "More than one person found with current search criteria"); + break; + case NAB_INVALID_SEARCH_ATTRIB: + lstrcpy(msg, "Invalid search criteria"); + break; + default: + strcpy(msg, "Unknown NAB Return Code"); + break; + } + + return((LPSTR) &(msg[0])); +} + +void +ShowMessage(HWND hWnd, LPSTR msg) +{ + MessageBox(hWnd, msg, "Info Message", MB_ICONINFORMATION); +} + +BOOL +OpenNAB(void) +{ +#ifdef WIN16 + m_hInstNAB = LoadLibrary("Y:\\ns\\cmd\\winfe\\nabapi\\NABAPI.DLL"); +#else + m_hInstNAB = LoadLibrary("Y:\\ns\\cmd\\winfe\\nabapi\\x86Dbg\\NABAPI32.DLL"); + // m_hInstNAB = LoadLibrary("NABAPI32.DLL"); +#endif + + if (!m_hInstNAB) + { + ShowMessage(NULL, "Error Loading the Address Book DLL...Probably not found!"); + return(FALSE); + } + + return(TRUE); +} + +void +CloseNAB(void) +{ + if(m_hInstNAB) + { + FreeLibrary(m_hInstNAB); + } +} + +int +GetCurrentABook(HWND hWnd, NABAddrBookDescType *abInfo) +{ + char abookInfo[512]; + + DWORD selected = ListBox_GetCurSel(GetDlgItem(hWnd, ID_LIST_ABOOK)); + if (selected == LB_ERR) + { + ShowMessage(hWnd, "Select a valid address book for this operation\nYou may have to perform a Get AB List operation."); + return(0); + } + + ListBox_GetText(GetDlgItem(hWnd, ID_LIST_ABOOK), selected, abookInfo); + char *ptr = strchr(abookInfo, '|'); + if (!ptr) + return(0); + + --ptr; + *ptr = '\0'; + abInfo->description = strdup(abookInfo); + *ptr = ' '; + ptr += 3; + abInfo->fileName = strdup(ptr); + return(1); +} + +void +DoNAB_Open(HWND hWnd) +{ + char msg[256]; + + UINT_16 majorVerNumber; + UINT_16 minorVerNumber; + + // Get Address of NAB function... + NABError (FAR PASCAL *lpfnNAB_Open)(NABConnectionID *id, UINT_16 *majorVerNumber, UINT_16 *minorVerNumber); + +#ifdef WIN16 + (FARPROC&) lpfnNAB_Open = GetProcAddress(m_hInstNAB, "NAB_OPEN"); +#else + (FARPROC&) lpfnNAB_Open = GetProcAddress(m_hInstNAB, "NAB_Open"); +#endif + + if (!lpfnNAB_Open) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + LONG rc = (*lpfnNAB_Open)( &nabConn, &majorVerNumber, &minorVerNumber ); + if (rc == NAB_SUCCESS) + { + wsprintf(msg, "Success with connection id = %d", nabConn); + ShowMessage(hWnd, msg); + SetFooter("Logon success"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from Logon\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("Open failed"); + } +} + +void +DoNAB_Close(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_Close) ( NABConnectionID id ); + +#ifdef WIN16 + (FARPROC&) lpfnNAB_Close = GetProcAddress(m_hInstNAB, "NAB_CLOSE"); +#else + (FARPROC&) lpfnNAB_Close = GetProcAddress(m_hInstNAB, "NAB_Close"); +#endif + + if (!lpfnNAB_Close) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char msg[256]; + NABError rc = (*lpfnNAB_Close)( nabConn ); + if (rc == NAB_SUCCESS) + { + wsprintf(msg, "Successful Close"); + ShowMessage(hWnd, msg); + SetFooter(msg); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from Close\nError=[%s]", + rc, GetNABError(rc)); + + ShowMessage(hWnd, msg); + SetFooter("Close failed"); + } + + nabConn = 0; +} + +void +DoNAB_FreeMemory(HWND hWnd, LPVOID buf, BOOL alert) +{ + NABError (FAR PASCAL *lpfnNABFreeMemory) (void *ptr); + +#ifdef WIN16 + (FARPROC&) lpfnNABFreeMemory = GetProcAddress(m_hInstNAB, "NAB_FREEMEMORY"); +#else + (FARPROC&) lpfnNABFreeMemory = GetProcAddress(m_hInstNAB, "NAB_FreeMemory"); +#endif + + if (!lpfnNABFreeMemory) + { + ShowMessage(hWnd, "Unable to locate NAB Function."); + return; + } + + char msg[256]; + LONG rc = (*lpfnNABFreeMemory)(buf); + if (rc == NAB_SUCCESS) + { + wsprintf(msg, "Successful Free Memory Operation"); + if (alert) + ShowMessage(hWnd, msg); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from NAB_FreeMemory\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + } +} + +void +DoNAB_GetAddressBookList(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_GetAddressBookList) + (NABConnectionID id, UINT_32 *abookCount, + NABAddrBookDescType **aBooks[]); +#ifdef WIN16 + (FARPROC&) lpfnNAB_GetAddressBookList = GetProcAddress(m_hInstNAB, "NAB_GETADDRESSBOOKLIST"); +#else + (FARPROC&) lpfnNAB_GetAddressBookList = GetProcAddress(m_hInstNAB, "NAB_GetAddressBookList"); +#endif + + if (!lpfnNAB_GetAddressBookList) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char msg[512]; + UINT_32 abookCount; + NABAddrBookDescType **descType; + + // Clear the list before we start... + ListBox_ResetContent(GetDlgItem(hWnd, ID_LIST_ABOOK)); + NABError rc = (*lpfnNAB_GetAddressBookList)( nabConn, &abookCount, &descType ); + + if (rc == NAB_SUCCESS) + { + for (DWORD i=0; idescription), + CheckNull(descType[i]->fileName)); + ListBox_InsertString(GetDlgItem(hWnd, ID_LIST_ABOOK), 0, msg); + ListBox_SetHorizontalExtent(GetDlgItem(hWnd, ID_LIST_ABOOK), 2048); + DoNAB_FreeMemory(hWnd, descType[i], FALSE); + } + + ShowMessage(hWnd, "Successful Call to Address Book List."); + SetFooter("Successful Call to Address Book List"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from Address Book List\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("GetAddressBookList failed"); + } +} + +void +DoNAB_GetDefaultAddressBook(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_GetDefaultAddressBook) (NABConnectionID id, NABAddrBookDescType **aBook); +#ifdef WIN16 + (FARPROC&) lpfnNAB_GetDefaultAddressBook = GetProcAddress(m_hInstNAB, "NAB_GETDEFAULTADDRESSBOOK"); +#else + (FARPROC&) lpfnNAB_GetDefaultAddressBook = GetProcAddress(m_hInstNAB, "NAB_GetDefaultAddressBook"); +#endif + + if (!lpfnNAB_GetDefaultAddressBook) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char msg[512]; + NABAddrBookDescType *descType; + + NABError rc = (*lpfnNAB_GetDefaultAddressBook)( nabConn, &descType ); + if (rc == NAB_SUCCESS) + { + wsprintf(msg, "%s | %s", CheckNull(descType->description), + CheckNull(descType->fileName)); + ListBox_InsertString(GetDlgItem(hWnd, ID_LIST_ABOOK), 0, msg); + ListBox_SetHorizontalExtent(GetDlgItem(hWnd, ID_LIST_ABOOK), 2048); + + wsprintf(msg, "Default Address Book:\nName=[%s]\nFile=%s", + CheckNull(descType->description), + CheckNull(descType->fileName)); + DoNAB_FreeMemory(hWnd, descType, FALSE); + ShowMessage(hWnd, msg); + SetFooter("Found Default"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from Default Address Book\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("GetDefaultAddressBook failed"); + } +} + +void +DoNAB_CreatePersonalAddressBook(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_CreatePersonalAddressBook) (NABConnectionID id, char *addrBookName, NABAddrBookDescType **addrBook); + +#ifdef WIN16 + (FARPROC&) lpfnNAB_CreatePersonalAddressBook = GetProcAddress(m_hInstNAB, "NAB_CREATEPERSONALADDRESSBOOK"); +#else + (FARPROC&) lpfnNAB_CreatePersonalAddressBook = GetProcAddress(m_hInstNAB, "NAB_CreatePersonalAddressBook"); +#endif + + if (!lpfnNAB_CreatePersonalAddressBook) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char abookName[256]; + char msg[256]; + NABAddrBookDescType *abookDesc; + + GetDlgItemText(hWnd, ID_EDIT_ABOOKNAME, abookName, sizeof(abookName)); + if (abookName[0] == '\0') + { + ShowMessage(hWnd, "Enter a name for the new address book!"); + return; + } + + // Clear the list before we start... + NABError rc = (*lpfnNAB_CreatePersonalAddressBook) + (nabConn, abookName, &abookDesc); + if (rc == NAB_SUCCESS) + { + wsprintf(msg, "New Address Book:\nName=[%s]\nFile=%s", + CheckNull(abookDesc->description), + CheckNull(abookDesc->fileName)); + DoNAB_FreeMemory(hWnd, abookDesc, TRUE); + ShowMessage(hWnd, msg); + SetFooter("Created successfully"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from NAB_CreatePersonalAddressBook\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("NAB_CreatePersonalAddressBook failed"); + } +} + +void +DoNAB_SaveAddressBookToHTML(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_SaveAddressBookToHTML) (NABConnectionID id, NABAddrBookDescType *addrBook, + char *fileName); +#ifdef WIN16 + (FARPROC&) lpfnNAB_SaveAddressBookToHTML = GetProcAddress(m_hInstNAB, "NAB_SAVEADDRESSBOOKTOHTML"); +#else + (FARPROC&) lpfnNAB_SaveAddressBookToHTML = GetProcAddress(m_hInstNAB, "NAB_SaveAddressBookToHTML"); +#endif + + if (!lpfnNAB_SaveAddressBookToHTML) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char fname[256]; + char msg[256]; + NABAddrBookDescType abookDesc; + + GetDlgItemText(hWnd, ID_EDIT_FNAME, fname, sizeof(fname)); + if (fname[0] == '\0') + { + ShowMessage(hWnd, "Enter a valid file name!"); + return; + } + + // Get the selected address book... + if (!GetCurrentABook(hWnd, &abookDesc)) + { + return; + } + + NABError rc = (*lpfnNAB_SaveAddressBookToHTML) + (nabConn, &abookDesc, fname); + + if (rc == NAB_SUCCESS) + { + ShowMessage(hWnd, "Created HTML file successfully."); + SetFooter("Created HTML file successfully"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from NAB_SaveAddressBookToHTML\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("NAB_SaveAddressBookToHTML failed"); + } +} + +void +DoNAB_ExportLDIFFile(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_ExportLDIFFile) + (NABConnectionID id, NABAddrBookDescType *addrBook, char *fileName); + +#ifdef WIN16 + (FARPROC&) lpfnNAB_ExportLDIFFile = GetProcAddress(m_hInstNAB, "NAB_EXPORTLDIFFILE"); +#else + (FARPROC&) lpfnNAB_ExportLDIFFile = GetProcAddress(m_hInstNAB, "NAB_ExportLDIFFile"); +#endif + + if (!lpfnNAB_ExportLDIFFile) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char fname[256]; + char msg[256]; + NABAddrBookDescType abookDesc; + + GetDlgItemText(hWnd, ID_EDIT_FNAME, fname, sizeof(fname)); + if (fname[0] == '\0') + { + ShowMessage(hWnd, "Enter a valid file name!"); + return; + } + + // Get the selected address book... + if (!GetCurrentABook(hWnd, &abookDesc)) + { + return; + } + + NABError rc = (*lpfnNAB_ExportLDIFFile) + (nabConn, &abookDesc, fname); + + if (rc == NAB_SUCCESS) + { + ShowMessage(hWnd, "Created LDIF file successfully."); + SetFooter("Created LDIF file successfully"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from NAB_ExportLDIFFile\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("NAB_ExportLDIFFile failed"); + } +} + +void +DoNAB_ImportLDIFFile(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_ImportLDIFFile) + (NABConnectionID id, NABAddrBookDescType *addrBook, char *fileName, + NABBool deleteFileWhenFinished); + +#ifdef WIN16 + (FARPROC&) lpfnNAB_ImportLDIFFile = GetProcAddress(m_hInstNAB, "NAB_IMPORTLDIFFILE"); +#else + (FARPROC&) lpfnNAB_ImportLDIFFile = GetProcAddress(m_hInstNAB, "NAB_ImportLDIFFile"); +#endif + + if (!lpfnNAB_ImportLDIFFile) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char fname[256]; + char msg[256]; + NABAddrBookDescType abookDesc; + + GetDlgItemText(hWnd, ID_EDIT_FNAME, fname, sizeof(fname)); + if (fname[0] == '\0') + { + ShowMessage(hWnd, "Enter a valid file name!"); + return; + } + + // Get the selected address book... + if (!GetCurrentABook(hWnd, &abookDesc)) + { + return; + } + + NABError rc = (*lpfnNAB_ImportLDIFFile) + (nabConn, &abookDesc, fname, FALSE); + + if (rc == NAB_SUCCESS) + { + ShowMessage(hWnd, "Imported LDIF file successfully."); + SetFooter("Imported LDIF file successfully"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from NAB_ImportLDIFFile\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("NAB_ImportLDIFFile failed"); + } +} + +void +DoNAB_GetFirstAddressBookEntry(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_GetFirstAddressBookEntry) + (NABConnectionID id, NABAddrBookDescType *addrBook, NABUserID *userID, + char **ldifEntry, NABUpdateTime *updTime); + NABError (FAR PASCAL *lpfnNAB_GetNextAddressBookEntry) + (NABConnectionID id, NABUserID *userID, + char **ldifEntry, NABUpdateTime *updTime); + +#ifdef WIN16 + (FARPROC&) lpfnNAB_GetFirstAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_GETFIRSTADDRESSBOOKENTRY"); + (FARPROC&) lpfnNAB_GetNextAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_GETNEXTADDRESSBOOKENTRY"); +#else + (FARPROC&) lpfnNAB_GetFirstAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_GetFirstAddressBookEntry"); + (FARPROC&) lpfnNAB_GetNextAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_GetNextAddressBookEntry"); +#endif + + if ((!lpfnNAB_GetFirstAddressBookEntry) || (!lpfnNAB_GetNextAddressBookEntry)) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char msg[128]; + NABAddrBookDescType abookDesc; + NABUserID userID; + char *ldifInfo; + NABUpdateTime updTime; + DWORD totalCount = 0; + + // Get the selected address book... + if (!GetCurrentABook(hWnd, &abookDesc)) + { + return; + } + + // Reset the list... + ListBox_ResetContent(GetDlgItem(hWnd, ID_LIST_USERS)); + + NABError rc = (*lpfnNAB_GetFirstAddressBookEntry) + (nabConn, &abookDesc, &userID, &ldifInfo, &updTime); + while (rc == NAB_SUCCESS) + { + char *tmp; + + if (strlen(ldifInfo) <= 0) + goto NEXT; + + tmp = (char *)malloc(strlen(ldifInfo) + 128); + if (!tmp) + goto NEXT; + + wsprintf(tmp, "U=%d T=%d|%s", userID, updTime, ldifInfo); + ListBox_InsertString(GetDlgItem(hWnd, ID_LIST_USERS), 0, tmp); + ListBox_SetHorizontalExtent(GetDlgItem(hWnd, ID_LIST_USERS), 2048); + free(tmp); + ++totalCount; + +NEXT: + rc = (*lpfnNAB_GetNextAddressBookEntry) + (nabConn, &userID, &ldifInfo, &updTime); + } + + + wsprintf(msg, "%d total entries found.", totalCount); + ShowMessage(hWnd, msg); +} + +void +DoNAB_FindAddressBookEntry(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_FindAddressBookEntry) + (NABConnectionID id, NABAddrBookDescType *addrBook, + NABUserID *userID, char *ldifSearchAttribute, + char **ldifEntry, NABUpdateTime *updTime); +#ifdef WIN16 + (FARPROC&) lpfnNAB_FindAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_FINDADDRESSBOOKENTRY"); +#else + (FARPROC&) lpfnNAB_FindAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_FindAddressBookEntry"); +#endif + + if (!lpfnNAB_FindAddressBookEntry) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char ldif[256] = ""; + char msg[256]; + NABAddrBookDescType abookDesc; + char abid[32] = ""; + + NABUserID userID; + char *ldifEntry; + NABUpdateTime updTime; + NABError rc; + + + GetDlgItemText(hWnd, ID_EDIT_FINDID, abid, sizeof(abid)); + if (abid[0] != '\0') + { + userID = atoi(abid); + } + else + { + GetDlgItemText(hWnd, ID_EDIT_FINDLDIF, ldif, sizeof(ldif)); + if (ldif[0] == '\0') + { + ShowMessage(hWnd, "Enter an LDIF search criteria!"); + return; + } + } + + ListBox_ResetContent(GetDlgItem(hWnd, ID_LIST_USERS)); + + // Get the selected address book... + if (!GetCurrentABook(hWnd, &abookDesc)) + { + rc = (*lpfnNAB_FindAddressBookEntry) + (nabConn, NULL, &userID, ldif, + &ldifEntry, &updTime); + } + else + { + rc = (*lpfnNAB_FindAddressBookEntry) + (nabConn, &abookDesc, &userID, ldif, + &ldifEntry, &updTime); + } + + if (rc == NAB_SUCCESS) + { + char *tmp; + + if (strlen(ldifEntry) <= 0) + { + ShowMessage(hWnd, "Memory allocation problem"); + return; + } + + tmp = (char *)malloc(strlen(ldifEntry) + 128); + if (!tmp) + { + ShowMessage(hWnd, "Memory allocation problem"); + return; + } + + wsprintf(tmp, "U=%d T=%d|%s", userID, updTime, ldifEntry); + ListBox_InsertString(GetDlgItem(hWnd, ID_LIST_USERS), 0, tmp); + ListBox_SetHorizontalExtent(GetDlgItem(hWnd, ID_LIST_USERS), 2048); + free(tmp); + SetFooter("NAB_FindAddressBookEntry succeeded!"); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from FindEntry\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("NAB_FindAddressBookEntry failed"); + } +} + +void +DoNAB_InsertAddressBookEntry(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_InsertAddressBookEntry) + (NABConnectionID id, NABAddrBookDescType *addrBook, + char *ldifEntry, NABUserID *userID); +#ifdef WIN16 + (FARPROC&) lpfnNAB_InsertAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_INSERTADDRESSBOOKENTRY"); +#else + (FARPROC&) lpfnNAB_InsertAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_InsertAddressBookEntry"); +#endif + + if (!lpfnNAB_InsertAddressBookEntry) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char ldif[256]; + char msg[256]; + NABAddrBookDescType abookDesc; + + GetDlgItemText(hWnd, ID_EDIT_FINDLDIF, ldif, sizeof(ldif)); + if (ldif[0] == '\0') + { + ShowMessage(hWnd, "Enter an LDIF insert line!"); + return; + } + + // Get the selected address book... + if (!GetCurrentABook(hWnd, &abookDesc)) + { + return; + } + + NABUserID id; + NABError rc = (*lpfnNAB_InsertAddressBookEntry) + (nabConn, &abookDesc, ldif, &id); + if (rc == NAB_SUCCESS) + { + ShowMessage(hWnd, "NAB_InsertAddressBookEntry succeeded"); + DoNAB_GetFirstAddressBookEntry(hWnd); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from NAB_InsertAddressBookEntry\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("NAB_InsertAddressBookEntry failed"); + } +} + +NABUserID +GetUserID(HWND hWnd) +{ + char userInfo[512]; + NABUserID userID; + + DWORD selected = ListBox_GetCurSel(GetDlgItem(hWnd, ID_LIST_USERS)); + if (selected == LB_ERR) + { + ShowMessage(hWnd, "Select an entry to update for this operation."); + return 0; + } + ListBox_GetText(GetDlgItem(hWnd, ID_LIST_USERS), selected, userInfo); + + char *begPtr, *endPtr; + begPtr = strchr(userInfo, '='); + endPtr = strchr(userInfo, ' '); + if (!endPtr) + { + ShowMessage(hWnd, "Unable to locate the User ID for operation."); + return 0; + } + + *endPtr = '\0'; + ++begPtr; + userID = atoi( begPtr ); + *endPtr = ' '; + return(userID); +} + +void +DoNAB_UpdateAddressBookEntry(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_UpdateAddressBookEntry) + (NABConnectionID id, NABAddrBookDescType *addrBook, + NABUserID userID, char *ldifEntry); + +#ifdef WIN16 + (FARPROC&) lpfnNAB_UpdateAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_UPDATEADDRESSBOOKENTRY"); +#else + (FARPROC&) lpfnNAB_UpdateAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_UpdateAddressBookEntry"); +#endif + + if (!lpfnNAB_UpdateAddressBookEntry) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char ldif[512]; + char msg[256]; + NABAddrBookDescType abookDesc; + + GetDlgItemText(hWnd, ID_EDIT_FINDLDIF, ldif, sizeof(ldif)); + if (ldif[0] == '\0') + { + ShowMessage(hWnd, "Enter an LDIF update line!"); + return; + } + + // Get the selected address book... + if (!GetCurrentABook(hWnd, &abookDesc)) + { + return; + } + + NABUserID userID = GetUserID(hWnd); + if (userID == 0) + return; + NABError rc = (*lpfnNAB_UpdateAddressBookEntry) + (nabConn, &abookDesc, userID, ldif); + if (rc == NAB_SUCCESS) + { + ShowMessage(hWnd, "NAB_InsertAddressBookEntry succeeded"); + DoNAB_GetFirstAddressBookEntry(hWnd); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from NAB_InsertAddressBookEntry\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("NAB_InsertAddressBookEntry failed"); + } +} + +void +DoNAB_DeleteAddressBookEntry(HWND hWnd) +{ + NABError (FAR PASCAL *lpfnNAB_DeleteAddressBookEntry) + (NABConnectionID id, NABAddrBookDescType *addrBook, + NABUserID userID); +#ifdef WIN16 + (FARPROC&) lpfnNAB_DeleteAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_DELETEADDRESSBOOKENTRY"); +#else + (FARPROC&) lpfnNAB_DeleteAddressBookEntry = GetProcAddress(m_hInstNAB, "NAB_DeleteAddressBookEntry"); +#endif + + if (!lpfnNAB_DeleteAddressBookEntry) + { + ShowMessage(hWnd, "Unable to locate NAB function."); + return; + } + + char msg[256]; + NABAddrBookDescType abookDesc; + + // Get the selected address book... + if (!GetCurrentABook(hWnd, &abookDesc)) + { + return; + } + + NABUserID userID = GetUserID(hWnd); + if (userID < 0) + { + ShowMessage(hWnd, "Unable to locate ABID"); + return; + } + + NABError rc = (*lpfnNAB_DeleteAddressBookEntry) + (nabConn, &abookDesc, userID); + if (rc == NAB_SUCCESS) + { + ShowMessage(hWnd, "NAB_DeleteAddressBookEntry succeeded"); + DoNAB_GetFirstAddressBookEntry(hWnd); + } + else + { + wsprintf(msg, "FAILURE: Return code %d from NAB_DeleteAddressBookEntry\nError=[%s]", + rc, GetNABError(rc)); + ShowMessage(hWnd, msg); + SetFooter("NAB_DeleteAddressBookEntry failed"); + } +} \ No newline at end of file diff --git a/mozilla/cmd/winfe/nabtest/nabtst32.mak b/mozilla/cmd/winfe/nabtest/nabtst32.mak new file mode 100644 index 00000000000..4727e3b1a18 --- /dev/null +++ b/mozilla/cmd/winfe/nabtest/nabtst32.mak @@ -0,0 +1,284 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 +/* -*- 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. + */ +!IF "$(CFG)" == "" +CFG=nabtst32 - Win32 Debug +!MESSAGE No configuration specified. Defaulting to nabtst32 - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "nabtst32 - Win32 Release" && "$(CFG)" !=\ + "nabtst32 - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "nabtst32.mak" CFG="nabtst32 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "nabtst32 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "nabtst32 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "nabtst32 - Win32 Debug" +CPP=cl.exe +MTL=mktyplib.exe +RSC=rc.exe + +!IF "$(CFG)" == "nabtst32 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "x86Rel" +# PROP Intermediate_Dir "x86Rel" +# PROP Target_Dir "" +OUTDIR=.\x86Rel +INTDIR=.\x86Rel + +ALL : "$(OUTDIR)\nabtst32.exe" + +CLEAN : + -@erase "$(INTDIR)\ldifdiag.obj" + -@erase "$(INTDIR)\main.obj" + -@erase "$(INTDIR)\nabproc.obj" + -@erase "$(INTDIR)\nabtst32.res" + -@erase "$(OUTDIR)\nabtst32.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /Gz /W3 /GX /O2 /I "\ns\cmd\winfe" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /Gz /ML /W3 /GX /O2 /I "\ns\cmd\winfe" /D "WIN32" /D "NDEBUG"\ + /D "_WINDOWS" /Fp"$(INTDIR)/nabtst32.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\x86Rel/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/nabtst32.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/nabtst32.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/nabtst32.pdb" /machine:I386 /out:"$(OUTDIR)/nabtst32.exe" +LINK32_OBJS= \ + "$(INTDIR)\ldifdiag.obj" \ + "$(INTDIR)\main.obj" \ + "$(INTDIR)\nabproc.obj" \ + "$(INTDIR)\nabtst32.res" + +"$(OUTDIR)\nabtst32.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "nabtst32 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "x86Dbg" +# PROP Intermediate_Dir "x86Dbg" +# PROP Target_Dir "" +OUTDIR=.\x86Dbg +INTDIR=.\x86Dbg + +ALL : "$(OUTDIR)\nabtst32.exe" + +CLEAN : + -@erase "$(INTDIR)\ldifdiag.obj" + -@erase "$(INTDIR)\main.obj" + -@erase "$(INTDIR)\nabproc.obj" + -@erase "$(INTDIR)\nabtst32.res" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\nabtst32.exe" + -@erase "$(OUTDIR)\nabtst32.ilk" + -@erase "$(OUTDIR)\nabtst32.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /Gz /W3 /Gm /GX /Zi /Od /I "\ns\cmd\winfe" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /Gz /MLd /W3 /Gm /GX /Zi /Od /I "\ns\cmd\winfe" /D "WIN32" /D\ + "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/nabtst32.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\x86Dbg/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/nabtst32.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/nabtst32.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib /nologo /subsystem:windows /incremental:yes\ + /pdb:"$(OUTDIR)/nabtst32.pdb" /debug /machine:I386\ + /out:"$(OUTDIR)/nabtst32.exe" +LINK32_OBJS= \ + "$(INTDIR)\ldifdiag.obj" \ + "$(INTDIR)\main.obj" \ + "$(INTDIR)\nabproc.obj" \ + "$(INTDIR)\nabtst32.res" + +"$(OUTDIR)\nabtst32.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "nabtst32 - Win32 Release" +# Name "nabtst32 - Win32 Debug" + +!IF "$(CFG)" == "nabtst32 - Win32 Release" + +!ELSEIF "$(CFG)" == "nabtst32 - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\main.cpp +DEP_CPP_MAIN_=\ + ".\port.h"\ + "\ns\cmd\winfe\nabapi.h"\ + + +"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\nabproc.cpp +DEP_CPP_NABPR=\ + ".\port.h"\ + "\ns\cmd\winfe\nabapi.h"\ + + +"$(INTDIR)\nabproc.obj" : $(SOURCE) $(DEP_CPP_NABPR) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\nabtst32.rc +DEP_RSC_NABTS=\ + ".\nscicon.ico"\ + + +"$(INTDIR)\nabtst32.res" : $(SOURCE) $(DEP_RSC_NABTS) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\ns\cmd\winfe\nabapi.h + +!IF "$(CFG)" == "nabtst32 - Win32 Release" + +!ELSEIF "$(CFG)" == "nabtst32 - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ldifdiag.cpp +DEP_CPP_LDIFD=\ + ".\port.h"\ + + +"$(INTDIR)\ldifdiag.obj" : $(SOURCE) $(DEP_CPP_LDIFD) "$(INTDIR)" + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/mozilla/cmd/winfe/nabtest/nabtst32.rc b/mozilla/cmd/winfe/nabtest/nabtst32.rc new file mode 100644 index 00000000000..5cdf456f132 --- /dev/null +++ b/mozilla/cmd/winfe/nabtest/nabtst32.rc @@ -0,0 +1,232 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" +/* -*- 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. + */ +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +ID_DIALOG DIALOG DISCARDABLE 0, 0, 318, 274 +STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Netscape Address Book API Test" +MENU ID_MENU +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Open/Close",IDC_STATIC,4,4,310,27 + PUSHBUTTON "NAB_Open",ID_BUTTON_OPEN,7,14,45,14 + PUSHBUTTON "NAB_Close",ID_BUTTON_CLOSE,61,14,45,14 + GROUPBOX "Address Book Operations",IDC_STATIC,4,36,310,69 + PUSHBUTTON "Get AB List",ID_BUTTON_GETADDRLIST,7,47,45,14 + LISTBOX ID_LIST_ABOOK,7,64,304,37,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | + WS_TABSTOP + LTEXT "",ID_STATIC_RESULT,4,259,310,13,SS_SUNKEN + PUSHBUTTON "Get Default AB",ID_BUTTON_GETDEF_ADDR,56,47,55,14 + PUSHBUTTON "Create Personal AB",ID_BUTTON_CREATEABOOK,240,47,71,14 + EDITTEXT ID_EDIT_ABOOKNAME,122,47,116,14,ES_AUTOHSCROLL + GROUPBOX "Individual Calls",IDC_STATIC,4,107,310,101 + LISTBOX ID_LIST_USERS,6,118,305,47,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | + WS_TABSTOP + PUSHBUTTON "List Users in AB",ID_BUTTON_LISTAB,8,190,60,14 + EDITTEXT ID_EDIT_FINDLDIF,61,171,216,14,ES_AUTOHSCROLL + PUSHBUTTON "Find AB Entry",ID_BUTTON_FINDAB,72,190,52,14 + PUSHBUTTON "Insert AB Entry",ID_BUTTON_INSERT,128,190,54,14 + PUSHBUTTON "Update AB Entry",ID_BUTTON_UPDATE,186,190,60,14 + PUSHBUTTON "Delete AB Entry",ID_BUTTON_DELETE,250,190,60,14 + GROUPBOX "Utility Functions",IDC_STATIC,4,211,310,46 + PUSHBUTTON "Save AB to HTML",ID_BUTTON_SAVETOHTML,14,239,85,14 + EDITTEXT ID_EDIT_FNAME,83,221,214,14,ES_AUTOHSCROLL + LTEXT "Filename:",IDC_STATIC,15,224,34,10 + PUSHBUTTON "Export AB to LDIF",ID_BUTTON_EXPORTLDIF,114,239,85,14 + PUSHBUTTON "Import LDIF File to AB",ID_BUTTON_IMPORTLDIF,214,239,85, + 14 + PUSHBUTTON "LDIF Param:",ID_BUTTON_LDIFDIAG,7,171,50,14 + EDITTEXT ID_EDIT_FINDID,292,171,19,14,ES_AUTOHSCROLL + LTEXT "ID:",IDC_STATIC,280,174,10,8 +END + +ID_DIALOG_LDIF DIALOG DISCARDABLE 0, 0, 300, 202 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "LDIF Attributes" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT EMAIL,53,7,94,13,ES_AUTOHSCROLL + EDITTEXT FIRSTNAME,53,24,94,13,ES_AUTOHSCROLL + EDITTEXT LASTNAME,53,42,94,13,ES_AUTOHSCROLL + EDITTEXT ADDR1,53,61,94,13,ES_AUTOHSCROLL + EDITTEXT ADDR2,53,79,94,13,ES_AUTOHSCROLL + EDITTEXT NOTES,53,97,94,13,ES_AUTOHSCROLL + EDITTEXT CITY,53,115,94,13,ES_AUTOHSCROLL + EDITTEXT STATE,53,133,94,13,ES_AUTOHSCROLL + EDITTEXT TITLE,53,151,94,13,ES_AUTOHSCROLL + EDITTEXT ZIPCODE,199,7,94,13,ES_AUTOHSCROLL + EDITTEXT COUNTRY,199,25,94,13,ES_AUTOHSCROLL + EDITTEXT BUSINESSPHONE,199,43,94,13,ES_AUTOHSCROLL + EDITTEXT FAXPHONE,199,61,94,13,ES_AUTOHSCROLL + EDITTEXT HOMEPHONE,199,79,94,13,ES_AUTOHSCROLL + EDITTEXT ORG,199,97,94,13,ES_AUTOHSCROLL + EDITTEXT NICKNAME,199,115,94,13,ES_AUTOHSCROLL + EDITTEXT USEHTML,199,133,94,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,62,181,50,14 + PUSHBUTTON "Cancel",IDCANCEL,126,181,50,14 + PUSHBUTTON "Set Defaults",IDDEFAULTS,190,181,50,14 + LTEXT "First Name:",IDC_STATIC,15,26,36,8 + LTEXT "Last Name:",IDC_STATIC,13,42,37,8 + LTEXT "General Info:",IDC_STATIC,9,98,42,8 + LTEXT "City:",IDC_STATIC,37,116,14,8 + LTEXT "State:",IDC_STATIC,31,134,20,8 + LTEXT "Email:",IDC_STATIC,31,9,20,8 + LTEXT "Title:",IDC_STATIC,35,152,16,8 + LTEXT "Zip code:",IDC_STATIC,164,9,31,8 + LTEXT "Country:",IDC_STATIC,168,27,27,8 + LTEXT "Work Phone:",IDC_STATIC,152,45,43,8 + LTEXT "FAX Phone:",IDC_STATIC,156,63,39,8 + LTEXT "Home Phone:",IDC_STATIC,150,81,44,8 + LTEXT "Organization:",IDC_STATIC,152,99,42,8 + LTEXT "Nickname:",IDC_STATIC,160,117,35,8 + LTEXT "Use HTML:",IDC_STATIC,156,135,38,8 + LTEXT "Addr Line #1:",IDC_STATIC,7,62,44,8 + LTEXT "Addr Line #2:",IDC_STATIC,7,80,44,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + ID_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 314 + VERTGUIDE, 7 + VERTGUIDE, 310 + VERTGUIDE, 311 + TOPMARGIN, 4 + BOTTOMMARGIN, 272 + END + + ID_DIALOG_LDIF, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 293 + VERTGUIDE, 147 + TOPMARGIN, 7 + BOTTOMMARGIN, 195 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +ID_ICON_APP ICON DISCARDABLE "nscicon.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +ID_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM SEPARATOR + MENUITEM "E&xit", ID_MENU_MYEXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Clear Results", ID_MENU_CLEARRESULTS + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", ID_MENU_MYABOUT + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/cmd/winfe/nabtest/nscicon.ico b/mozilla/cmd/winfe/nabtest/nscicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..ff147cebbd68d2cd0217165b14eab942e92944fb GIT binary patch literal 1718 zcma)+F-u%Q5P;|61rN128!N%YB4|C8t-Zm<+HS}{uu1VM>p(!*&LRn<2#D=#u1XQN z)+T~rAxI$F9av1hndhBG3}o+Sc4u~X=G)o#o=8t#$Z$B6Xlp%@H}v0R^>d1um~5J^Lo<}oXha_qo_}$V5yCHAp=7>okGd`gZ7YJzhZ8m5hSeUm zZLDjbY28$8IU2@vXR|tuNl%n$nQoep6yueZ-o>oRXr@Tht4J_KQ^b&hRK%H6q+5G2 zTiNSR>NH>-jru*`8fwH0HOUUmFzYn>Ig*pf%V02&g@pxKTwIi;r6pNjUY6C> zRaswOmz|v*+1lEY&CN~O*w~Qfz03Bt%SSmC|5fGt>2Eo`x{?oHzme$48NyVQaxUdu z%DI&D#xV`QF);jw-|)xL3;u$?U=;iXf0U!*ulOteilgFpY{&MRnH8-BR{|-Ulp1Dw zl)|7eC=3ciBEg_AC=3dN!jPCSC=3dN!k{oDIt&Vf!k{oH4C?scP&hO=c*dYg3PT$# z28+RxM~1~nZX_~-8Z21`CXIo?Vz6Xc;4nB04uiws$Wp;!Fc=I5LzK?oFc=Jm8qYgA zOGuvXhn?k(>Oe*A!m2DaxeH8%q=f_prb6z*WFbf)cOiFPN9M*){zCpj{Ae0jCOK@BP#H8?m}UN@U6EESdtL?vN905~#AgqVMVQ?56 z20|nFVQ?561_!{&UkT=HbQT#g4BO!Fj2&xCUdw0M-QAVFy*=6A-lfI zIXgR(^Ye4Lyu6g_>ub5ay_NBJEH`&9pAHXsj~l8R??80KODp1r=`t7XE?W+#R=CnL z8Qk|1v)h&W@i3=DvAgU3L+8qe<;gJDd*pZs_u$O96ZT1xzwjR&pqtP0OqZlJUJ<#N W + + +#ifndef CDECL +#define CDECL __cdecl +#endif // CDECL + +#ifndef PASCAL +#define PASCAL __pascal +#endif // PASCAL + +#ifdef FASTCALL +#error FASTCALL defined +#endif // FASTCALL + + +#ifdef NDEBUG +#define FASTCALL __fastcall +#else +#define FASTCALL PASCAL +#endif // NDEBUG + + + +#ifndef HWND2DWORD +# ifdef WIN32 +# define HWND2DWORD(X_hWnd) ( (DWORD)(X_hWnd) ) +# else // WIN16 +# define HWND2DWORD(X_hWnd) ( (DWORD)MAKELONG(((WORD)(X_hWnd)), 0) ) +# endif +#endif // HWND2DWORD + + +/* + * WIN16 - WIN32 compatibility stuff + */ + +#ifdef WIN32 + +# define DLLEXPORT __declspec( dllexport ) +# define EXPORT +# define LOADDS +# define HUGE +# ifndef FAR +# define FAR +# endif // FAR +# ifndef NEAR +# define NEAR +# endif // NEAR +# ifdef UNICODE +# define SIZEOF(x) (sizeof(x)/sizeof(WCHAR)) +# else +# define SIZEOF(x) sizeof(x) +# endif + +#else // !WIN32 == WIN16 + +# define DLLEXPORT +# define EXPORT __export +# define LOADDS __loadds +# define HUGE __huge +# ifndef FAR +# define FAR __far +# define NEAR __near +# endif // FAR +# define CONST const +# define SIZEOF(x) sizeof(x) +# define CHAR char +# define TCHAR char +# define WCHAR char +# ifndef LPTSTR +# define LPTSTR LPSTR +# endif +# ifndef LPCTSTR +# define LPCTSTR LPCSTR +# endif +# define UNREFERENCED_PARAMETER(x) x; +# ifndef TEXT +# define TEXT(x) x +# endif +# define GetWindowTextW GetWindowText +# define lstrcpyW lstrcpy + +# define BN_DBLCLK BN_DOUBLECLICKED // ~~MRJ needed for custom control. +// ~~MRJ begin Win95 backward compat section +# define LPWSTR LPSTR +# define LPCWSTR LPCSTR + +// button check state for WIN16 +#ifndef BST_UNCHECKED +#define BST_UNCHECKED 0x0000 +#endif + +#ifndef BST_CHECKED +#define BST_CHECKED 0x0001 +#endif + + +#ifndef WIN95_COMPAT +# define WIN95_COMPAT +#endif + +// ~~MRJ end Win95 compat section. + +// critical section API stubs +typedef DWORD CRITICAL_SECTION; +typedef CRITICAL_SECTION FAR * LPCRITICAL_SECTION; +#ifdef __cplusplus +inline void InitializeCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void DeleteCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void EnterCriticalSection(LPCRITICAL_SECTION lpSection) {} +inline void LeaveCriticalSection(LPCRITICAL_SECTION lpSection) {} +#endif // __cplusplus + +// Added for nssock16 ---Neeti +#ifndef ZeroMemory +#include +#define ZeroMemory(PTR, SIZE) memset(PTR, 0, SIZE) +#endif // ZeroMemory + +#endif // WIN16 + +/* + * unix - windows compatibility stuff + */ +typedef DWORD u_int32; +typedef WORD u_int16; +typedef BYTE u_int8; +#ifdef WIN32 +typedef short int Bool16; +#else // WIN16 +typedef BOOL Bool16; +#endif // WIN16 + +/* + * Cross Platform Compatibility + */ +#ifndef UNALIGNED +# ifdef _M_ALPHA +# define UNALIGNED __unaligned +# else // !_M_ALPHA +# define UNALIGNED +# endif // !_M_ALPHA +#endif // UNALIGNED + +// +// RICHIE - for the Alpha port +// +#ifdef _M_ALPHA +# undef pascal +# undef PASCAL +# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) +# define pascal __stdcall +# define PASCAL __stdcall +# else +# define PASCAL +# endif +#endif + + +/* + * Useful Types + */ +typedef char HUGE *HPSTR; +typedef const char HUGE *HPCSTR; +typedef unsigned char HUGE *HPBYTE; +typedef WORD HUGE *HPWORD; +typedef UINT FAR *LPUINT; +typedef BOOL (CALLBACK *USERABORTPROC)(); +typedef BOOL (CALLBACK *PROGRESSPROC)(UINT uPos, UINT uRange); +typedef int INT; // ~~MRJ a function needed this defined. +typedef MINMAXINFO FAR *LPMINMAXINFO; // ~~MRJ + +// +// stuff missing from windows.h +// +#ifndef MAKEWORD +#define MAKEWORD(low, high) ((WORD)(((BYTE)(low)) | (((WORD)((BYTE)(high))) << 8))) +#endif // MAKEWORD + +#ifdef WIN32 +# ifndef hmemcpy +# define hmemcpy memcpy +# endif // !defined(hmemcpy) +# define _fmemset memset + +# include + +#ifdef __cplusplus + +inline BOOL IsGDIObject(HGDIOBJ hObj) { return (hObj != 0); } +inline void *_halloc(long num, unsigned int size) { return malloc(num * size); } +inline void _hfree( void *memblock ) { free(memblock); } +/* +inline BOOL IsInstance(HINSTANCE hInst) { +# ifdef WIN32 + return (hInst != 0); +# else // WIN16 + return (hInst > HINSTANCE_ERROR); +# endif +} +*/ + +#endif // __cplusplus + + WINUSERAPI HANDLE WINAPI LoadImageA(HINSTANCE, LPCSTR, UINT, int, int, UINT); + +#endif // WIN32 + +#ifdef __cplusplus +inline BOOL IsInstance(HINSTANCE hInst) { +# ifdef WIN32 + return (hInst != 0); +# else // WIN16 + return (hInst > HINSTANCE_ERROR); +# endif +} +inline void SetWindowSmallIcon(HINSTANCE hInst, HWND hWnd, UINT uIconResourceId) { +#ifdef WIN32 +# ifndef WM_SETICON +# define WM_SETICON 0x0080 +# endif // WM_SETICON +# ifndef IMAGE_ICON +# define IMAGE_ICON 1 +# endif + assert(IsWindow(hWnd)); + HICON hIcon = (HICON)LoadImageA(hInst, MAKEINTRESOURCE(uIconResourceId), IMAGE_ICON, + 16, 16, 0); + if(NULL != hIcon) { + SendMessage(hWnd, WM_SETICON, FALSE, (LPARAM)hIcon); + } else { + HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(uIconResourceId)); + assert(hIcon != 0); + SendMessage(hWnd, WM_SETICON, FALSE, (LPARAM)hIcon); + } +#endif // WIN32 +} +#endif // __cplusplus + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* PORT_H */ diff --git a/mozilla/cmd/winfe/nabtest/resource.h b/mozilla/cmd/winfe/nabtest/resource.h new file mode 100644 index 00000000000..277c4a6e47b --- /dev/null +++ b/mozilla/cmd/winfe/nabtest/resource.h @@ -0,0 +1,107 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by nabtst32.rc +// +/* -*- 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. + */ +#define ID_GUI_MESSAGE1 1 +#define ID_BUTTON_MAPIADDRESS 3 +#define IDDEFAULTS 3 +#define ID_DIALOG 101 +#define ID_ICON_APP 102 +#define ID_MENU 104 +#define ID_DIALOG_MAIL 105 +#define ID_DIALOG_READMAIL 106 +#define ID_DIALOG_LDIF 107 +#define ID_SETFROMEDIT 1000 +#define ID_SETTEXT 1001 +#define ID_GETROWS 1001 +#define ID_EDIT 1002 +#define ID_EDIT_HWND 1002 +#define ID_RESOURCETEXT 1003 +#define ID_GETTEXT 1003 +#define ID_STATIC_RESULT 1004 +#define ID_GETVISROWS 1005 +#define ID_GETWINID 1006 +#define ID_SETROWFOCUS 1007 +#define ID_GETROWFOCUS 1008 +#define ID_EDIT_ROW 1009 +#define ID_LIST_RESULT 1010 +#define ID_LIST_ABOOK 1010 +#define ID_GETCOLCOUNT 1011 +#define ID_BUTTON_OPEN 1011 +#define ID_SETROWINVIEW 1012 +#define ID_BUTTON_CLOSE 1012 +#define ID_GETNUMCHILDREN 1013 +#define ID_EDIT_USERNAME 1013 +#define ID_LIST_USERS 1013 +#define ID_CLEARRESULTS 1014 +#define ID_EDIT_PW 1014 +#define ID_BUTTON_CLEAR 1016 +#define ID_BUTTON_GETDEF_ADDR 1017 +#define ID_BUTTON_CREATEABOOK 1018 +#define ID_BUTTON_GETADDRLIST 1019 +#define ID_BUTTON_SAVETOHTML 1020 +#define ID_BUTTON_EXPORTLDIF 1021 +#define ID_BUTTON_IMPORTLDIF 1022 +#define ID_BUTTON_LISTAB 1023 +#define ID_BUTTON_FINDAB 1024 +#define ID_BUTTON_INSERT 1025 +#define ID_BUTTON_UPDATE 1026 +#define ID_BUTTON_DELETE 1027 +#define ID_BUTTON_LDIFDIAG 1028 +#define ID_OK 1034 +#define IDC_EDIT_THREAD 1035 +#define ID_CHECK_SHOWDIALOG 1035 +#define IDC_EDIT_FROM 1036 +#define ID_EDIT_ABOOKNAME 1036 +#define ID_EDIT_FNAME 1037 +#define ID_EDIT_FINDLDIF 1039 +#define ID_EDIT_FINDID 1040 +#define FIRSTNAME 1041 +#define LASTNAME 1042 +#define NOTES 1043 +#define CITY 1044 +#define STATE 1045 +#define EMAIL 1046 +#define TITLE 1047 +#define ADDR1 1048 +#define ADDR2 1049 +#define ZIPCODE 1050 +#define COUNTRY 1051 +#define BUSINESSPHONE 1052 +#define FAXPHONE 1053 +#define HOMEPHONE 1054 +#define ORG 1055 +#define NICKNAME 1056 +#define USEHTML 1057 +#define ID_MENU_MYEXIT 40001 +#define ID_MENU_CLEAR 40002 +#define ID_MENU_MYABOUT 40003 +#define ID_MENU_CLEARRESULTS 40004 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 108 +#define _APS_NEXT_COMMAND_VALUE 40008 +#define _APS_NEXT_CONTROL_VALUE 1042 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mozilla/cmd/winfe/namcomp.cpp b/mozilla/cmd/winfe/namcomp.cpp index fd658f7c3fe..057335c9cf0 100644 --- a/mozilla/cmd/winfe/namcomp.cpp +++ b/mozilla/cmd/winfe/namcomp.cpp @@ -15,7 +15,8 @@ * Copyright (C) 1998 Netscape Communications Corporation. All Rights * Reserved. */ -// addrdlg.cpp : implementation file + +// namcomp : implementation file // #include "stdafx.h" @@ -27,6 +28,8 @@ #include "nethelp.h" #include "prefapi.h" #include "intl_csi.h" +#include "abcom.h" +#include "addrfrm.h" #ifdef _DEBUG #undef THIS_FILE @@ -37,6 +40,13 @@ extern "C" { #include "xpgetstr.h" }; +#define BUTTON_SPACING 5 +#define PICKER_RIGHT_MARGIN 20 +#define PICKER_LEFT_MARGIN 20 +#define PICKER_TOP_MARGIN 20 +#define PICKER_BOTTOM_MARGIN 20 +#define LIST_BUTTON_MARGIN 10 +#define BUTTON_STATUS_MARGIN 10 class CNameCompletion; @@ -187,24 +197,36 @@ CNameCompletion::CNameCompletion(LPCTSTR lpszSearchString, m_pCX->GetContext()->reSize = FALSE; INTL_SetCSIWinCSID(csi, CIntlWin::GetSystemLocaleCsid()); - m_addrBookPane = NULL; + m_pPickerPane = NULL; m_pOutliner = NULL; m_pOutlinerParent = NULL; m_bSearching = FALSE; m_lpszSearchString = lpszSearchString; - + m_bInitDialog = FALSE; + m_pCookie = NULL; + m_bFreeCookie = TRUE; CNameCompletionEntryList *pInstance = new CNameCompletionEntryList( this ); pInstance->QueryInterface( IID_IMsgList, (LPVOID *) &m_pIAddrList ); - HandleErrorReturn((result = AB_CreateAddressBookPane(&m_addrBookPane, - m_pCX->GetContext(), - WFE_MSGGetMaster()))); + HandleErrorReturn((result = AB_CreateABPickerPane(&m_pPickerPane, + m_pCX->GetContext(), WFE_MSGGetMaster(), 20))); +#ifdef MOZ_NEWADDR + HandleErrorReturn(AB_SetShowPropertySheetForEntryFunc(m_pPickerPane, ShowPropertySheetForEntry)); +#endif //{{AFX_DATA_INIT(CNameCompletion) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } +CNameCompletion::~CNameCompletion() +{ + if(m_pCookie && m_bFreeCookie) + { + AB_FreeNameCompletionCookie(m_pCookie); + } + +} void CNameCompletion::CleanupOnClose() { @@ -212,14 +234,19 @@ void CNameCompletion::CleanupOnClose() // to call MSG_SearchFree, the MWContext will be gone, and we'll be reading freed memory if (XP_IsContextBusy (m_pCX->GetContext())) XP_InterruptContext (m_pCX->GetContext()); - MSG_SearchFree ((MSG_Pane*) m_addrBookPane); + MSG_SearchFree ((MSG_Pane*) m_pPickerPane); + + + if (m_pPickerPane) + HandleErrorReturn(AB_ClosePane(m_pPickerPane)); + + if (m_pOutlinerParent){ + delete m_pOutlinerParent; + } if (m_pIAddrList) m_pIAddrList->Release(); - if (m_addrBookPane) - HandleErrorReturn(AB_CloseAddressBookPane(&m_addrBookPane)); - if(!m_pCX->IsDestroyed()) { m_pCX->DestroyContext(); } @@ -228,35 +255,33 @@ void CNameCompletion::CleanupOnClose() theApp.ReleaseAppFont(m_pFont); } - if (m_pOutlinerParent){ - delete m_pOutlinerParent; - } } ///////////////////////////////////////////////////////////////////////////// // CNameCompletion Overloaded methods ///////////////////////////////////////////////////////////////////////////// + +BOOL CNameCompletion::OnCommand( WPARAM wParam, LPARAM lParam ) +{ + UINT nID = wParam; + + if ( nID >= FIRST_ADDSENDER_MENU_ID && nID <= LAST_ADDSENDER_MENU_ID ) { + OnAddToAddressBook( nID ); + return TRUE; + } + + return CDialog::OnCommand( wParam, lParam ); +} + BOOL CNameCompletion::OnInitDialog( ) { if (CDialog::OnInitDialog()) { CWnd* widget; CRect rect2, rect3, rect4; - UINT aIDArray[] = { IDS_SECURITY_STATUS, IDS_TRANSFER_STATUS, ID_SEPARATOR}; + UINT aIDArray[] = { IDS_TRANSFER_STATUS, ID_SEPARATOR, IDS_ONLINE_STATUS}; int result = 0; - DIR_Server* dir = (DIR_Server*)XP_ListGetObjectNum(theApp.m_directories, 1); - - XP_ASSERT (dir); - - if (!dir) - return FALSE; - - HandleErrorReturn((result = AB_InitializeAddressBookPane(m_addrBookPane, - dir, - theApp.m_pABook, - ABFullName, - TRUE))); if (result) { EndDialog(IDCANCEL); @@ -287,11 +312,14 @@ BOOL CNameCompletion::OnInitDialog( ) rect3, this, IDC_ADDRESSLIST); #endif + m_pOutliner = (CNameCompletionOutliner *) m_pOutlinerParent->m_pOutliner; + m_pOutliner->SetPane(m_pPickerPane); + m_pOutliner->SetContext( m_pCX->GetContext() ); + m_pOutliner->SetMultipleSelection(FALSE); + m_pOutlinerParent->MoveWindow(&rect2, TRUE); m_pOutlinerParent->CreateColumns ( ); - m_pOutliner = (CNameCompletionOutliner *) m_pOutlinerParent->m_pOutliner; - m_pOutliner->SetPane(m_addrBookPane); - m_pOutliner->SetContext( m_pCX->GetContext() ); + m_pOutlinerParent->EnableFocusFrame(); // create the status bar widget = GetDlgItem(IDC_StatusRect); @@ -302,16 +330,66 @@ BOOL CNameCompletion::OnInitDialog( ) widget->DestroyWindow (); // create the status bar - m_barStatus.Create(this, TRUE, FALSE); + m_barStatus.Create(this, FALSE, FALSE); m_barStatus.MoveWindow(&rect2, TRUE); m_barStatus.SetIndicators( aIDArray, sizeof(aIDArray) / sizeof(UINT) ); - UpdateButtons(); - } + //set initial online status + int idx = m_barStatus.CommandToIndex(IDS_ONLINE_STATUS); + if (idx > -1) + { + UINT nID = IDS_ONLINE_STATUS; + UINT nStyle; + int nWidth; + m_barStatus.GetPaneInfo( idx, nID, nStyle, nWidth ); + if (!NET_IsOffline()) + m_barStatus.SetPaneInfo(idx, IDS_ONLINE_STATUS, SBPS_NORMAL, nWidth); + else + m_barStatus.SetPaneInfo(idx, IDS_ONLINE_STATUS, SBPS_DISABLED, nWidth); + } + UpdateButtons(); + + // add the correct title. + CString itemsMatching; + itemsMatching.LoadString(IDS_ITEMSMATCHING); + + CString title; + title.Format("%s \" %s \"", itemsMatching, m_lpszSearchString); + SetWindowText(title); + + } + m_bInitDialog = TRUE; + + //resize so everything gets laid out correct after m_bInitDialog set + CRect windowRect; + GetWindowRect(windowRect); + SetWindowPos(NULL, 0, 0, windowRect.Width() + 1, windowRect.Height() + 1, SWP_NOMOVE); + + //get rid of current cookie + if(m_pCookie && m_bFreeCookie) + { + AB_FreeNameCompletionCookie(m_pCookie); + } + m_pCookie = NULL; + m_bFreeCookie = TRUE; + + //start the name completion search +#ifdef FE_IMPLEMENTS_VISIBLE_NC + int result = AB_NameCompletionSearch(m_pPickerPane, m_lpszSearchString, NULL, TRUE, NULL); +#else + int result = AB_NameCompletionSearch(m_pPickerPane, m_lpszSearchString, NULL, NULL); +#endif return TRUE; } +int CNameCompletion::DoModal () +{ + if (!m_MailNewsResourceSwitcher.Initialize()) + return -1; + return CDialog::DoModal(); +} + void CNameCompletion::Progress(const char *pMessage) { @@ -334,7 +412,11 @@ BEGIN_MESSAGE_MAP(CNameCompletion, CDialog) ON_BN_CLICKED( IDCANCEL, OnCancel) ON_WM_CREATE() ON_WM_DESTROY() + ON_WM_SIZE() ON_COMMAND(ID_HELP, OnHelp) + ON_UPDATE_COMMAND_UI(ID_ITEM_PROPERTIES, OnUpdateProperties) + ON_COMMAND(ID_ITEM_PROPERTIES, OnProperties) + ON_UPDATE_COMMAND_UI(IDS_ONLINE_STATUS, OnUpdateOnlineStatus) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -353,14 +435,86 @@ int CNameCompletion::OnCreate(LPCREATESTRUCT lpCreateStruct) m_MailNewsResourceSwitcher.Reset(); - MSG_SetFEData( (MSG_Pane*) m_addrBookPane, (void *) m_pIAddrList ); + if(m_pPickerPane) + { + MSG_SetFEData( (MSG_Pane*) m_pPickerPane, (void *) m_pIAddrList ); + } return res; } +void CNameCompletion::OnSize( UINT nType, int cx, int cy ) +{ + CDialog::OnSize(nType, cx, cy); + + //if init dialog has been called then we can resize widgets inside. + if(m_bInitDialog) + { + CWnd *ok; + CWnd *cancel; + CWnd *statusSeparator; + int y = cy; + int x; + + CRect statusRect; + CRect okRect; + CRect cancelRect; + CRect statusSeparatorRect; + + m_barStatus.GetWindowRect(statusRect); + m_barStatus.MoveWindow(0, y - statusRect.Height(), + cx, statusRect.Height()); + + y -= statusRect.Height() ; + + statusSeparator = GetDlgItem(IDC_STATUSSEPARATOR); + statusSeparator->GetWindowRect(statusSeparatorRect); + statusSeparator->MoveWindow(0, y - statusSeparatorRect.Height(), cx, + statusSeparatorRect.Height()); + + y -= BUTTON_STATUS_MARGIN + statusSeparatorRect.Height(); + + cancel = GetDlgItem(IDCANCEL); + cancel->GetWindowRect(cancelRect); + ok = GetDlgItem(IDOK); + ok->GetWindowRect(okRect); + + x = (cx - okRect.Width() - cancelRect.Width() - BUTTON_SPACING) /2; + + ok->MoveWindow(x, y - okRect.Height(), + okRect.Width(), okRect.Height()); + + x+= BUTTON_SPACING + okRect.Width(); + cancel->MoveWindow(x, y - cancelRect.Height(), + cancelRect.Width(), cancelRect.Height()); + + + y-= okRect.Height() + LIST_BUTTON_MARGIN; + + m_pOutlinerParent->MoveWindow(PICKER_LEFT_MARGIN, PICKER_TOP_MARGIN, + cx - PICKER_LEFT_MARGIN - PICKER_RIGHT_MARGIN, + y - PICKER_TOP_MARGIN); + } + +} + + void CNameCompletion::OnOK() { CDialog::OnOK(); + MSG_ViewIndex *pIndex; + int nCount; + + m_pOutliner->GetSelection( pIndex, nCount ); + + if(m_pCookie && m_bFreeCookie) + { + AB_FreeNameCompletionCookie(m_pCookie); + } + + m_pCookie = AB_GetNameCompletionCookieForIndex(m_pPickerPane, pIndex[0]); + m_bFreeCookie = FALSE; + CleanupOnClose(); } @@ -368,15 +522,31 @@ void CNameCompletion::OnOK() void CNameCompletion::OnCancel() { CDialog::OnCancel(); + CleanupOnClose(); } +void CNameCompletion::OnUpdateProperties(CCmdUI *pCmdUI) +{ + DoUpdateCommand(pCmdUI, AB_PropertiesCmd); + +} + +void CNameCompletion::OnProperties() +{ + DoCommand(AB_PropertiesCmd); +} + +void CNameCompletion::OnUpdateOnlineStatus(CCmdUI *pCmdUI) +{ + pCmdUI->Enable(!NET_IsOffline()); +} void CNameCompletion::ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, MSG_NOTIFY_CODE notify, MSG_ViewIndex where, int32 num) { - if ( pane == (MSG_Pane*) m_addrBookPane ) { + if ( pane == (MSG_Pane*) m_pPickerPane ) { if ( m_pOutliner ) { m_pOutliner->MysticStuffStarting( asynchronous, notify, where, num ); @@ -388,7 +558,7 @@ void CNameCompletion::ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, MSG_NOTIFY_CODE notify, MSG_ViewIndex where, int32 num) { - if ( pane == (MSG_Pane*) m_addrBookPane ) { + if ( pane == (MSG_Pane*) m_pPickerPane ) { if ( m_pOutliner ) { m_pOutliner->MysticStuffFinishing( asynchronous, notify, where, num ); @@ -409,6 +579,9 @@ void CNameCompletion::SetSearchResults(MSG_ViewIndex index, int32 num) CString csStatus; + AB_LDAPSearchResultsAB2(m_pPickerPane, index, num); + +/* ASSERT(m_pOutliner); AB_LDAPSearchResults(m_addrBookPane, index, num); if (num > 1 ) { @@ -420,7 +593,7 @@ void CNameCompletion::SetSearchResults(MSG_ViewIndex index, int32 num) } m_barStatus.SetWindowText( csStatus ); - +*/ } STDMETHODIMP CNameCompletion::QueryInterface(REFIID refiid, LPVOID * ppv) @@ -457,15 +630,28 @@ CMailNewsFrame *CNameCompletion::GetMailNewsFrame() MSG_Pane *CNameCompletion::GetPane() { - return (MSG_Pane*) m_addrBookPane; + return (MSG_Pane*) m_pPickerPane; } void CNameCompletion::PaneChanged(MSG_Pane *pane, XP_Bool asynchronous, MSG_PANE_CHANGED_NOTIFY_CODE notify, int32 value) { - if (notify == MSG_PaneDirectoriesChanged) { - if (IsSearching()) - PerformDirectorySearch (); + if (notify == MSG_PaneNotifyStartSearching) + { + m_bSearching = TRUE; + m_barStatus.StartAnimation(); + } + else if(notify == MSG_PaneNotifyStopSearching ) + { + m_bSearching = FALSE; + m_barStatus.StopAnimation(); + if(::IsWindow(m_pOutlinerParent->m_hWnd)) + { + //make sure outliner has the focus. + m_pOutlinerParent->SetFocus(); + } + + } } @@ -485,6 +671,8 @@ void CNameCompletion::AllConnectionsComplete( MWContext *pContext ) } m_barStatus.SetWindowText( csStatus ); + HandleErrorReturn(AB_FinishSearchAB2(m_pPickerPane)); + SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, (LPARAM)0); } @@ -512,7 +700,7 @@ void CNameCompletion::PerformDirectorySearch () if ( m_bSearching) { // We've turned into stop button XP_InterruptContext( m_pCX->GetContext() ); - HandleErrorReturn(AB_FinishSearch(m_addrBookPane, m_pCX->GetContext())); + // HandleErrorReturn(AB_FinishSearch(m_addrBookPane, m_pCX->GetContext())); m_bSearching = FALSE; return; } @@ -523,10 +711,90 @@ void CNameCompletion::PerformDirectorySearch () m_pOutliner->UpdateCount(); m_pOutliner->SetFocus(); - HandleErrorReturn(AB_SearchDirectory(m_addrBookPane, NULL)); +// HandleErrorReturn(AB_SearchDirectory(m_addrBookPane, NULL)); } +void CNameCompletion::OnAddToAddressBook(UINT nID) +{ + int nPos = nID - FIRST_ADDSENDER_MENU_ID; + + XP_List *addressBooks = AB_AcquireAddressBookContainers(m_pCX->GetContext()); + + if(addressBooks) + { + AB_ContainerInfo *pInfo = (AB_ContainerInfo*)XP_ListGetObjectNum(addressBooks, nPos); + + MSG_ViewIndex *indices = NULL; + int count = 0; + if (m_pOutliner) + m_pOutliner->GetSelection(indices, count); + + + HandleErrorReturn(AB_DragEntriesIntoContainer(m_pPickerPane, + indices, count, pInfo, AB_Require_Copy)); + + AB_ReleaseContainersList(addressBooks); + + } +} + + +void CNameCompletion::DoUpdateCommand(CCmdUI *pCmdUI, AB_CommandType cmd,BOOL bUseCheck) +{ + + XP_Bool bSelectable; + const char *displayString; + XP_Bool bPlural; + MSG_COMMAND_CHECK_STATE selected; + + MSG_ViewIndex *indices = NULL; + int count = 0; + if (m_pOutliner) + m_pOutliner->GetSelection(indices, count); + + HandleErrorReturn(AB_CommandStatusAB2(m_pPickerPane, + cmd, indices, count, &bSelectable, &selected, &displayString, &bPlural)); + + pCmdUI->Enable(bSelectable); + if(bUseCheck) + pCmdUI->SetCheck(selected == MSG_Checked); + else + pCmdUI->SetRadio(selected == MSG_Checked); + + + +} + +void CNameCompletion::DoCommand(AB_CommandType cmd) +{ + MSG_ViewIndex *indices = NULL; + int count = 0; + if (m_pOutliner) + m_pOutliner->GetSelection(indices, count); + + HandleErrorReturn(AB_CommandAB2(m_pPickerPane, cmd, indices, count)); + +} + + + +CNameCompletionLineData::CNameCompletionLineData(AB_AttributeValue *pValues, + int numColumns, int line) +{ + m_pValues = pValues; + m_nNumColumns = numColumns; + m_nLine = line; +} + +CNameCompletionLineData::~CNameCompletionLineData() +{ + if(m_pValues) + { + AB_FreeEntryAttributeValues (m_pValues, m_nNumColumns); + + } +} ////////////////////////////////////////////////////////////////////////////// // CNameCompletionOutliner @@ -542,10 +810,13 @@ CNameCompletionOutliner::CNameCompletionOutliner ( ) if (m_pUnkUserImage) { m_pUnkUserImage->QueryInterface(IID_IImageMap,(LPVOID*)&m_pIUserImage); ASSERT(m_pIUserImage); - m_pIUserImage->Initialize(IDB_ADDRESSBOOK,16,16); + m_pIUserImage->Initialize(IDB_DIRLIST,16,16); } m_iMysticPlane = 0; m_hFont = NULL; + m_pLineData = NULL; + m_pEntryAttrib = NULL; + m_nNumColumns = 0; } CNameCompletionOutliner::~CNameCompletionOutliner ( ) @@ -558,88 +829,22 @@ CNameCompletionOutliner::~CNameCompletionOutliner ( ) if (m_hFont) { theApp.ReleaseAppFont(m_hFont); } -} - -void CNameCompletionOutliner::SetColumnsForDirectory (DIR_Server* pServer) -{ - int iCount = GetNumColumns(); - for (int i = 0; i < iCount; i++) { - CString cs; - int iColumn = GetColumnAtPos(i); - if (pServer->dirType == LDAPDirectory) - { - DIR_AttributeId id; - const char *text = NULL; - switch (iColumn) { - case ID_COLADDR_TYPE: - text = NULL; - break; - case ID_COLADDR_NAME: - MSG_SearchAttribToDirAttrib(attribCommonName, &id); - text = DIR_GetAttributeName(pServer, id); - break; - case ID_COLADDR_EMAIL: - MSG_SearchAttribToDirAttrib(attrib822Address, &id); - text = DIR_GetAttributeName(pServer, id); - break; - case ID_COLADDR_COMPANY: - MSG_SearchAttribToDirAttrib(attribOrganization, &id); - text = DIR_GetAttributeName(pServer, id); - break; - case ID_COLADDR_PHONE: - MSG_SearchAttribToDirAttrib(attribPhoneNumber, &id); - text = DIR_GetAttributeName(pServer, id); - break; - case ID_COLADDR_LOCALITY: - MSG_SearchAttribToDirAttrib(attribLocality, &id); - text = DIR_GetAttributeName(pServer, id); - break; - case ID_COLADDR_NICKNAME: - text = NULL; - break; - default: - break; - } - if (text) - SetColumnName(iColumn, text); - } - else - { - switch (iColumn) { - case ID_COLADDR_TYPE: - cs = ""; - break; - case ID_COLADDR_NAME: - cs.LoadString(IDS_USERNAME); - break; - case ID_COLADDR_EMAIL: - cs.LoadString(IDS_EMAILADDRESS); - break; - case ID_COLADDR_COMPANY: - cs.LoadString(IDS_COMPANYNAME); - break; - case ID_COLADDR_PHONE: - cs.LoadString(IDS_PHONE); - break; - case ID_COLADDR_LOCALITY: - cs.LoadString(IDS_LOCALITY); - break; - case ID_COLADDR_NICKNAME: - cs.LoadString(IDS_NICKNAME); - break; - default: - break; - } - if (cs.GetLength()) - SetColumnName(iColumn, cs); - } + if(m_pEntryAttrib) + { + delete m_pEntryAttrib; } - GetParent()->Invalidate(); - GetParent()->UpdateWindow(); + + if (m_pLineData) + { + delete m_pLineData; + m_pLineData = NULL; + } + } + void CNameCompletionOutliner::UpdateCount( ) { uint32 count = 0; @@ -648,12 +853,27 @@ void CNameCompletionOutliner::UpdateCount( ) } -void CNameCompletionOutliner::SetPane(ABPane *pane) +void CNameCompletionOutliner::SetPane(MSG_Pane *pane) { m_pane = pane; uint32 count = 0; if (m_pane) { + + //Get attributes for this pane + m_nNumColumns = AB_GetNumColumnsForPane(pane); + + if(m_pEntryAttrib) + { + delete m_pEntryAttrib; + } + + m_pEntryAttrib = new AB_AttribID[m_nNumColumns]; + + int numAttribs = (int) m_nNumColumns; + + AB_GetColumnAttribIDsForPane(pane,m_pEntryAttrib, &numAttribs); + SetTotalLines(CASTINT(count)); Invalidate(); UpdateWindow(); @@ -692,9 +912,28 @@ void CNameCompletionOutliner::MysticStuffFinishing( XP_Bool asynchronous, // if its insert or delete then tell my frame to add the next chunk of values // from the search if (notify == MSG_NotifyInsertOrDelete - && ((CNameCompletion*)pParent)->IsSearching() && num > 0) + && num > 0) { - ((CNameCompletion*)pParent)->SetSearchResults(where, num); + if(((CNameCompletion*)pParent)->IsSearching()) + { + ((CNameCompletion*)pParent)->SetSearchResults(where, num); + } + + if(num > 0) + { + HandleInsert(where, num); + //this is the first place I can figure out where to set the focus and have it + //stick. So, if it's item 0 then we know to select the first item and then + //set focus to us. + if(where == 0 || where == 1) + { + SetFocus(); + if(GetTotalLines() == 1) + SelectItem(0); + else + SelectItem(1); + } + } } else { @@ -713,8 +952,6 @@ void CNameCompletionOutliner::MysticStuffFinishing( XP_Bool asynchronous, if (( !--m_iMysticPlane && m_pane)) { - uint32 count; - SetTotalLines(CASTINT(count)); Invalidate(); UpdateWindow(); } @@ -731,15 +968,18 @@ void CNameCompletionOutliner::SetTotalLines( int count) BOOL CNameCompletionOutliner::RenderData ( UINT iColumn, CRect &rect, CDC &dc, const char * text ) { - if ( iColumn != ID_COLADDR_TYPE ) - return COutliner::RenderData ( iColumn, rect, dc, text ); + if ( (iColumn) != AB_ColumnID0 ) + return CMSelectOutliner::RenderData ( iColumn, rect, dc, text ); + int idxImage; - int idxImage = 0; + AB_ContainerType type = AB_GetEntryContainerType(m_pane, m_pLineData->m_nLine); - if (m_EntryLine.entryType == ABTypeList) - idxImage = IDX_ADDRESSBOOKLIST; - else - idxImage = IDX_ADDRESSBOOKPERSON; + if (type == AB_MListContainer) + idxImage = IDX_NAME_DIRMAILINGLIST; + else if(type == AB_LDAPContainer) + idxImage = IDX_NAME_DIRLDAPAB; + else if(type == AB_PABContainer) + idxImage = IDX_NAME_DIRPERSONALAB; m_pIUserImage->DrawImage ( idxImage, rect.left + ( ( rect.Width ( ) - 16 ) / 2 ), rect.top, &dc, FALSE ); @@ -749,13 +989,17 @@ BOOL CNameCompletionOutliner::RenderData ( UINT iColumn, CRect &rect, CDC &dc, int CNameCompletionOutliner::TranslateIcon ( void * pLineData ) { - AB_EntryLine* line = (AB_EntryLine*) pLineData; + CNameCompletionLineData * pNameLineData = (CNameCompletionLineData*) pLineData; int idxImage = 0; - if (line->entryType == ABTypeList) - idxImage = IDX_ADDRESSBOOKLIST; - else - idxImage = IDX_ADDRESSBOOKPERSON; + AB_ContainerType type = AB_GetEntryContainerType(m_pane, pNameLineData->m_nLine); + + if (type == AB_MListContainer) + idxImage = IDX_NAME_DIRMAILINGLIST; + else if(type == AB_LDAPContainer) + idxImage = IDX_NAME_DIRLDAPAB; + else if(type == AB_PABContainer) + idxImage = IDX_NAME_DIRPERSONALAB; return idxImage; } @@ -772,6 +1016,107 @@ BOOL CNameCompletionOutliner::ColumnCommand ( int iColumn, int iLine ) return FALSE; } +void CNameCompletionOutliner::AppendAddressBookMenuItem(CMenu *pMenu) +{ + MSG_ViewIndex *indices = NULL; + int count = 0; + GetSelection(indices, count); + + //if selection is not an LDAP item then don't add it to menu + if(count > 0) + { + + AB_ContainerType type = AB_GetEntryContainerType(m_pane, indices[0]); + + if(type != AB_LDAPContainer) + return; + + } + + XP_List *addressBooks = AB_AcquireAddressBookContainers(m_pContext); + + + if(addressBooks) + { + + int nCount = XP_ListCount(addressBooks); + if(nCount == 1) + { + pMenu->AppendMenu( MF_BYPOSITION| MF_STRING, FIRST_ADDSENDER_MENU_ID, + "&Add to Address Book"); + + } + else + { + CMenu *pAddMenu = new CMenu; + + pAddMenu->CreatePopupMenu(); + + pMenu->AppendMenu( MF_BYPOSITION| MF_STRING | MF_POPUP, (UINT)pAddMenu->m_hMenu, + "&Add to Address Book"); + + for(int i = 1; i <= nCount; i++) + { + AB_ContainerInfo *info = + (AB_ContainerInfo*)XP_ListGetObjectNum (addressBooks, i); + + AB_ContainerAttribValue *value; + AB_GetContainerAttribute(info, attribName, &value); + + if(value != NULL) + { + pAddMenu->AppendMenu(MF_BYPOSITION | MF_STRING, + FIRST_ADDSENDER_MENU_ID + i, value->u.string); + + AB_FreeContainerAttribValue(value); + + } + + + } + } + + + AB_ReleaseContainersList(addressBooks); + } + + +} + +void CNameCompletionOutliner::PropertyMenu(int iSel, UINT flags) +{ + CMenu cmPopup; + CString cs; + + if(cmPopup.CreatePopupMenu() == 0) + return; + + + + if (iSel < m_iTotalLines) { + + AppendAddressBookMenuItem(&cmPopup); + + cs.LoadString(IDS_GETINFO); + cmPopup.AppendMenu(MF_ENABLED, ID_ITEM_PROPERTIES, cs); + } + + // Track the popup now. + POINT pt = m_ptHit; + ClientToScreen(&pt); + + cmPopup.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, + GetParent()->GetParent(), NULL); + + // Cleanup + cmPopup.DestroyMenu(); + + + +} + + + HFONT CNameCompletionOutliner::GetLineFont(void *pLineData) { if (!m_hFont) @@ -797,13 +1142,35 @@ HFONT CNameCompletionOutliner::GetLineFont(void *pLineData) void * CNameCompletionOutliner::AcquireLineData ( int line ) { - m_lineindex = line + 1; - if ( line >= m_iTotalLines) - return NULL; - if (!AB_GetEntryLine(m_pane, line, &m_EntryLine )) - return NULL; + if ( line >= m_iTotalLines) { + if (m_pLineData) { + delete m_pLineData; + } + + m_pLineData = NULL; + return NULL; + } + + + if (m_pLineData) { + m_pLineData = NULL; + } + + m_nNumColumns = AB_GetNumColumnsForPane(m_pane); + + + AB_AttributeValue *pValues; + + AB_GetEntryAttributesForPane( + m_pane, + line, + m_pEntryAttrib, /* FE allocated array of attribs that you want */ + &pValues, + &m_nNumColumns); + + m_pLineData = new CNameCompletionLineData(pValues, m_nNumColumns, line); + return m_pLineData; - return &m_EntryLine; } @@ -821,31 +1188,15 @@ void CNameCompletionOutliner::ReleaseLineData ( void * ) LPCTSTR CNameCompletionOutliner::GetColumnText ( UINT iColumn, void * pLineData ) { - AB_EntryLine* line = (AB_EntryLine*) pLineData; + if ((iColumn)== AB_ColumnID0) + return (""); + + CNameCompletionLineData* pNameLineData = (CNameCompletionLineData*) pLineData; + + if (pNameLineData->m_pValues [iColumn].u.string && + *(pNameLineData->m_pValues [iColumn].u.string)) + return pNameLineData->m_pValues [iColumn].u.string; - switch (iColumn) { - case ID_COLADDR_NAME: - return line->fullname; - break; - case ID_COLADDR_EMAIL: - return line->emailAddress; - break; - case ID_COLADDR_COMPANY: - return line->companyName; - break; - case ID_COLADDR_PHONE: - if (line->entryType == ABTypePerson) - return line->workPhone; - break; - case ID_COLADDR_LOCALITY: - return line->locality; - break; - case ID_COLADDR_NICKNAME: - return line->nickname; - break; - default: - break; - } return (""); } @@ -917,25 +1268,46 @@ COutliner * CNameCompletionOutlinerParent::GetOutliner ( void ) void CNameCompletionOutlinerParent::CreateColumns ( void ) { - CString cs; - m_pOutliner->AddColumn ("", ID_COLADDR_TYPE, 24, 0, ColumnFixed, 0, TRUE ); - cs.LoadString(IDS_USERNAME); - m_pOutliner->AddColumn (cs, ID_COLADDR_NAME, 175, 0, ColumnVariable, 1500); - cs.LoadString(IDS_EMAILADDRESS); - m_pOutliner->AddColumn (cs, ID_COLADDR_EMAIL, 175, 0, ColumnVariable, 1500); - cs.LoadString(IDS_COMPANYNAME); - m_pOutliner->AddColumn (cs, ID_COLADDR_COMPANY, 175, 0, ColumnVariable, 1500 ); - cs.LoadString(IDS_PHONE); - m_pOutliner->AddColumn (cs, ID_COLADDR_PHONE, 175, 0, ColumnVariable, 1500, FALSE); - cs.LoadString(IDS_LOCALITY); - m_pOutliner->AddColumn (cs, ID_COLADDR_LOCALITY, 175, 0, ColumnVariable, 1500 ); - cs.LoadString(IDS_NICKNAME); - m_pOutliner->AddColumn (cs, ID_COLADDR_NICKNAME, 175, 0, ColumnVariable, 1500 ); + MSG_Pane *pPane = ((CNameCompletionOutliner*)m_pOutliner)->GetPane(); + + int nNumColumns = AB_GetNumColumnsForPane(pPane); + + char *displayString; + + for(int i = 0; i < nNumColumns; i++) + { + AB_ColumnInfo * info = AB_GetColumnInfoForPane(pPane, (AB_ColumnID)i); + + + if(i == AB_ColumnID0) + { + m_pOutliner->AddColumn ("", 0, 24, 0, ColumnFixed, 0, TRUE ); + } + else + { + displayString = ""; + + if(info != NULL) + { + displayString = info->displayString; + } + + m_pOutliner->AddColumn (displayString, i, 175, 0, ColumnVariable, 1500); + + } + + if(info) + { + AB_FreeColumnInfo(info); + } + } + m_pOutliner->SetHasPipes( FALSE ); + m_pOutliner->SetHasImageOnlyColumn(TRUE); m_pOutliner->SetVisibleColumns(DEF_VISIBLE_COLUMNS); - m_pOutliner->LoadXPPrefs("mailnews.abook_columns_win"); + m_pOutliner->LoadXPPrefs("name_completion.picker_columns_win"); } @@ -953,25 +1325,25 @@ BOOL CNameCompletionOutlinerParent::ColumnCommand ( int idColumn ) switch (idColumn) { case ID_COLADDR_TYPE: - AB_Command(pOutliner->GetPane(), AB_SortByTypeCmd, 0, 0); + AB_CommandAB2(pOutliner->GetPane(), AB_SortByTypeCmd, 0, 0); break; case ID_COLADDR_NAME: - AB_Command(pOutliner->GetPane(), AB_SortByFullNameCmd, 0, 0); + AB_CommandAB2(pOutliner->GetPane(), AB_SortByFullNameCmd, 0, 0); break; case ID_COLADDR_NICKNAME: - AB_Command(pOutliner->GetPane(), AB_SortByNickname, 0, 0); + AB_CommandAB2(pOutliner->GetPane(), AB_SortByNickname, 0, 0); break; case ID_COLADDR_LOCALITY: - AB_Command(pOutliner->GetPane(), AB_SortByLocality, 0, 0); + AB_CommandAB2(pOutliner->GetPane(), AB_SortByLocality, 0, 0); break; case ID_COLADDR_COMPANY: - AB_Command(pOutliner->GetPane(), AB_SortByCompanyName, 0, 0); + AB_CommandAB2(pOutliner->GetPane(), AB_SortByCompanyName, 0, 0); break; case ID_COLADDR_EMAIL: - AB_Command(pOutliner->GetPane(), AB_SortByEmailAddress, 0, 0); + AB_CommandAB2(pOutliner->GetPane(), AB_SortByEmailAddress, 0, 0); break; default: - AB_Command(pOutliner->GetPane(), AB_SortByFullNameCmd, 0, 0); + AB_CommandAB2(pOutliner->GetPane(), AB_SortByFullNameCmd, 0, 0); break; } @@ -994,7 +1366,7 @@ void CNameCompletionOutlinerParent::OnLButtonUp( UINT nFlags, CPoint point ) (m_bResizeColumn || m_bDraggingHeader || m_iPusherHit))? TRUE : FALSE; COutlinerParent::OnLButtonUp(nFlags, point); if (bSaveColumns) - m_pOutliner->SaveXPPrefs("mailnews.autocomp_columns_win"); + m_pOutliner->SaveXPPrefs("name_completion.picker_columns_win"); } diff --git a/mozilla/cmd/winfe/namcomp.h b/mozilla/cmd/winfe/namcomp.h index 5648037cfaf..f836658fccf 100644 --- a/mozilla/cmd/winfe/namcomp.h +++ b/mozilla/cmd/winfe/namcomp.h @@ -31,6 +31,7 @@ #include "mailfrm.h" #include "mailpriv.h" #include "mnrccln.h" +#include "abcom.h" class CNameCompletion; class CNameCompletionOutliner; @@ -47,10 +48,10 @@ class CNameCompletionEntryList; #define ID_COLADDR_LOCALITY 6 #define ID_COLADDR_NICKNAME 7 -// array of indexes for IDB_ADDRESSBOOK bitmap -#define IDX_ADDRESSBOOKPERSON 0 -#define IDX_ADDRESSBOOKLIST 1 -#define IDX_ADDRESSBOOKPERCARD 2 +// array of indexes for IDB_DIRLIST bitmap +#define IDX_NAME_DIRLDAPAB 0 +#define IDX_NAME_DIRPERSONALAB 1 +#define IDX_NAME_DIRMAILINGLIST 2 // name completion context class CNameCompletionCX: public CStubsCX @@ -147,10 +148,13 @@ protected: CNameCompletionOutliner *m_pOutliner; LPMSGLIST m_pIAddrList; - ABPane *m_addrBookPane; + MSG_Pane *m_pPickerPane; BOOL m_bSearching; + BOOL m_bInitDialog; //Has InitDialog been called CMailNewsResourceSwitcher m_MailNewsResourceSwitcher; LPCTSTR m_lpszSearchString; + AB_NameCompletionCookie* m_pCookie; + BOOL m_bFreeCookie; // IUnknown Interface STDMETHODIMP QueryInterface(REFIID,LPVOID *); @@ -170,6 +174,7 @@ protected: // Operations public: CNameCompletion(LPCTSTR lpszSearchString, CWnd * parent = NULL); + ~CNameCompletion(); enum { ToolInvalid = -1, ToolText = 0, ToolPictures = 1, ToolBoth = 2 }; @@ -195,16 +200,31 @@ public: static void HandleErrorReturn(int errorID); void Create(); - void DoUpdateAddressBook( CCmdUI* pCmdUI, AB_CommandType cmd, BOOL bUseCheck = TRUE ); + void DoUpdateCommand( CCmdUI* pCmdUI, AB_CommandType cmd, BOOL bUseCheck = TRUE ); + void DoCommand(AB_CommandType cmd); void UpdateButtons(); void PerformDirectorySearch(); + //User is responsible for freeing returned cookie. Each call for a given session + //returns same value. + AB_NameCompletionCookie *GetNameCompletionCookie() { return m_pCookie;} + void OnAddToAddressBook(UINT nID); + + + // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CNameCompletion) public: virtual BOOL OnInitDialog( ); + afx_msg BOOL OnCommand( WPARAM wParam, LPARAM lParam ); + virtual int DoModal( ); + afx_msg void OnUpdateProperties( CCmdUI *pCmdUI ); + afx_msg void OnProperties(); + afx_msg void OnUpdateOnlineStatus(CCmdUI *pCmdUI); + + protected: //}}AFX_VIRTUAL @@ -225,6 +245,26 @@ protected: }; +/**************************************************************************** +* +* Class: CNameCompletionLineData +* +* DESCRIPTION: +* +* +****************************************************************************/ +class CNameCompletionLineData +{ + +public: + AB_AttributeValue *m_pValues; + int m_nLine; + int m_nNumColumns; + + CNameCompletionLineData(AB_AttributeValue *pValues, int numColumns, int line); + ~CNameCompletionLineData(); +}; + /**************************************************************************** * * Class: CNameCompletionOutliner @@ -233,18 +273,22 @@ protected: * This class is the column/list object in the name completion dialog * ****************************************************************************/ -class CNameCompletionOutliner : public COutliner +class CNameCompletionOutliner : public CMSelectOutliner { friend class CNameCompletionOutlinerParent; protected: int m_lineindex; char* m_pszExtraText; - ABPane* m_pane; + MSG_Pane* m_pane; int m_iMysticPlane; MWContext* m_pContext; - AB_EntryLine m_EntryLine; HFONT m_hFont; + CNameCompletionLineData* m_pLineData; + AB_AttribID* m_pEntryAttrib; + uint16 m_nNumColumns; + + public: CNameCompletionOutliner ( ); @@ -265,9 +309,8 @@ public: virtual int TranslateIcon ( void *); virtual int TranslateIconFolder ( void *); - void SetPane( ABPane *pane ); - ABPane* GetPane() { return m_pane; } - void SetColumnsForDirectory (DIR_Server* pServer); + void SetPane( MSG_Pane *pane ); + MSG_Pane* GetPane() { return m_pane; } MWContext *GetContext() { return m_pContext; } void SetContext( MWContext *pContext ) { m_pContext = pContext; } @@ -284,6 +327,8 @@ public: virtual BOOL RenderData ( UINT iColumn, CRect & rect, CDC & pdc, const char * ); virtual BOOL ColumnCommand ( int iColumn, int iLine ); + virtual void PropertyMenu(int iSel, UINT flags=0); + // Implementation protected: @@ -293,6 +338,7 @@ protected: DECLARE_MESSAGE_MAP() + void AppendAddressBookMenuItem(CMenu *pMenu); }; diff --git a/mozilla/cmd/winfe/netsvw.h b/mozilla/cmd/winfe/netsvw.h index 7dd7746c4a5..34d3200d731 100644 --- a/mozilla/cmd/winfe/netsvw.h +++ b/mozilla/cmd/winfe/netsvw.h @@ -236,7 +236,8 @@ protected: // populate the given menu with items appropritate for being // over the given LO_Element void CreateWebPopup(CMenu * pMenu, LO_Element * pElement, CL_Layer *layer); - void CreateMessagePopup(CMenu * pMenu, LO_Element * pElement, CL_Layer *layer); + void CreateMessagePopup(CMenu * pMenu, LO_Element * pElement, CL_Layer *layer, + MWContext *pContext); BOOL AddLinkToPopup(CMenu * pMenu, LO_Element * pElement, BOOL bBrowser); BOOL AddEmbedToPopup(CMenu * pMenu, LO_Element * pElement, CL_Layer *layer, BOOL bAddSeparator); BOOL AddClipboardToPopup(CMenu * pMenu, LO_Element * pElement, BOOL bAddSeparator); diff --git a/mozilla/cmd/winfe/nsadrlst.cpp b/mozilla/cmd/winfe/nsadrlst.cpp index 18341166800..7880de80263 100644 --- a/mozilla/cmd/winfe/nsadrlst.cpp +++ b/mozilla/cmd/winfe/nsadrlst.cpp @@ -18,6 +18,8 @@ #include "stdafx.h" #include "nsadrlst.h" +#include "namcomp.h" + #ifdef __APIAPIDLL #include "festuff.h" #else @@ -25,9 +27,264 @@ #endif #include "resource.h" +#include "addrfrm.h" //to get MOZ_NEWADDR +#include "wfemsg.h" +#include "intl_csi.h" + + #define IDM_HEADER 8192 #define MAX_HEADER_ITEMS 20 + +CListNameCompletionCX::CListNameCompletionCX(CListNameCompletionEntryList *pOwnerList) +: CStubsCX(AddressCX, MWContextAddressBook) +{ + m_pOwnerList = pOwnerList; + m_lPercent = 0; + m_bAnimated = FALSE; +} + +void CListNameCompletionCX::SetOwnerList(CListNameCompletionEntryList *pOwnerList) +{ + m_pOwnerList = pOwnerList; +} + +void CListNameCompletionCX::SetProgressBarPercent(MWContext *pContext, int32 lPercent ) { + // Ensure the safety of the value. + + lPercent = lPercent < 0 ? 0 : ( lPercent > 100 ? 100 : lPercent ); + + if ( m_lPercent == lPercent ) { + return; + } + + m_lPercent = lPercent; + if (m_pOwnerList) { + m_pOwnerList->SetProgressBarPercent(lPercent); + } +} + +void CListNameCompletionCX::Progress(MWContext *pContext, const char *pMessage) { + if ( m_pOwnerList ) { + m_pOwnerList->SetStatusText(pMessage); + } +} + +int32 CListNameCompletionCX::QueryProgressPercent() { + return m_lPercent; +} + + +void CListNameCompletionCX::AllConnectionsComplete(MWContext *pContext) +{ + // Call the base. + CStubsCX::AllConnectionsComplete(pContext); + + // Also, we can clear the progress bar now. + m_lPercent = 0; + if ( m_pOwnerList ) { + m_pOwnerList->SetProgressBarPercent(m_lPercent); + m_pOwnerList->AllConnectionsComplete(pContext); + } + if (m_pOwnerList) { + CWnd *pOwnerWindow = m_pOwnerList->GetOwnerWindow(); + if(pOwnerWindow) + { + pOwnerWindow->SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, (LPARAM)0); + } + } +} + +void CListNameCompletionCX::UpdateStopState( MWContext *pContext ) +{ + if (m_pOwnerList) { + CWnd *pOwnerWindow = m_pOwnerList->GetOwnerWindow(); + if(pOwnerWindow) + { + pOwnerWindow->SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, (LPARAM)0); + } + } +} + +CWnd *CListNameCompletionCX::GetDialogOwner() const { + return m_pOwnerList->GetOwnerWindow(); +} + +///////////////////////////////////////////////////////////////////////////// +// CListNameCompletionEntryList + +STDMETHODIMP CListNameCompletionEntryList::QueryInterface(REFIID refiid, LPVOID * ppv) +{ + *ppv = NULL; + if (IsEqualIID(refiid,IID_IUnknown)) + *ppv = (LPUNKNOWN) this; + else if (IsEqualIID(refiid,IID_IMsgList)) + *ppv = (LPMSGLIST) this; + else if (IsEqualIID(refiid,IID_IMailFrame)) + *ppv = (LPMAILFRAME) m_pMailFrame; + + if (*ppv != NULL) { + AddRef(); + return NOERROR; + } + + return ResultFromScode(E_NOINTERFACE); +} + + + +STDMETHODIMP_(ULONG) CListNameCompletionEntryList::AddRef(void) +{ + return ++m_ulRefCount; +} + +STDMETHODIMP_(ULONG) CListNameCompletionEntryList::Release(void) +{ + ULONG ulRef; + ulRef = --m_ulRefCount; + if (m_ulRefCount == 0) + delete this; + return ulRef; +} + +void CListNameCompletionEntryList::ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ +} + +void CListNameCompletionEntryList::ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num) +{ + switch ( notify ) + { + + + case MSG_NotifyInsertOrDelete: + // if its insert or delete then tell my frame to add the next chunk of values + // from the search + if (notify == MSG_NotifyInsertOrDelete + && num > 0) + { + if(m_bSearching) + { + AB_LDAPSearchResultsAB2(m_pPickerPane, where, num); + } + + } + else + { + } + break; + } +} + +void CListNameCompletionEntryList::GetSelection( MSG_Pane* pane, MSG_ViewIndex **indices, int *count, + int *focus) +{ +} + +void CListNameCompletionEntryList::SelectItem( MSG_Pane* pane, int item ) +{ +} + +void CListNameCompletionEntryList::SetProgressBarPercent(int32 lPercent) +{ + m_pList->SetProgressBarPercent(lPercent); + +} + +void CListNameCompletionEntryList::SetStatusText(const char* pMessage) +{ + m_pList->SetStatusText(pMessage); +} + +void CListNameCompletionEntryList::AllConnectionsComplete(MWContext *pContext) +{ + /* + PerformDirectorySearch(); + + int total = m_pOutliner->GetTotalLines(); + CString csStatus; + if ( total > 1 ) { + csStatus.Format( szLoadString( IDS_SEARCHHITS ), total ); + } else if ( total > 0 ) { + csStatus.LoadString( IDS_SEARCHONEHIT ); + } else { + csStatus.LoadString( IDS_SEARCHNOHITS ); + } + m_barStatus.SetWindowText( csStatus ); + + SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, (LPARAM)0); + */ + + CAddrFrame::HandleErrorReturn(AB_FinishSearchAB2(m_pPickerPane)); +} + +CWnd *CListNameCompletionEntryList::GetOwnerWindow() +{ + + return m_pList->GetOwnerWindow(); +} + +STDMETHODIMP CListNameCompletionEntryMailFrame::QueryInterface(REFIID refiid, LPVOID * ppv) +{ + *ppv = NULL; + if (IsEqualIID(refiid,IID_IUnknown)) + *ppv = (LPUNKNOWN) this; + else if (IsEqualIID(refiid,IID_IMailFrame)) + *ppv = (LPMAILFRAME) this; + + if (*ppv != NULL) { + AddRef(); + return NOERROR; + } + + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP_(ULONG) CListNameCompletionEntryMailFrame::AddRef(void) +{ + return 0; +} + +STDMETHODIMP_(ULONG) CListNameCompletionEntryMailFrame::Release(void) +{ + return 0; +} + +// IMailFrame interface +CMailNewsFrame *CListNameCompletionEntryMailFrame::GetMailNewsFrame() +{ + return (CMailNewsFrame *) NULL; +} + +MSG_Pane *CListNameCompletionEntryMailFrame::GetPane() +{ + return (MSG_Pane*) m_pParentList->m_pPickerPane; +} + +void CListNameCompletionEntryMailFrame::PaneChanged(MSG_Pane *pane, XP_Bool asynchronous, + MSG_PANE_CHANGED_NOTIFY_CODE notify, int32 value) +{ + if (notify == MSG_PaneNotifyStartSearching) + { + m_pParentList->m_bSearching = TRUE; + m_pParentList->m_pList->SearchStarted(); + // m_barStatus.StartAnimation(); + } + else if(notify == MSG_PaneNotifyStopSearching ) + { + m_pParentList->m_bSearching = FALSE; + m_pParentList->m_pList->SearchStopped(); + + // m_barStatus.StopAnimation(); + + } +} + + //============================================================ CNSAddressList CNSAddressList::CNSAddressList() { @@ -42,13 +299,42 @@ CNSAddressList::CNSAddressList() m_iFieldControlWidth = 0; m_iBitmapWidth = 0; m_iTypeBitmapWidth = 0; - m_pNameField = new CNSAddressNameEditField; + m_pNameField = new CNSAddressNameEditField(this); m_pAddressTypeList = new CNSAddressTypeControl; m_iItemHeight = 0; m_pIAddressParent = NULL; m_bCreated = FALSE; m_hTextFont = NULL; m_bParse = TRUE; + + m_bDragging = FALSE; + m_pContext = NULL; + + m_pCX = new CListNameCompletionCX(NULL); + INTL_CharSetInfo csi; + + csi = LO_GetDocumentCharacterSetInfo(m_pCX->GetContext()); + + m_pCX->GetContext()->type = MWContextAddressBook; + m_pCX->GetContext()->fancyFTP = TRUE; + m_pCX->GetContext()->fancyNews = TRUE; + m_pCX->GetContext()->intrupt = FALSE; + m_pCX->GetContext()->reSize = FALSE; + INTL_SetCSIWinCSID(csi, CIntlWin::GetSystemLocaleCsid()); + + m_pPickerPane = NULL; + m_bExpansion = TRUE; +#ifdef MOZ_NEWADDR + int result; + + result = AB_CreateABPickerPane(&m_pPickerPane, m_pCX->GetContext(), WFE_MSGGetMaster(), 1); + + CListNameCompletionEntryList* pInstance = new CListNameCompletionEntryList(m_pPickerPane, this); + pInstance->QueryInterface( IID_IMsgList, (LPVOID *) &m_pINameCompList ); + MSG_SetFEData( (MSG_Pane*) m_pPickerPane, (LPVOID) (LPUNKNOWN) (LPMAILFRAME) m_pINameCompList ); + m_pCX->SetOwnerList(pInstance); +#endif + } LRESULT CNSAddressList::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) @@ -94,7 +380,7 @@ LRESULT CNSAddressList::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam DoChildLostFocus(); return 0; case WM_NOTIFYSELECTIONCHANGE: - return (DoNotifySelectionChange()); + return (DoNotifySelectionChange(FALSE)); case WM_DISPLAYTYPELIST: DoDisplayTypeList(); return 0; @@ -111,6 +397,14 @@ LRESULT CNSAddressList::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam if (DoCommand(m_hWnd,wParam,lParam)) return 0; break; + case WM_GETDLGCODE: + return DLGC_WANTTAB | DLGC_WANTARROWS; + case WM_KEYDOWN: + onKeyDown((int)wParam, (DWORD)lParam); + break; + case WM_MOUSEMOVE: + onMouseMove(m_hWnd, (WORD)wParam, (int)LOWORD(lParam), (int)HIWORD(lParam)); + break; } return CListBox::DefWindowProc(message,wParam,lParam); } @@ -120,6 +414,21 @@ void CNSAddressList::EnableParsing(BOOL bParse) m_bParse = bParse; } +BOOL CNSAddressList::GetEnableParsing() +{ + return m_bParse; +} + +void CNSAddressList::EnableExpansion(BOOL bExpansion) +{ + m_bExpansion = bExpansion; +} + +BOOL CNSAddressList::GetEnableExpansion() +{ + return m_bExpansion; +} + void CNSAddressList::SetControlParent(LPADDRESSPARENT pIAddressParent) { m_pIAddressParent = pIAddressParent; @@ -143,10 +452,32 @@ CNSAddressList::~CNSAddressList() ::DeleteObject((HGDIOBJ)m_hPenGrey); delete m_pAddressTypeList; delete m_pNameField; + + if(!m_pCX->IsDestroyed()) { + m_pCX->DestroyContext(); + } +#ifdef MOZ_NEWADDR + if(m_pPickerPane) + { + AB_ClosePane(m_pPickerPane); + } + + m_pINameCompList->Release(); +#endif } BOOL CNSAddressList::DoCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) { +#ifdef XP_WIN16 + if (HIWORD(lParam) == EN_SETFOCUS) +#else + if (HIWORD(wParam) == EN_SETFOCUS) +#endif + { + selectAllEntries(FALSE); + return TRUE; + } + #ifdef XP_WIN16 if (HIWORD(lParam) == EN_CHANGE) #else @@ -282,29 +613,35 @@ int CNSAddressList::InsertEntry( int nIndex, NSAddressListEntry *pAddressEntry, // address type in the address type list. if (m_bDrawTypeList) { - CString cs; - int index = GetCount(); - if (index > 0 && index != LB_ERR) - { - CNSAddressInfo *pLastAddress = - (CNSAddressInfo *)GetItemDataPtr(index-1); - cs = pLastAddress->GetType(); - int index = m_pAddressTypeList->FindStringExact(-1,cs); - if (index != LB_ERR) - { - CNSAddressTypeInfo * pInfo = (CNSAddressTypeInfo *)m_pAddressTypeList->GetItemData(index); - ASSERT(pInfo); - if (pInfo->GetExclusive()) - m_pAddressTypeList->GetText(0,cs); - } - } - else - m_pAddressTypeList->GetText(0,cs); - pAddress->SetType(cs); - pAddress->SetBitmap(0); + CString cs; + int index = GetCount(); + if (index > 0 && index != LB_ERR) + { + CNSAddressInfo *pLastAddress = (CNSAddressInfo *)GetItemDataPtr(index-1); + cs = pLastAddress->GetType(); + int index = m_pAddressTypeList->FindStringExact(-1,cs); + if (index != LB_ERR) + { + CNSAddressTypeInfo * pInfo = (CNSAddressTypeInfo *)m_pAddressTypeList->GetItemData(index); + ASSERT(pInfo); + if (pInfo->GetExclusive()) + m_pAddressTypeList->GetText(index, cs); + } + } + else + { + m_pAddressTypeList->GetText(0, cs); + } + pAddress->SetType(cs); + pAddress->SetBitmap(0); pAddress->SetEntryID(); - pAddress->SetName(""); - } + pAddress->SetName(""); + + } +#ifdef MOZ_NEWADDR + pAddress->SetPickerPane(m_pPickerPane); +#endif + } else { @@ -332,6 +669,10 @@ int CNSAddressList::InsertEntry( int nIndex, NSAddressListEntry *pAddressEntry, pAddress->SetName(pAddressEntry->szName); pAddress->SetBitmap(pAddressEntry->idBitmap); pAddress->SetEntryID(pAddressEntry->idEntry); +#ifdef MOZ_NEWADDR + pAddress->SetPickerPane(m_pPickerPane); +#endif + } int index = InsertString( nIndex, (LPCTSTR)pAddress ); if ( index < 0 ) @@ -347,7 +688,7 @@ int CNSAddressList::InsertEntry( int nIndex, NSAddressListEntry *pAddressEntry, CRect WindowRect, ItemRect; GetWindowRect(WindowRect); - + if (m_pIAddressParent && expandName) m_pIAddressParent->AddedItem(m_hWnd, 0, index); @@ -377,6 +718,432 @@ void CNSAddressList::SetCSID( int16 csid ) m_pNameField->SetCSID(csid); } +//==================================================================ShowNameCompletionPicker +void CNSAddressList::ShowNameCompletionPicker(CWnd* pParent) +{ + + CString name; + + //Stop the current name completion + StopNameCompletion(); + + //turn parsing and expansion off while we have dialog up + BOOL pOldParse = GetEnableParsing(); + BOOL pOldExpansion = GetEnableExpansion(); + + EnableParsing(FALSE); + EnableExpansion(FALSE); + CEdit *pNameField = GetAddressNameField(); + if(pNameField) + { + pNameField->GetWindowText(name); + + + CNameCompletion dialog( name, pParent); + + int result = dialog.DoModal(); + + //reset parsing and expansion state. + EnableParsing(pOldParse); + EnableExpansion(pOldExpansion); + + if(result == IDOK) + { + AB_NameCompletionCookie *pCookie = dialog.GetNameCompletionCookie(); + + if(pCookie) + { + SetNameCompletionCookieInfo(pCookie, 1, NC_NameComplete); + DoNotifySelectionChange(); + + } + if ((GetActiveSelection()+1 == GetCount())) + { + // don't add a second blank line + if ( m_pNameField->LineLength() != 0 ) + { + // add the new address entry to the list + InsertEntry( GetActiveSelection()+1,NULL); + } + } + SetActiveSelection( GetActiveSelection()+1 ); + pNameField->SetFocus(); + + } + + if(result == IDCANCEL) + { + //they have chosen not to accept a result so they have + //turned of name completion until they type something again. + SetNameCompletionCookieInfo(NULL, 0, NC_NameComplete); + pNameField->SetFocus(); + } + } + + +} + +//=================================================================NameCompletionExit +int NameCompletionExit(AB_NameCompletionCookie *cookie, int numResults, + void *FEcookie) +{ + + + if(FEcookie) + { + FENameCompletionCookieInfo *pCookieInfo = (FENameCompletionCookieInfo*)FEcookie; + + CNSAddressList *pList = pCookieInfo->GetList(); + int nIndex = pCookieInfo->GetIndex(); + + if(pList) + { + pList->SetNameCompletionCookieInfo(cookie, numResults, NC_NameComplete, nIndex ); + //how do we make correct name show up correctly? + CNSAddressNameEditField * nameField = (CNSAddressNameEditField *)pList->GetAddressNameField(); + nameField->DrawNameCompletion(); + } + + } + return 0; +} + +int NameExpansionExit(AB_NameCompletionCookie *cookie, int numResults, void *FEcookie) +{ + + if(FEcookie) + { + FENameCompletionCookieInfo *pCookieInfo = (FENameCompletionCookieInfo*)FEcookie; + + CNSAddressList *pList = pCookieInfo->GetList(); + int nIndex = pCookieInfo->GetIndex(); + + if(pList) + { + pList->SetNameCompletionCookieInfo(cookie, numResults, NC_Expand, nIndex ); + } + + } + return 0; + +} + +//=================================================================StartNameCompletion +void CNSAddressList::StartNameCompletion(int nIndex) +{ + + CString text; + + m_pNameField->GetWindowText(text); + + int result; + + if(nIndex != -1 && (nIndex < 0 || nIndex >= GetCount())) + { + return; + } + + if(nIndex == -1) + nIndex = GetActiveSelection(); + + if(nIndex != LB_ERR) + { + //dont do if name completion is turned off for this index + CNSAddressInfo *info = (CNSAddressInfo*)GetItemDataPtr(nIndex); + + if(info->GetNameCompletionEnum() != NC_None) + { + FENameCompletionCookieInfo *pCookieInfo = new FENameCompletionCookieInfo(); + + pCookieInfo->SetList(this); + pCookieInfo->SetIndex(nIndex); + + if(info) + { +#ifdef FE_IMPLEMENTS_VISIBLE_NC + result = AB_NameCompletionSearch(info->GetPickerPane(), (const char*) text, + NameCompletionExit, FALSE, pCookieInfo); +#else + result = AB_NameCompletionSearch(info->GetPickerPane(), (const char*) text, + NameCompletionExit, pCookieInfo); +#endif + } + } + } +} + + +//=================================================================StopNameCompletion +void CNSAddressList::StopNameCompletion(int nIndex, BOOL bEraseCookie) +{ + + CString text; + + int result; + + if(nIndex != -1 && (nIndex < 0 || nIndex >= GetCount())) + { + return; + } + + if(nIndex == -1) + nIndex = GetActiveSelection(); + + if(nIndex != LB_ERR) + { + CNSAddressInfo *info = (CNSAddressInfo*)GetItemDataPtr(nIndex); + + if(bEraseCookie) + { + AB_NameCompletionCookie *pOldCookie = info->GetNameCompletionCookie(); + + if(pOldCookie) + { + AB_FreeNameCompletionCookie(pOldCookie); + } + + info->SetNameCompletionCookie(NULL); + info->SetNumNameCompletionResults(-1); + } + + //make sure m_pNameField doesn't keep setting timer off + m_pNameField->StopNameCompletion(); + if(info) + { +#ifdef FE_IMPLEMENTS_VISIBLE_NC + result = AB_NameCompletionSearch(info->GetPickerPane(), (const char*) NULL, + NameCompletionExit, FALSE, NULL); +#else + result = AB_NameCompletionSearch(info->GetPickerPane(), (const char*) NULL, + NameCompletionExit, NULL); +#endif + } + } +} + +//=================================================================StartNameExpansion +void CNSAddressList::StartNameExpansion(int nIndex) +{ + + CString text; + + m_pNameField->GetWindowText(text); + + int result; + + if(nIndex != -1 && (nIndex < 0 || nIndex >= GetCount())) + { + return; + } + + if(nIndex == -1) + nIndex = GetActiveSelection(); + + if(nIndex != LB_ERR) + { + CNSAddressInfo *info = (CNSAddressInfo*)GetItemDataPtr(nIndex); + + FENameCompletionCookieInfo *pCookieInfo = new FENameCompletionCookieInfo(); + + pCookieInfo->SetList(this); + pCookieInfo->SetIndex(nIndex); + + if(info) + { +#ifdef FE_IMPLEMENTS_VISIBLE_NC + result = AB_NameCompletionSearch(info->GetPickerPane(), (const char*) text, + NameExpansionExit, FALSE, pCookieInfo); +#else + result = AB_NameCompletionSearch(info->GetPickerPane(), (const char*) text, + NameExpansionExit, pCookieInfo); +#endif + } + } +} + +//================================================================== SetEntryHasNameCompletion +void CNSAddressList::SetEntryHasNameCompletion(BOOL bHasNameCompletion, int nIndex) +{ + if(nIndex != -1 && (nIndex < 0 || nIndex >= GetCount())) + { + return; + } + + if(nIndex == -1) + { + nIndex = GetActiveSelection(); + } + + if(nIndex != LB_ERR) + { + CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr( nIndex ); + if(bHasNameCompletion) + { + pAddress->SetNameCompletionEnum(NC_NameComplete); + StartNameCompletion(nIndex); + } + else + { + pAddress->SetNameCompletionEnum(NC_None); + StopNameCompletion(nIndex); + Invalidate(); + } + + } +} + +//================================================================== GetEntryHasNameCompletion +BOOL CNSAddressList::GetEntryHasNameCompletion(int nIndex) +{ + if(nIndex != -1 && (nIndex < 0 || nIndex >= GetCount())) + { + return FALSE; + } + + if(nIndex == -1) + { + nIndex = GetActiveSelection(); + } + + if(nIndex != LB_ERR) + { + CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr( nIndex ); + return (pAddress->GetNameCompletionEnum() != NC_None); + } + return FALSE; +} + + +//================================================================== SetContext +void CNSAddressList::SetContext(MWContext *pContext) +{ + m_pContext = pContext; +} + +//================================================================== GetContext +MWContext *CNSAddressList::GetContext() +{ + return m_pContext; +} + +//==============================================SetNameCompletionCookieInfo +void CNSAddressList::SetNameCompletionCookieInfo(AB_NameCompletionCookie *pCookie, + int nNumResults, + NameCompletionEnum ncEnum, int nIndex) +{ + if(nIndex != -1 && nIndex < 0 && nIndex > GetCount()) + { + return; + } + + if(nIndex == -1) + { + nIndex = GetActiveSelection(); + } + + if(nIndex != LB_ERR) + { + CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr( nIndex ); + AB_NameCompletionCookie *pOldCookie = pAddress->GetNameCompletionCookie(); + + if(pOldCookie != NULL && pOldCookie == pCookie) + { + int i = 0; + } + if(pOldCookie) + { + AB_FreeNameCompletionCookie(pOldCookie); + } + pAddress->SetNameCompletionCookie(pCookie); + pAddress->SetNumNameCompletionResults(nNumResults); + pAddress->SetNameCompletionEnum(ncEnum); + //if we are supposed to expand then expand the address + if(ncEnum == NC_Expand) + { + if(pCookie != NULL && nNumResults == 1) + { + char *pName = AB_GetHeaderString(pCookie); + + pAddress->SetName(pName); + XP_FREE(pName); + Invalidate(); + } + } + } + + +} + +void CNSAddressList::GetNameCompletionCookieInfo(AB_NameCompletionCookie **pCookie, + int *pNumResults, int nIndex) +{ + + *pCookie = NULL; + *pNumResults = 0; + + if(nIndex != -1 && nIndex < 0 && nIndex > GetCount()) + { + return; + } + + if(nIndex == -1) + { + nIndex = GetActiveSelection(); + } + + if(nIndex != LB_ERR) + { + CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr( nIndex ); + *pCookie = pAddress->GetNameCompletionCookie(); + *pNumResults = pAddress->GetNumNameCompletionResults(); + } + +} + +//================================================================== SearchStarted +void CNSAddressList::SearchStarted() +{ + if(m_pIAddressParent) + { + m_pIAddressParent->StartNameCompletionSearch(); + } +} + +//================================================================== SearchStopped +void CNSAddressList::SearchStopped() +{ + if(m_pIAddressParent) + { + m_pIAddressParent->StopNameCompletionSearch(); + } +} + +void CNSAddressList::SetProgressBarPercent(int32 lPercent) +{ + if(m_pIAddressParent) + { + m_pIAddressParent->SetProgressBarPercent(lPercent); + } +} + +void CNSAddressList::SetStatusText(const char* pMessage) +{ + if(m_pIAddressParent) + { + m_pIAddressParent->SetStatusText(pMessage); + } + +} + +CWnd *CNSAddressList::GetOwnerWindow() +{ + if(m_pIAddressParent) + { + return m_pIAddressParent->GetOwnerWindow(); + } + return NULL; +} + //================================================================== SetEntry BOOL CNSAddressList::SetEntry( int nIndex, NSAddressListEntry *pNewAddressEntry ) { @@ -394,15 +1161,26 @@ BOOL CNSAddressList::SetEntry( int nIndex, NSAddressListEntry *pNewAddressEntry pAddress->SetBitmap(pNewAddressEntry->idBitmap); pAddress->SetEntryID(pNewAddressEntry->idEntry); + + unsigned long entryID = 0; + UINT bitmapID = 0; + char * pszFullName = NULL; + +#ifdef MOZ_NEWADDR + //since we just changed the name up there we should notify parent. + m_pIAddressParent->ChangedItem((char*)pNewAddressEntry->szName, nIndex, m_hWnd, + &pszFullName, &entryID, &bitmapID); + +#endif + if (m_pIAddressParent) { NSAddressListEntry entry; BOOL bRetVal = GetEntry(nIndex,&entry); if (bRetVal) { - unsigned long entryID = 0; - UINT bitmapID = 0; - char * pszFullName = NULL; + + CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr( nIndex ); if (pAddress && pAddress->GetExpansion()) @@ -410,12 +1188,49 @@ BOOL CNSAddressList::SetEntry( int nIndex, NSAddressListEntry *pNewAddressEntry BOOL bExpand = TRUE; if (m_bDrawTypeList) { - CNSAddressTypeInfo * pInfo = (CNSAddressTypeInfo *)m_pAddressTypeList->GetItemData( + CNSAddressTypeInfo * pInfo = (CNSAddressTypeInfo *)m_pAddressTypeList->GetItemData( m_pAddressTypeList->GetCurSel()); + bExpand = pInfo->GetExpand(); } - if (bExpand) + if (bExpand && m_bExpansion) { +#ifdef MOZ_NEWADDR + AB_NameCompletionCookie *pCookie = pAddress->GetNameCompletionCookie(); + int nNumResults = pAddress->GetNumNameCompletionResults(); + BOOL bExpandName = FALSE; + + if(pCookie != NULL && nNumResults == 1) + { + pszFullName = AB_GetHeaderString(pCookie); + + } + //if we have multiple matches and preference is set. + else if(pCookie != NULL && nNumResults > 1 && g_MsgPrefs.m_bShowCompletionPicker) + { + ShowNameCompletionPicker(this); + return TRUE; + } + else + { + pszFullName = XP_STRDUP((char*)entry.szName); + } + + //since we just changed the name, we need to notify parent. + m_pIAddressParent->ChangedItem((char*)entry.szName, nIndex, m_hWnd, + &pszFullName, &entryID, &bitmapID); + + if (pszFullName != NULL) + { + pAddress->SetName(pszFullName); + if (bitmapID) + SetItemBitmap(GetActiveSelection(), bitmapID); + if (entryID) + SetItemEntryID(GetActiveSelection(), entryID); + free(pszFullName); + } + +#else m_pIAddressParent->ChangedItem((char*)entry.szName, nIndex, m_hWnd, &pszFullName, &entryID, &bitmapID); if (pszFullName != NULL) @@ -426,7 +1241,8 @@ BOOL CNSAddressList::SetEntry( int nIndex, NSAddressListEntry *pNewAddressEntry if (entryID) SetItemEntryID(nIndex, entryID); free(pszFullName); - } + } +#endif } } } @@ -482,14 +1298,18 @@ BOOL CNSAddressList::DeleteEntry( int nIndex ) } } - if (GetCount() == 1) - { - m_pNameField->SetWindowText(""); - UpdateHeaderContents(); - if (m_pIAddressParent) - m_pIAddressParent->DeletedItem(m_hWnd, 0, nIndex); - return FALSE; - } + if(m_bDrawTypeList) + { + if (GetCount() == 1) + { + m_pNameField->SetWindowText(""); + UpdateHeaderContents(); + if (m_pIAddressParent) + m_pIAddressParent->DeletedItem(m_hWnd, 0, nIndex); + return FALSE; + } + } + // handle selection if deleting selected address if ( (int)nIndex == GetActiveSelection() ) { @@ -559,11 +1379,12 @@ BOOL CNSAddressList::AddAddressType( m_pAddressTypeList->SetCurSel(0); } if ( !IsWindow( m_pNameField->m_hWnd ) ) - VERIFY( m_pNameField->Create( this ) ); + VERIFY( m_pNameField->Create( this, m_pContext ) ); return TRUE; } + //==================================================== GetAddressTypeComboBox CListBox * CNSAddressList::GetAddressTypeComboBox( void ) { @@ -630,6 +1451,19 @@ BOOL CNSAddressList::OnKeyPress( CWnd *pChildControl, UINT nKey, UINT nRepCnt, U { switch (nKey) { +#ifdef MOZ_NEWADDR + case 'J': + case 'j': + { + BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; + if(bCtrl) + { + ShowNameCompletionPicker(this); + return TRUE; + } + } + break; +#endif case VK_HOME: if (GetActiveSelection()) SetActiveSelection(0); @@ -685,34 +1519,34 @@ BOOL CNSAddressList::OnKeyPress( CWnd *pChildControl, UINT nKey, UINT nRepCnt, U return FALSE; return TRUE; } - break; + break; case VK_RETURN: - if (DoNotifySelectionChange() != -1) - { - if ((GetActiveSelection()+1 == GetCount())) - { - // don't add a second blank line - if ( m_pNameField->LineLength() == 0 ) - { - CWnd *pNextWnd = GetNextWindow(GW_HWNDNEXT); - if (pNextWnd) - pNextWnd->SetFocus(); - else - GetParent()->SendMessage(WM_LEAVINGLASTFIELD); - return TRUE; - } - // add the new address entry to the list - InsertEntry( GetActiveSelection()+1,NULL); - // select the new address and make sure its visible - SetActiveSelection( GetActiveSelection()+1 ); - return TRUE; - } - else - { - SetActiveSelection( GetActiveSelection()+1 ); - } - return TRUE; - } + if (DoNotifySelectionChange() != -1) + { + if ((GetActiveSelection()+1 == GetCount())) + { + // don't add a second blank line + if ( m_pNameField->LineLength() == 0 ) + { + CWnd *pNextWnd = GetNextWindow(GW_HWNDNEXT); + if (pNextWnd) + pNextWnd->SetFocus(); + else + GetParent()->SendMessage(WM_LEAVINGLASTFIELD); + return TRUE; + } + // add the new address entry to the list + InsertEntry( GetActiveSelection()+1,NULL); + // select the new address and make sure its visible + SetActiveSelection( GetActiveSelection()+1 ); + return TRUE; + } + else + { + SetActiveSelection( GetActiveSelection()+1 ); + } + return TRUE; + } else SetSel( GetActiveSelection(), TRUE); @@ -726,7 +1560,9 @@ BOOL CNSAddressList::OnKeyPress( CWnd *pChildControl, UINT nKey, UINT nRepCnt, U { BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; if ( !bShift && (pChildControl->m_hWnd == m_pAddressTypeList->m_hWnd) ) + { m_pNameField->SetFocus(); + } else if ( m_bDrawTypeList && bShift && (pChildControl->m_hWnd == m_pNameField->m_hWnd) ) m_pAddressTypeList->SetFocus(); else if ( !bShift && (GetActiveSelection()+1 == GetCount()) ) @@ -768,6 +1604,92 @@ BOOL CNSAddressList::OnKeyPress( CWnd *pChildControl, UINT nKey, UINT nRepCnt, U return FALSE; // not handled - let the child continue processing this key } +BOOL CNSAddressList::isPointInItemBitmap(LPPOINT pPoint, int iIndex) +{ + CRect rect; + if(GetItemRect(m_hWnd, iIndex, rect) == LB_ERR) + return FALSE; + + CRect rectBitmap(m_iFieldControlWidth, + rect.top, + m_iFieldControlWidth + m_iBitmapWidth, + rect.bottom ); + if (!m_bDrawTypeList) + { + rectBitmap.left = rect.left; + rectBitmap.right = rect.left + m_iBitmapWidth; + } + + BOOL bRet = rectBitmap.PtInRect(*pPoint); + return bRet; +} + +void CNSAddressList::selectEntry(int iIndex, BOOL bState) +{ + if(iIndex >= GetCount()) + return; + CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr(iIndex); + if(pAddress == NULL) + return; + if(pAddress->getEntrySelectedState() == bState) + return; + pAddress->setEntrySelectedState(bState); + RECT rcItem; + GetItemRect(m_hWnd, iIndex, &rcItem); + InvalidateRect(&rcItem); +} + +BOOL CNSAddressList::isEntrySelected(int iIndex) +{ + CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr(iIndex); + if(pAddress == NULL) + return FALSE; + return pAddress->getEntrySelectedState(); +} + +void CNSAddressList::selectAllEntries(BOOL bState) +{ + for(int i = 0; i < GetCount(); i++) + selectEntry(i, bState); +} + +int CNSAddressList::getEntryMultipleSelectionStatus(BOOL * pbContinuous, int * piFirst, int * piLast) +{ + if(GetCount() == 0) + return 0; + + int iFirst = -1; + int iLast = -1; + + int iCounter = 0; + BOOL bContinuousSelectionStarted = FALSE; + BOOL bContinuousSelectionStopped = FALSE; + BOOL bBroken = FALSE; + + for(int i = 0; i < GetCount(); i++) + { + if(isEntrySelected(i)) + { + if(iFirst == -1) + iFirst = i; + iLast = i; + if(bContinuousSelectionStopped) + bBroken = TRUE; + bContinuousSelectionStarted = TRUE; + iCounter++; + continue; + } + + if(bContinuousSelectionStarted) + bContinuousSelectionStopped = TRUE; + } + + *pbContinuous = !bBroken; + *piFirst = iFirst; + *piLast = iLast; + return iCounter; +} + void CNSAddressList::DrawEntryBitmap( int iSel, CNSAddressInfo * pAddress, @@ -789,9 +1711,16 @@ void CNSAddressList::DrawEntryBitmap( iBitmap = GetDefaultBitmapId(); if (iBitmap) { - if (bErase) - NS_FillSolidRect(pDC->GetSafeHdc(),rectBitmap,GetSysColor(COLOR_WINDOW)); - BITMAP bitmap; + if(!isEntrySelected(iSel)) + NS_FillSolidRect(pDC->GetSafeHdc(),rectBitmap,GetSysColor(COLOR_WINDOW)); + else + { + rectBitmap.InflateRect(0, -1); + NS_FillSolidRect(pDC->GetSafeHdc(),rectBitmap,GetSysColor(COLOR_HIGHLIGHT)); + rectBitmap.InflateRect(0, 1); + } + + BITMAP bitmap; CBitmap cbitmap; cbitmap.LoadBitmap(MAKEINTRESOURCE(iBitmap)); cbitmap.GetObject(sizeof(BITMAP),&bitmap); @@ -886,38 +1815,60 @@ void CNSAddressList::UpdateHeaderContents(void) } } +void CNSAddressList::SingleHeaderCommand(int nID) +{ + if (GetActiveSelection()!=LB_ERR && m_bDrawTypeList) + { + m_pAddressTypeList->SetCurSel(nID); + UpdateHeaderType(); + if(!isEntrySelected(GetActiveSelection())) + m_pNameField->SetFocus(); + CNSAddressTypeInfo * pInfo = (CNSAddressTypeInfo*)m_pAddressTypeList->GetItemData(nID); + ASSERT(pInfo); + if (pInfo->GetExclusive()) + { + CString cs; + m_pNameField->GetWindowText(cs); + if (!cs.GetLength()) + m_pNameField->SetWindowText(pInfo->GetValue()); + pInfo->SetHidden(FALSE); + pInfo->SetExclusive(FALSE); + UpdateHeaderContents(); + int iLineLength = m_pNameField->LineLength(); + UpdateWindow(); + m_pNameField->SetSel(iLineLength,iLineLength,TRUE); + } + else + { + pInfo->SetExclusive(TRUE); + } + } +} + void CNSAddressList::HeaderCommand(int nID) { - if (GetActiveSelection()!=LB_ERR && m_bDrawTypeList) + BOOL bCont; + int iFirst = 0; + int iLast = 0; + int iCount = getEntryMultipleSelectionStatus(&bCont, &iFirst, &iLast); + + if(iCount <= 0) { - m_pAddressTypeList->SetCurSel(nID); - UpdateHeaderType(); - m_pNameField->SetFocus(); - CNSAddressTypeInfo * pInfo = (CNSAddressTypeInfo*)m_pAddressTypeList->GetItemData(nID); - ASSERT(pInfo); - if (pInfo->GetExclusive()) - { - CString cs; - m_pNameField->GetWindowText(cs); - if (!cs.GetLength()) - m_pNameField->SetWindowText(pInfo->GetValue()); - pInfo->SetHidden(FALSE); - pInfo->SetExclusive(FALSE); - UpdateHeaderContents(); - int iLineLength = m_pNameField->LineLength(); - UpdateWindow(); - m_pNameField->SetSel(iLineLength,iLineLength,TRUE); - } - else - { - CString cs; - m_pAddressTypeList->GetText (nID, cs); - if (!strnicmp(cs,szLoadString(IDS_ADDRESSREPLYTO),strlen(szLoadString(IDS_ADDRESSREPLYTO)))) - pInfo->SetExclusive(TRUE); - else if (!strnicmp(cs,szLoadString(IDS_ADDRESSFOLLOWUPTO), strlen(szLoadString(IDS_ADDRESSFOLLOWUPTO)))) - pInfo->SetExclusive(TRUE); - } + SingleHeaderCommand(nID); + return; } + + int iCurSel = GetActiveSelection(); + + for(int i = iFirst; i <= iLast; i++) + { + if(!isEntrySelected(i)) + continue; + SetActiveSelection(i); + SingleHeaderCommand(nID); + } + + SetActiveSelection(iCurSel); } void CNSAddressList::DoSetFocus(HWND hwnd) @@ -929,10 +1880,14 @@ void CNSAddressList::DoSetFocus(HWND hwnd) if (m_bDrawTypeList) ::ShowWindow(m_pAddressTypeList->m_hWnd, SW_SHOW); m_pNameField->ShowWindow( SW_SHOW ); - if ( GetActiveSelection() == GetCount()-1 ) + + if(m_EntrySelector.WhatEntryBitmapClicked() == -1) + { + if ( GetActiveSelection() == GetCount()-1 ) ::SetFocus(m_pNameField->m_hWnd); else if (m_bDrawTypeList) ::SetFocus(m_pAddressTypeList->m_hWnd); + } } } @@ -1020,8 +1975,9 @@ void CNSAddressList::DrawAddress( int nIndex, CRect &rect, CDC *pDC, BOOL bSelec int iremain = ((rectAddress.Height()-m_pNameField->m_iTextHeight)+1)%2; rectAddress.top += (ioffset+iremain); rectAddress.bottom -= ioffset; - // draw the address type and address name fields - if ( bSelected ) + + // draw the address type and address name fields + if ( bSelected ) { if (m_bDrawTypeList) { @@ -1035,33 +1991,34 @@ void CNSAddressList::DrawAddress( int nIndex, CRect &rect, CDC *pDC, BOOL bSelec int nStart, nEnd; m_pNameField->GetSel(nStart,nEnd); - m_pNameField->SetWindowText(pAddress->GetName()); + + m_pNameField->SetWindowText(pAddress->GetName()); m_pNameField->MoveWindow( rectAddress, FALSE ); - m_pNameField->UpdateWindow(); - m_lastIndex = nIndex; - m_pNameField->SetSel(nStart,nEnd); + m_pNameField->UpdateWindow(); + + m_lastIndex = nIndex; + m_pNameField->SetSel(nStart,nEnd); } if (!bSelected || !m_pNameField->IsWindowVisible()) { - COLORREF cText = pDC->SetTextColor( GetSysColor( COLOR_WINDOWTEXT ) ); - int iMode = pDC->SetBkMode( TRANSPARENT ); - // draw the address + int iMode = pDC->SetBkMode(TRANSPARENT); + + // draw the address pDC->DrawText( pAddress->GetName() ? pAddress->GetName() : "", -1, rectAddress, DT_LEFT | DT_BOTTOM | DT_NOPREFIX ); - pDC->SetTextColor(cText); - pDC->SetBkMode(iMode); - if (m_bDrawTypeList) m_pAddressTypeList->DrawItemSoItLooksLikeAButton( pDC,rectType,CString(pAddress->GetType() ? pAddress->GetType():"")); + pDC->SetTextColor(cText); + pDC->SetBkMode(iMode); } - // end fields + // end fields // draw the bitmap DrawEntryBitmap(nIndex,pAddress,pDC, @@ -1082,7 +2039,7 @@ void CNSAddressList::DrawAddress( int nIndex, CRect &rect, CDC *pDC, BOOL bSelec } DrawGridLine(rect, pDC); - ValidateRect(&rect); + //ValidateRect(&rect); // draw the last line if (m_lastIndex != oldLine) @@ -1163,6 +2120,212 @@ int CNSAddressList::GetItemRect(HWND hwnd, int nIndex, LPRECT lpRect) const return (int)::SendMessage(m_hWnd, LB_GETITEMRECT, nIndex, (LPARAM)lpRect); } +static BOOL IsShiftPressed() +{ + short sShiftState = GetKeyState(VK_SHIFT); + BOOL bDown = (sShiftState < 0); + return bDown; +} + +void CNSAddressList::onKeyDown(int iVirtKey, DWORD dwFlags) +{ + switch (iVirtKey) + { + case VK_TAB: + selectAllEntries(FALSE); + ::SetFocus((m_pNameField->m_hWnd)); + break; + case VK_UP: + case VK_LEFT: + { + if(GetCount() <= 1) + break; + + int iIndex = GetActiveSelection(); + if(iIndex <= 0) + break; + + if(IsShiftPressed()) + { + if(!isEntrySelected(iIndex - 1)) + selectEntry(iIndex - 1, TRUE); + else + selectEntry(iIndex, FALSE); + } + else + { + BOOL bCont; + int iFirst = 0; + int iLast = 0; + + int iCount = getEntryMultipleSelectionStatus(&bCont, &iFirst, &iLast); + + if(iCount < 1) + break; + + if(iCount > 1) + selectAllEntries(FALSE); + else + selectEntry(iIndex, FALSE); + + selectEntry(iIndex - 1, TRUE); + } + break; + } + case VK_DOWN: + case VK_RIGHT: + { + if(GetCount() <= 1) + break; + + int iIndex = GetActiveSelection(); + if(iIndex >= GetCount() - 1) + break; + + if(IsShiftPressed()) + { + if(!isEntrySelected(iIndex + 1)) + selectEntry(iIndex + 1, TRUE); + else + selectEntry(iIndex, FALSE); + } + else + { + BOOL bCont; + int iFirst = 0; + int iLast = 0; + int iCount = getEntryMultipleSelectionStatus(&bCont, &iFirst, &iLast); + + if(iCount < 1) + break; + + if(iCount > 1) + selectAllEntries(FALSE); + else + selectEntry(iIndex, FALSE); + + selectEntry(iIndex + 1, TRUE); + } + break; + } + case VK_DELETE: + case VK_BACK: + { + BOOL bCont; + int iFirst = 0; + int iLast = 0; + int iCount = getEntryMultipleSelectionStatus(&bCont, &iFirst, &iLast); + + for(int i = GetCount() - 1; i >= 0; i--) + { + if(isEntrySelected(i)) + { + if(!DeleteEntry(i)) + break; + } + } + + if(GetCount() == 1) + selectEntry(0, FALSE); + + SetActiveSelection((iLast < GetCount()) ? iLast : GetCount() - 1); + + ::InvalidateRect(m_hWnd, NULL, TRUE); + ::UpdateWindow(m_hWnd); + + ::SetFocus((m_pNameField->m_hWnd)); + + break; + } + default: + break; + } +} + +static HCURSOR setDragYesCursor() +{ + HINSTANCE hInst = +#ifdef _AFXDLL + AfxFindResourceHandle(MAKEINTRESOURCE(IDC_MOVEBUTTON), RT_GROUP_CURSOR); +#else + AfxGetResourceHandle(); +#endif + HCURSOR hCursor = ::LoadCursor(hInst, MAKEINTRESOURCE(IDC_TEXT_MOVE)); + HCURSOR hCursorOld = ::SetCursor(hCursor); + return hCursorOld; +} + +static HCURSOR setDragNoCursor() +{ + HCURSOR hCursor = ::LoadCursor(NULL, IDC_NO); + HCURSOR hCursorOld = ::SetCursor(hCursor); + return hCursorOld; +} + +static BOOL bDrugYesCursor = TRUE; + +void CNSAddressList::onMouseMove(HWND hWnd, WORD wFlags, int iX, int iY) +{ + if(!(wFlags & MK_LBUTTON)) + return; + if((wFlags & MK_CONTROL) || (wFlags & MK_SHIFT)) + return; + if(m_EntrySelector.WhatEntryBitmapClicked() == -1) + return; + + BOOL bCont; + int iFirst = 0; + int iLast = 0; + int iCount = getEntryMultipleSelectionStatus(&bCont, &iFirst, &iLast); + if(iCount == GetCount()) + return; + + if(!m_bDragging) + { + int iDelta = 3; + if((abs(m_EntrySelector.m_iX - iX) <= iDelta) && (abs(m_EntrySelector.m_iY - iY) <= iDelta)) + return; + + ::SetCapture(hWnd); + m_hCursorBackup = setDragYesCursor(); + m_bDragging = TRUE; + } + else + { + RECT rc; + ::GetClientRect(m_hWnd, &rc); + + if((iY < rc.top) || (iY > rc.bottom) || (iX < rc.left) || (iX > rc.right)) + { + if(bDrugYesCursor) + { + setDragNoCursor(); + bDrugYesCursor = FALSE; + } + } + else + { + if(!bDrugYesCursor) + { + setDragYesCursor(); + bDrugYesCursor = TRUE; + } + } + } +} + +static int minFromThree(int i1, int i2, int i3) +{ + int iRes = min(min(i1, i2), i3); + return iRes; +} + +static int maxFromThree(int i1, int i2, int i3) +{ + int iRes = max(max(i1, i2), i3); + return iRes; +} + //=============================================================== OnLButtonDown void CNSAddressList::DoLButtonDown(HWND hwnd, UINT nFlags, LPPOINT lpPoint) { @@ -1170,37 +2333,129 @@ void CNSAddressList::DoLButtonDown(HWND hwnd, UINT nFlags, LPPOINT lpPoint) { BOOL bOutside; int nNewSelect = ItemFromPoint(hwnd, lpPoint, &bOutside ); + + if(!isPointInItemBitmap(lpPoint, nNewSelect)) + { RECT rect; - GetItemRect(m_hWnd,nNewSelect,&rect); - int iHeight = rect.bottom - rect.top; - if (((lpPoint->y+iHeight)/iHeight)+GetTopIndex()>GetCount()) - { - if (GetCount()) - { - CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr(GetCount()-1); - if (!pAddress->GetName()||!strlen(pAddress->GetName())) - { - SetActiveSelection(GetCount()-1); - ::SetFocus(m_pNameField->m_hWnd); - return; - } - } - AppendEntry(); - ::SetFocus(m_pNameField->m_hWnd); - return; - } - SetActiveSelection(nNewSelect); - rect.right = m_iFieldControlWidth; - if ((lpPoint->x >= rect.left) && (lpPoint->x <= rect.right) && - (lpPoint->y >= rect.top) && (lpPoint->y <= rect.bottom)) - { - m_bArrowDown = TRUE; - DisplayTypeList(nNewSelect); - } - else if (lpPoint->x < m_iFieldControlWidth) - ::SetFocus(m_pAddressTypeList->m_hWnd); - else - ::SetFocus(m_pNameField->m_hWnd); + GetItemRect(m_hWnd,nNewSelect,&rect); + int iHeight = rect.bottom - rect.top; + if (((lpPoint->y+iHeight)/iHeight)+GetTopIndex()>GetCount()) + { + if (GetCount()) + { + CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr(GetCount()-1); + if (!pAddress->GetName()||!strlen(pAddress->GetName())) + { + SetActiveSelection(GetCount()-1); + ::SetFocus(m_pNameField->m_hWnd); + return; + } + } + AppendEntry(); + ::SetFocus(m_pNameField->m_hWnd); + return; + } + SetActiveSelection(nNewSelect); + + rect.right = m_iFieldControlWidth; + if ((lpPoint->x >= rect.left) && (lpPoint->x <= rect.right) && + (lpPoint->y >= rect.top) && (lpPoint->y <= rect.bottom)) + { + if(!isEntrySelected(nNewSelect)) + selectAllEntries(FALSE); + + m_bArrowDown = TRUE; + DisplayTypeList(nNewSelect); + } + else if (lpPoint->x < m_iFieldControlWidth) + { + ::SetFocus(m_pAddressTypeList->m_hWnd); + } + else + ::SetFocus(m_pNameField->m_hWnd); + } + else + { + SetActiveSelection(nNewSelect); + + m_EntrySelector.LButtonDown(nNewSelect); + m_EntrySelector.m_iX = (int)lpPoint->x; + m_EntrySelector.m_iY = (int)lpPoint->y; + + if(!(nFlags & MK_CONTROL)) + { + BOOL bCont = FALSE; + int iCount = 0; + int iFirst = 0; + int iLast = 0; + + if(nFlags & MK_SHIFT) + { + iCount = getEntryMultipleSelectionStatus(&bCont, &iFirst, &iLast); + + int iMin = minFromThree(nNewSelect, iFirst, iLast); + int iMax = maxFromThree(nNewSelect, iFirst, iLast); + + int iStart = 0; + int iStop = 0; + + if(iCount == 0) + { + iStart = 0; + iStop = nNewSelect; + } + else if(iCount == 1) + { + iStart = min(iFirst, nNewSelect); + iStop = max(nNewSelect, iLast); + } + else if(nNewSelect == iMin) + { + iStart = nNewSelect; + iStop = iLast; + } + else if(nNewSelect == iMax) + { + iStart = iMin; + iStop = nNewSelect; + } + else + { + iStart = iMin; + iStop = nNewSelect; + } + + selectAllEntries(FALSE); + + for(int i = iStart; i <= iStop; i++) + { + selectEntry(i, TRUE); + } + } + else + { + if(!isEntrySelected(nNewSelect)) + { + selectAllEntries(FALSE); + selectEntry(nNewSelect, TRUE); + } + else + { + iCount = getEntryMultipleSelectionStatus(&bCont, &iFirst, &iLast); + if(!bCont) + { + selectAllEntries(FALSE); + selectEntry(nNewSelect, TRUE); + } + else + m_EntrySelector.m_bPostponedTillButtonUp = TRUE; + } + } + } + ::SetFocus(::GetParent(m_pAddressTypeList->m_hWnd)); + + return; + } } } @@ -1208,6 +2463,98 @@ void CNSAddressList::DoLButtonUp(HWND hwnd, UINT nFlags, LPPOINT lpPoint) { BOOL bOutside; int nNewSelect = ItemFromPoint(hwnd, lpPoint, &bOutside ); + + if(GetCount() > 1) + { + if(isPointInItemBitmap(lpPoint, nNewSelect) && !m_bDragging) + { + if(m_EntrySelector.m_bPostponedTillButtonUp) + { + selectAllEntries(FALSE); + selectEntry(nNewSelect, TRUE); + } + if((nFlags & MK_CONTROL) && (m_EntrySelector.WhatEntryBitmapClicked() == nNewSelect)) + { + selectEntry(nNewSelect, !isEntrySelected(nNewSelect)); + } + } + m_EntrySelector.LButtonUp(); + } + + if(m_bDragging) + { + int iItemHeight = GetItemHeight(0); + BOOL bAtTheVeryEnd = (lpPoint->y > iItemHeight * GetCount()); + + int iInsertBefore = bAtTheVeryEnd ? GetCount() : nNewSelect; + + BOOL bCont = FALSE; + int iCount = 0; + int iFirst = 0; + int iLast = 0; + + iCount = getEntryMultipleSelectionStatus(&bCont, &iFirst, &iLast); + + ASSERT(bCont); + ASSERT(iFirst != -1); + ASSERT(iLast != -1); + + if(!bCont || (iFirst == -1) || (iLast == -1)) + goto DontDrop; + + if((iInsertBefore <= iLast + 1) && (iInsertBefore >= iFirst)) + goto DontDrop; + + { + NSAddressListEntry nsale; + BOOL bDraggingDown = TRUE; + + if(iInsertBefore < iFirst) + bDraggingDown = FALSE; + + int iCount = 0; + + for(int i = iFirst; i <= iLast; i++) + { + if(bDraggingDown) + { + GetEntry(iFirst, &nsale); + InsertEntry(iInsertBefore, &nsale); + selectEntry(iInsertBefore, TRUE); + DeleteEntry(iFirst); + } + else + { + int iCount = i - iFirst; + GetEntry(iFirst + iCount, &nsale); + InsertEntry(iInsertBefore + iCount, &nsale); + selectEntry(iInsertBefore + iCount, TRUE); + DeleteEntry(iFirst + iCount + 1); + } + } + + if(bAtTheVeryEnd) + { + ::InvalidateRect(m_hWnd, NULL, TRUE); + ::UpdateWindow(m_hWnd); + } + } + + if(bAtTheVeryEnd) + { + ::InvalidateRect(m_hWnd, NULL, TRUE); + ::UpdateWindow(m_hWnd); + } + +DontDrop: + if(m_hCursorBackup != NULL) + ::SetCursor(m_hCursorBackup); + ::ReleaseCapture(); + m_bDragging = FALSE; + } + + m_EntrySelector.m_bPostponedTillButtonUp = FALSE; + if ( bOutside ) return; if (m_bArrowDown) @@ -1216,17 +2563,17 @@ void CNSAddressList::DoLButtonUp(HWND hwnd, UINT nFlags, LPPOINT lpPoint) } else { - - // set the selection + if(!isPointInItemBitmap(lpPoint, nNewSelect)) + { + // set the selection if ( nNewSelect != GetActiveSelection() ) - { - SetActiveSelection( nNewSelect ); - } + SetActiveSelection( nNewSelect ); + } // set the focus if (lpPoint->x <= m_iFieldControlWidth) ::SetFocus(m_pAddressTypeList->m_hWnd); - else + else if((!isPointInItemBitmap(lpPoint, nNewSelect)) && (GetCount() > 1)) ::SetFocus(m_pNameField->m_hWnd); } } @@ -1242,7 +2589,7 @@ void CNSAddressList::DoVScroll(HWND hwnd, UINT nSBCode, UINT nPos) void CNSAddressList::DoChildLostFocus() { - if (DoNotifySelectionChange() != -1) + if (DoNotifySelectionChange(FALSE) != -1) DoKillFocus(NULL); } @@ -1257,14 +2604,38 @@ BOOL CNSAddressList::ParseAddressEntry(int nSelection) char * pNames = NULL, * pAddresses = NULL; if (!entry.szName || XP_STRLEN (entry.szName) == 0) return FALSE; - +#ifndef MOZ_NEWADDR char * pName = m_pIAddressParent->NameCompletion((char *)entry.szName); if (pName) { free(pName); return FALSE; } +#endif +#ifdef MOZ_NEWADDR + +// if it's got a cookie and has one result then we don't want to parse it + CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr(GetActiveSelection()); + if (pAddress) + { + AB_NameCompletionCookie *pCookie = pAddress->GetNameCompletionCookie(); + int nNumResults = pAddress->GetNumNameCompletionResults(); + + if(pCookie && nNumResults == 1) + return FALSE; + + //likewise, if we are in show picker mode and we have more than one + //result, we don't want to parse it either. + if(pCookie && nNumResults > 1 && g_MsgPrefs.m_bShowCompletionPicker) + return FALSE; + + //or if we are in show picker mode and don't have a cookie we don't want to + //show it + if(pCookie == NULL && g_MsgPrefs.m_bShowCompletionPicker) + return FALSE; + } +#endif iCount = MSG_ParseRFC822Addresses(entry.szName, &pNames, &pAddresses); if (iCount > 1) { @@ -1273,7 +2644,8 @@ BOOL CNSAddressList::ParseAddressEntry(int nSelection) BOOL bExpanded = FALSE; p1 = pNames; p2 = pAddresses; - LockWindowUpdate(); + + LockWindowUpdate(); for (int i = 0; iSetNameCompletionCookie(pCookie); + // pAddress->SetNumNameCompletionResults(1); + XP_FREE((void*)address.szName); + address.szName = AB_GetHeaderString(pCookie); +#endif address.idEntry = (ULONG)-1; bExpanded = TRUE; InsertEntry(nSelection+i+1,&address, FALSE); + if (m_pIAddressParent) + m_pIAddressParent->AddedItem(m_hWnd, 0, nSelection+i+1); + } if (bExpanded) @@ -1327,7 +2710,7 @@ BOOL CNSAddressList::ParseAddressEntry(int nSelection) return FALSE; } -int CNSAddressList::DoNotifySelectionChange() +int CNSAddressList::DoNotifySelectionChange(BOOL bShowPicker) { int result = TRUE; if (!ParseAddressEntry(GetActiveSelection())) @@ -1348,12 +2731,55 @@ int CNSAddressList::DoNotifySelectionChange() m_pAddressTypeList->GetCurSel()); bExpand = pInfo->GetExpand(); } - if (bExpand) + if (bExpand && m_bExpansion) { CNSAddressInfo *pAddress = (CNSAddressInfo *)GetItemDataPtr(GetActiveSelection()); if (pAddress && pAddress->GetExpansion()) { +#ifdef MOZ_NEWADDR + AB_NameCompletionCookie *pCookie = pAddress->GetNameCompletionCookie(); + int nNumResults = pAddress->GetNumNameCompletionResults(); + BOOL bExpandName = FALSE; + if(pCookie != NULL && nNumResults == 1) + { + pszFullName = AB_GetHeaderString(pCookie); + + } + //if we have multiple matches and preference is set and we've been told it's + //ok to show the picker(i.e. KillFocus doesn't show picker). + else if((pCookie != NULL && nNumResults > 1 && bShowPicker + && g_MsgPrefs.m_bShowCompletionPicker )|| + (pCookie == NULL && nNumResults != 0 && g_MsgPrefs.m_bShowCompletionPicker)) + { + ShowNameCompletionPicker(this); + return -1; + } + //otherwise it's a naked address, so let's append the default domain. + else + { + pCookie = AB_GetNameCompletionCookieForNakedAddress(entry.szName); + pAddress->SetNameCompletionCookie(pCookie); + pAddress->SetNumNameCompletionResults(1); + pszFullName = AB_GetHeaderString(pCookie); + } + + + result = m_pIAddressParent->ChangedItem( + (char*)entry.szName,GetActiveSelection(),m_hWnd, &pszFullName, &entryID, &bitmapID); + if (pszFullName != NULL) + { + pAddress->SetName(pszFullName); + if (bitmapID) + SetItemBitmap(GetActiveSelection(), bitmapID); + if (entryID) + SetItemEntryID(GetActiveSelection(), entryID); + free(pszFullName); + } + StopNameCompletion(-1, FALSE); + + +#else result = m_pIAddressParent->ChangedItem( (char*)entry.szName,GetActiveSelection(),m_hWnd, &pszFullName, &entryID, &bitmapID); if (pszFullName != NULL) @@ -1365,6 +2791,7 @@ int CNSAddressList::DoNotifySelectionChange() SetItemEntryID(GetActiveSelection(), entryID); free(pszFullName); } +#endif } } } @@ -1472,7 +2899,7 @@ int CNSAddressList::AppendEntry( unsigned long idEntry) { if (!szType && !szName && !idBitmap && !idEntry) - return AppendEntry(); + return AppendEntry(NULL, expandName); NSAddressListEntry address; address.szType = szType; address.szName = szName; diff --git a/mozilla/cmd/winfe/nsadrlst.h b/mozilla/cmd/winfe/nsadrlst.h index b07c4adb589..78adb3348e6 100644 --- a/mozilla/cmd/winfe/nsadrlst.h +++ b/mozilla/cmd/winfe/nsadrlst.h @@ -25,9 +25,14 @@ #include "nsadrtyp.h" #include "nsadrnam.h" #include "apiaddr.h" +#include "abcom.h" +#include "apimsg.h" +#include "mailmisc.h" #define NS_ADDRESSFONTSIZE 8 +class CListNameCompletionEntryList; + class CNSAddressTypeInfo { protected: BOOL m_bHidden; @@ -76,6 +81,15 @@ protected: UINT idBitmap; ULONG idEntry; BOOL bAllowExpansion; + AB_NameCompletionCookie* pCookie; + int nNumCompletionResults; + MSG_Pane *pPickerPane; + BOOL bActiveSearch; + NameCompletionEnum eNCEnum; + + + BOOL m_bEntrySelected; + public: CNSAddressInfo() { @@ -84,13 +98,24 @@ public: idBitmap = 0; idEntry = 0xffffffff; bAllowExpansion = FALSE; - } + pCookie = NULL; + nNumCompletionResults = -1; + pPickerPane = NULL; + bActiveSearch = FALSE; + eNCEnum = NC_NameComplete; + + + m_bEntrySelected = FALSE; + + } ~CNSAddressInfo() { if (szType) free(szType); if (szName) free(szName); + if (pCookie) + AB_FreeNameCompletionCookie(pCookie); } char * GetType(void) { return szType; } char * GetName(void) { return szName; } @@ -98,6 +123,17 @@ public: ULONG GetEntryID(void) { return idEntry; } BOOL GetExpansion(void) { return bAllowExpansion; } void SetExpansion(BOOL bExpand) { bAllowExpansion = bExpand; } + + BOOL getEntrySelectedState() + { + return m_bEntrySelected; + } + + void setEntrySelectedState(BOOL bEntrySelected) + { + m_bEntrySelected = bEntrySelected; + } + void SetName(const char *ptr = NULL) { if (szName) @@ -125,6 +161,58 @@ public: { idEntry = id; } + + void SetNameCompletionCookie(AB_NameCompletionCookie *cookie) + { + pCookie = cookie; + } + + AB_NameCompletionCookie *GetNameCompletionCookie() + { + return pCookie; + } + + void SetNumNameCompletionResults(int nNumResults) + { + nNumCompletionResults = nNumResults; + } + + int GetNumNameCompletionResults() + { + return nNumCompletionResults; + } + + void SetPickerPane(MSG_Pane *pickerPane) + { + pPickerPane = pickerPane; + } + + MSG_Pane *GetPickerPane() + { + return pPickerPane; + } + + void SetActiveSearch(BOOL activeSearch) + { + bActiveSearch = activeSearch; + } + + BOOL GetActiveSearch() + { + return bActiveSearch; + } + + void SetNameCompletionEnum(NameCompletionEnum ncEnum) + { + eNCEnum = ncEnum; + } + + NameCompletionEnum GetNameCompletionEnum() + { + return eNCEnum; + } + + }; ///////////////////////////////////////////////////////////////////////// @@ -140,6 +228,132 @@ typedef struct unsigned long idEntry; } NSAddressListEntry; +///////////////////////////////////////////////////////////////// +// Helper object to deal with the whole entry selection +// +class CEntrySelector +{ +private: + int m_iIndex; + +public: + BOOL m_bPostponedTillButtonUp; + int m_iX; + int m_iY; + +public: + CEntrySelector() : m_iIndex(-1), m_bPostponedTillButtonUp(FALSE) {} + ~CEntrySelector(){} + + void LButtonDown(int iIndex) {m_iIndex = iIndex;} + void LButtonUp() {m_iIndex = -1;} + BOOL WhatEntryBitmapClicked() {return m_iIndex;} +}; + +// name completion context +class CListNameCompletionCX: public CStubsCX +{ +protected: + CListNameCompletionEntryList* m_pOwnerList; + + int32 m_lPercent; + BOOL m_bAnimated; + +public: + CListNameCompletionCX(CListNameCompletionEntryList *pOwnerList); + +public: + void SetOwnerList(CListNameCompletionEntryList *pOwnerList); + int32 QueryProgressPercent(); + void SetProgressBarPercent(MWContext *pContext, int32 lPercent); + + void Progress(MWContext *pContext, const char *pMessage); + void AllConnectionsComplete(MWContext *pContext); + + void UpdateStopState( MWContext *pContext ); + + CWnd *GetDialogOwner() const; +}; + +///////////////////////////////////////////////////////////////////////////// +// CListNamecompletionEntryMailFrame +class CListNameCompletionEntryMailFrame: public IMailFrame{ +public: + CListNameCompletionEntryList *m_pParentList; + unsigned long m_ulRefCount; + + // Support for IMailFrame + virtual CMailNewsFrame *GetMailNewsFrame(); + virtual MSG_Pane *GetPane(); + virtual void PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, + MSG_PANE_CHANGED_NOTIFY_CODE, int32 value); + virtual void AttachmentCount(MSG_Pane *messagepane, void* closure, + int32 numattachments, XP_Bool finishedloading) {}; + virtual void UserWantsToSeeAttachments(MSG_Pane *messagepane, void *closure) {}; + + // IUnknown Interface + STDMETHODIMP QueryInterface(REFIID,LPVOID *); + STDMETHODIMP_(ULONG) AddRef(void); + STDMETHODIMP_(ULONG) Release(void); + + CListNameCompletionEntryMailFrame(CListNameCompletionEntryList *pParentList ) { + m_ulRefCount = 0; + m_pParentList = pParentList; + } + + +}; + +///////////////////////////////////////////////////////////////////////////// +// CNameCompletionEntryList + +class CListNameCompletionEntryList: public IMsgList{ +public: + MSG_Pane *m_pPickerPane; + unsigned long m_ulRefCount; + BOOL m_bSearching; + CListNameCompletionEntryMailFrame *m_pMailFrame; + CNSAddressList *m_pList; + + +public: +// IUnknown Interface + STDMETHODIMP QueryInterface(REFIID,LPVOID *); + STDMETHODIMP_(ULONG) AddRef(void); + STDMETHODIMP_(ULONG) Release(void); + +// IMsgList Interface + virtual void ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, MSG_ViewIndex where, + int32 num); + virtual void GetSelection( MSG_Pane* pane, MSG_ViewIndex **indices, int *count, + int *focus); + virtual void SelectItem( MSG_Pane* pane, int item ); + + virtual void CopyMessagesInto( MSG_Pane *pane, MSG_ViewIndex *indices, int count, + MSG_FolderInfo *folderInfo) {} + virtual void MoveMessagesInto( MSG_Pane *pane, MSG_ViewIndex *indices, int count, + MSG_FolderInfo *folderInfo) {} + + + //other functions + void SetProgressBarPercent(int32 lPercent); + void SetStatusText(const char* pMessage); + void AllConnectionsComplete(MWContext *pContext); + CWnd *GetOwnerWindow(); + + CListNameCompletionEntryList( MSG_Pane *pPickerPane, CNSAddressList* pList ) { + m_ulRefCount = 0; + m_pPickerPane = pPickerPane; + m_pList = pList; + m_bSearching = FALSE; + m_pMailFrame = new CListNameCompletionEntryMailFrame(this); + } +}; + ///////////////////////////////////////////////////////////////////////////// // CNSAddressList window @@ -149,6 +363,7 @@ class CNSAddressList : public CListBox, { protected: BOOL m_bParse; + BOOL m_bExpansion; BOOL m_bCreated; HBRUSH m_hBrushNormal; HPEN m_hPenNormal, m_hPenGrid, m_hPenGrey; @@ -166,7 +381,15 @@ protected: int m_lastIndex; LPADDRESSPARENT m_pIAddressParent; int m_iItemHeight; + MWContext * m_pContext; + CListNameCompletionCX * m_pCX; + MSG_Pane * m_pPickerPane; + IMsgList* m_pINameCompList; + CEntrySelector m_EntrySelector; + HCURSOR m_hCursorBackup; + BOOL m_bDragging; + public: CNSAddressList(); // Construction virtual ~CNSAddressList(); @@ -204,7 +427,29 @@ public: virtual void GetTypeInfo(int nIndex, ADDRESS_TYPE_FLAG flag, void ** value); virtual int SetSel(int nIndex, BOOL bSelect); virtual void EnableParsing(BOOL bParse); + virtual BOOL GetEnableParsing(); + virtual void EnableExpansion(BOOL bExpansion); + virtual BOOL GetEnableExpansion(); virtual void SetCSID (int16 csid); + virtual void SetContext(MWContext *pContext); + virtual MWContext *GetContext(); + virtual void ShowNameCompletionPicker(CWnd* pParent); + virtual void StartNameCompletion(int nIndex = -1); + virtual void StopNameCompletion(int nIndex = -1, BOOL bEraseCookie = TRUE); + virtual void StartNameExpansion(int nIndex = -1); + virtual void SetEntryHasNameCompletion(BOOL bHasNameCompletion = TRUE, int nIndex = -1); + virtual BOOL GetEntryHasNameCompletion(int nIndex = -1); + // cookies for name completion -1 = active selection + virtual void SetNameCompletionCookieInfo(AB_NameCompletionCookie *pCookie, int nNumResults, + NameCompletionEnum ncEnum, int nIndex = -1); + virtual void GetNameCompletionCookieInfo(AB_NameCompletionCookie **pCookie, int *pNumResults, int nIndex = -1); + virtual void SearchStarted(); + virtual void SearchStopped(); + virtual void SetProgressBarPercent(int32 lPercent); + virtual void SetStatusText(const char* pMessage); + virtual CWnd *GetOwnerWindow(); + + protected: @@ -217,6 +462,7 @@ protected: int GetTypeFieldLength(void); BOOL ParseAddressEntry(int nSelection); void SetEditField(char * text) { m_pNameField->SetWindowText(text); } + void SingleHeaderCommand(int nID); void HeaderCommand(int nID); void UpdateHeaderType(void); void UpdateHeaderContents(void); @@ -224,6 +470,12 @@ protected: inline int GetActiveSelection() { return GetCurSel(); } int SetActiveSelection(int); + + void selectEntry(int iIndex, BOOL bState); + BOOL isEntrySelected(int iIndex); + void selectAllEntries(BOOL bState); + int getEntryMultipleSelectionStatus(BOOL * pbContinuous, int * piFirst, int * piLast); + virtual LRESULT DefWindowProc( UINT message, WPARAM wParam, LPARAM lParam ); // Overrides @@ -238,6 +490,11 @@ protected: int GetItemRect(HWND hwnd, int nIndex, LPRECT lpRect) const; UINT ItemFromPoint(HWND hwnd, LPPOINT lpPoint, BOOL * bOutside) const; + + BOOL isPointInItemBitmap(LPPOINT pPoint, int iIndex); + void onKeyDown(int iVirtKey, DWORD dwFlags); + void onMouseMove(HWND m_hWnd, WORD wFlags, int iX, int iY); + BOOL DoCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ); BOOL OnKeyPress( CWnd *pChildControl, UINT nChar, UINT nRepCnt, UINT nFlags ); @@ -252,7 +509,7 @@ protected: void DoLButtonDown(HWND hwmd, UINT nFlags, LPPOINT point); void DoVScroll(HWND hwnd, UINT nSBCode, UINT nPos); void DoChildLostFocus(); - int DoNotifySelectionChange(); + int DoNotifySelectionChange(BOOL bShowPicker = TRUE); void DoDisplayTypeList(); friend class CNSAddressNameEditField; @@ -260,6 +517,25 @@ protected: }; +class FENameCompletionCookieInfo { +protected: + CNSAddressList *m_pList; + int m_nIndex; + +public: + FENameCompletionCookieInfo() + { + m_pList = NULL; + m_nIndex = -1; + } + + void SetList(CNSAddressList* pList) {m_pList = pList;} + CNSAddressList *GetList() { return m_pList;} + + void SetIndex(int nIndex) { m_nIndex = nIndex;} + int GetIndex() { return m_nIndex;} +}; + void DrawTransparentBitmap(HDC hdc, HBITMAP hBitmap, short xStart, short yStart, COLORREF cTransparentColor ); void NS_FillSolidRect(HDC hdc, LPCRECT crRect, COLORREF rgbFill); void NS_Draw3dRect(HDC hdc, LPCRECT crRect, COLORREF rgbTL, COLORREF rgbBR); diff --git a/mozilla/cmd/winfe/nsadrnam.cpp b/mozilla/cmd/winfe/nsadrnam.cpp index 0bd9305daf7..5379da5e527 100644 --- a/mozilla/cmd/winfe/nsadrnam.cpp +++ b/mozilla/cmd/winfe/nsadrnam.cpp @@ -24,17 +24,26 @@ #include "nsadrlst.h" #include "nsadrnam.h" #include "addrbook.h" +#include "addrfrm.h" //only need for #ifdef MOZ_NEWADDR +#include "wfemsg.h" ///////////////////////////////////////////////////////////////////////////// // CNSAddressNameEditField -CNSAddressNameEditField::CNSAddressNameEditField() + +CNSAddressNameEditField::CNSAddressNameEditField(CNSAddressList *pParentAddressList) { m_pIAddressParent = NULL; m_bNameCompletion = FALSE; m_bAttemptNameCompletion = TRUE; +#ifdef MOZ_NEWADDR + m_bSetTimerForCompletion = TRUE; +#else m_bSetTimerForCompletion = FALSE; +#endif m_uTypedownClock = 0; + + m_pParentAddressList = pParentAddressList; } CNSAddressNameEditField::~CNSAddressNameEditField() @@ -42,11 +51,97 @@ CNSAddressNameEditField::~CNSAddressNameEditField() } -BOOL CNSAddressNameEditField::Create( CWnd *pParent ) +BOOL CNSAddressNameEditField::Create( CWnd *pParent, MWContext *pContext ) { return CGenericEdit::Create(ES_MULTILINE|ES_WANTRETURN|ES_LEFT|ES_AUTOHSCROLL, CRect(0,0,0,0), pParent, (UINT)IDC_STATIC ); } +static BOOL replaceNewLineWithSpace(LPSTR szString, LPSTR szSource) +{ + BOOL bRet = FALSE; + int iLength = strlen(szSource); + + for(int i = 0, j = 0; i < iLength; i++) + { + if((szSource[i] == '\n') || (szSource[i] == '\r') || (szSource[i] == '\t')) + { + bRet = TRUE; + szString[j] = ' '; + } + else + szString[j] = szSource[i]; + + if((j >= 0) && (szString[j - 1] == ' ') && (szString[j] == ' ')) + continue; + + j++; + } + + szString[j] = '\0'; + + return bRet; +} + +void CNSAddressNameEditField::Paste() +{ + if(!IsClipboardFormatAvailable(CF_TEXT)) + { + CGenericEdit::Paste(); + return; + } + + if(!OpenClipboard()) + { + CGenericEdit::Paste(); + return; + } + + LPSTR psz = (LPSTR)GetClipboardData(CF_TEXT); + + if(psz == NULL) + { + CloseClipboard(); + CGenericEdit::Paste(); + return; + } + + // copy clipboard content for modification + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, strlen(psz) + 1); + LPVOID pData = GlobalLock(hData); + strcpy((LPSTR)pData, psz); + + if(!replaceNewLineWithSpace((LPSTR)pData, psz)) + { + // no modification made + GlobalUnlock(hData); + GlobalFree(hData); + CloseClipboard(); + CGenericEdit::Paste(); + return; + } + + // backup a copy of clipboard content + HGLOBAL hBackup = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, strlen(psz) + 1); + LPVOID pBackup = GlobalLock(hBackup); + strcpy((LPSTR)pBackup, psz); + + GlobalUnlock(hData); + SetClipboardData(CF_TEXT, hData); + + LPSTR pszNew = (LPSTR)GetClipboardData(CF_TEXT); + + CGenericEdit::Paste(); + + // restore clipboard content + GlobalUnlock(hBackup); + SetClipboardData(CF_TEXT, hBackup); + + GlobalFree(hData); + + // we don't free hBackup -- see description of SetClipboardData(...) + + CloseClipboard(); +} BEGIN_MESSAGE_MAP(CNSAddressNameEditField, CGenericEdit) //{{AFX_MSG_MAP(CNSAddressNameEditField) @@ -104,7 +199,19 @@ BOOL CNSAddressNameEditField::PreTranslateMessage( MSG* pMsg ) Copy(); return TRUE; } - } + } +#ifdef MOZ_NEWADDR + else if(pMsg->wParam == 'j' || pMsg->wParam == 'J') + { + //check this on 16 bit + if ( ((CNSAddressList *)GetParent())->OnKeyPress( this, pMsg->wParam, pMsg->lParam & 0x1000, + pMsg->lParam & 0x10000000)) + { + return TRUE; + } + + } +#endif } return CGenericEdit::PreTranslateMessage(pMsg); } @@ -117,13 +224,81 @@ void CNSAddressNameEditField::OnKillFocus(CWnd * pNewWnd) SetSel(0, -1); } +static int howManyAmpersands(char * szString) +{ + if(szString == NULL) + return 0; + + int iCount = 0; + int iLength = strlen(szString); + + for(int i = 0; i < iLength; i++) + { + if(szString[i] == '&') + iCount++; + } + + return iCount; +} + +static char * makeRightAmpersandString(char * szString, int iNumAmp) +{ + if(iNumAmp <= 0) + return NULL; + + int iLength = strlen(szString); + int iRightLength = iLength + iNumAmp; + + char * szRightString = new char[iRightLength + 1]; + + if(szRightString == NULL) + return NULL; + + for(int i = 0, k = 0; i < iLength; i++, k++) + { + if(szString[i] == '&') + szRightString[k++] = '&'; + szRightString[k] = szString[i]; + } + + szRightString[iRightLength] = '\0'; + return szRightString; +} + +static void freeRightAmpersandString(char * szString) +{ + if(szString != NULL) + delete [] szString; +} + void CNSAddressNameEditField::DrawNameCompletion() { if (m_pIAddressParent) { CString cs; GetWindowText(cs); - char * pName = m_pIAddressParent->NameCompletion((char*)((const char *)cs)); + char *pName = NULL; + char *pMultiple = NULL; + +#ifdef MOZ_NEWADDR + + AB_NameCompletionCookie *pCookie; + int nNumResults; + + m_pParentAddressList->GetNameCompletionCookieInfo(&pCookie, &nNumResults); + + if(nNumResults > 1) + { + pMultiple = szLoadString(IDS_MULTIPLE_MATCHES); + } + else if(pCookie && nNumResults == 1) + { + pName = AB_GetNameCompletionDisplayString(pCookie); + } + +#else + pName = m_pIAddressParent->NameCompletion((char*)((const char *)cs)); +#endif CDC * pDC = GetDC(); UINT iPre = cs.GetLength(); CFont * pOldFont = pDC->SelectObject(CFont::FromHandle(m_cfTextFont)); @@ -137,11 +312,35 @@ void CNSAddressNameEditField::DrawNameCompletion() COLORREF crOld = pDC->SetTextColor(RGB(150,150,150)); COLORREF crOldBk = pDC->SetBkColor(GetSysColor(COLOR_WINDOW)); if (iPre < strlen(pName)) - pDC->DrawText(&pName[iPre],strlen(&pName[iPre]),rect,DT_VCENTER|DT_LEFT); + { + int iNumAmp = howManyAmpersands(&pName[iPre]); + if(iNumAmp == 0) + pDC->DrawText(&pName[iPre],strlen(&pName[iPre]),rect,DT_VCENTER|DT_LEFT); + else + { + char * pRightString = makeRightAmpersandString(&pName[iPre], iNumAmp); + if(pRightString != NULL) + { + pDC->DrawText(pRightString,strlen(pRightString),rect,DT_VCENTER|DT_LEFT); + freeRightAmpersandString(pRightString); + } + } + } pDC->SetTextColor(crOld); pDC->SetBkColor(crOldBk); free(pName); } + else if(pMultiple) + { + m_bNameCompletion = FALSE; + m_bNameCompletion = TRUE; + COLORREF crOld = pDC->SetTextColor(RGB(150,150,150)); + COLORREF crOldBk = pDC->SetBkColor(GetSysColor(COLOR_WINDOW)); + pDC->DrawText(pMultiple,strlen(pMultiple),rect,DT_VCENTER|DT_LEFT); + pDC->SetTextColor(crOld); + pDC->SetBkColor(crOldBk); + + } else { m_bNameCompletion = FALSE; @@ -161,10 +360,24 @@ void CNSAddressNameEditField::OnTimer(UINT nID) if (nID == NAME_COMPLETION_TIMER) { KillTimer(m_uTypedownClock); m_uTypedownClock = 0; +#ifdef MOZ_NEWADDR + m_pParentAddressList->StartNameCompletion(); +#else DrawNameCompletion(); +#endif } } +void CNSAddressNameEditField::StopNameCompletion() +{ + if (m_bSetTimerForCompletion) + { + if (m_uTypedownClock) { + KillTimer(m_uTypedownClock); + } + } + +} void CNSAddressNameEditField::OnChar( UINT nChar, UINT nRepCnt, UINT nFlags ) { @@ -185,7 +398,13 @@ void CNSAddressNameEditField::OnChar( UINT nChar, UINT nRepCnt, UINT nFlags ) { if (m_uTypedownClock) { KillTimer(m_uTypedownClock); + } +#ifdef MOZ_NEWADDR + //Also need to kill current search because it's no longer valid + m_pParentAddressList->StopNameCompletion(); +#endif + m_uTypedownClock = SetTimer(NAME_COMPLETION_TIMER, COMPLETION_SPEED, NULL); } else @@ -198,15 +417,18 @@ int CNSAddressNameEditField::OnCreate(LPCREATESTRUCT lpCreateStruct) if (CGenericEdit::OnCreate(lpCreateStruct) == -1) return -1; +#ifndef MOZ_NEWADDR uint32 count; DIR_Server* pab = NULL; + DIR_GetPersonalAddressBook (theApp.m_directories, &pab); if (pab) { AB_GetEntryCount(pab, theApp.m_pABook, &count, ABTypeAll, NULL); if (count > 1500) m_bSetTimerForCompletion = TRUE; } +#endif return 0; } @@ -282,3 +504,4 @@ void CNSAddressNameEditField::OnLButtonDblClk(UINT nFlags, CPoint point) SetSel(0,-1); } + diff --git a/mozilla/cmd/winfe/nsadrnam.h b/mozilla/cmd/winfe/nsadrnam.h index 5cac860169f..d5502b186e1 100644 --- a/mozilla/cmd/winfe/nsadrnam.h +++ b/mozilla/cmd/winfe/nsadrnam.h @@ -26,22 +26,28 @@ ///////////////////////////////////////////////////////////////////////////// // CNSAddressNameEditField window #include "genedit.h" - class CNSAddressNameEditField : public CGenericEdit { // Construction public: - CNSAddressNameEditField(); + CNSAddressNameEditField(CNSAddressList *pParentAddressList); HFONT m_cfTextFont; BOOL m_bNameCompletion; BOOL m_bAttemptNameCompletion; int m_iTextHeight; UINT m_uTypedownClock; BOOL m_bSetTimerForCompletion; + MSG_Pane *m_pPickerPane; + CNSAddressList *m_pParentAddressList; + void StartNameCompletion(void); + void StopNameCompletion(void); void DrawNameCompletion(void); void SetNameCompletionFlag(BOOL bComplete) { m_bAttemptNameCompletion = bComplete; } - BOOL Create( CWnd *pParent ); + BOOL Create( CWnd *pParent, MWContext *pContext ); + + + void Paste(); // Overrides // ClassWizard generated virtual function overrides diff --git a/mozilla/cmd/winfe/nsadrtyp.cpp b/mozilla/cmd/winfe/nsadrtyp.cpp index 345e0b6d97a..ec1ff22804a 100644 --- a/mozilla/cmd/winfe/nsadrtyp.cpp +++ b/mozilla/cmd/winfe/nsadrtyp.cpp @@ -133,9 +133,22 @@ void CNSAddressTypeControl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) void DrawTransparentBitmap(HDC hdc, HBITMAP hBitmap, short xStart, short yStart, COLORREF cTransparentColor ) { -#ifdef FEATURE_DRAWTRANSBITMAP -#include "nsadrtyp.i00" -#endif + HDC hSrcDC = CreateCompatibleDC(hdc); + SelectObject(hSrcDC, hBitmap); + + BITMAP bm; + GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); + + POINT ptSize; + ptSize.x = bm.bmWidth; + ptSize.y = bm.bmHeight; + DPtoLP(hSrcDC, &ptSize, 1); + + HPALETTE hPalette = (HPALETTE)GetCurrentObject(hdc, OBJ_PAL); + + FEU_TransBlt(hdc, xStart, yStart, ptSize.x, ptSize.y, hSrcDC, 0, 0, hPalette, cTransparentColor); + + DeleteDC(hSrcDC); } int CNSAddressTypeControl::OnCreate(LPCREATESTRUCT lpCreateStruct) diff --git a/mozilla/cmd/winfe/nsapp.cpp b/mozilla/cmd/winfe/nsapp.cpp index 1a76e02637c..d24c9088ca9 100644 --- a/mozilla/cmd/winfe/nsapp.cpp +++ b/mozilla/cmd/winfe/nsapp.cpp @@ -57,6 +57,10 @@ #include "navfram.h" #include "secnav.h" +#ifdef MOZ_OFFLINE +#include "offlndlg.h" +#endif /* MOZ_OFFLINE */ + #include "pw_public.h" extern "C" { #include "cookies.h" @@ -174,6 +178,7 @@ CNetscapeApp::CNetscapeApp() m_bCreateNews = FALSE; #endif /* MOZ_MAIL_NEWS */ m_bCreateNetcaster = FALSE; + m_bCreateCalendar = FALSE; #ifdef MOZ_MAIL_NEWS m_bCreateInbox = FALSE;//causes the inbox to be started m_bCreateFolders = FALSE;//causes the folders frame window to be started @@ -214,6 +219,11 @@ CNetscapeApp::CNetscapeApp() m_bExitStatus = FALSE; InitTime(); +#ifdef MOZ_MAIL_NEWS + m_bCreateInboxMAPI = FALSE; // rhp - for MAPI + m_bCreateNABWin = FALSE; // rhp - for Address Book API +#endif /* MOZ_MAIL_NEWS */ + #ifdef XP_WIN16 m_nMsgLast = WM_NULL; ::GetCursorPos(&m_ptCursorLast); @@ -405,6 +415,9 @@ void CNetscapeApp::parseCommandLine(char * commandLine) m_bCreateNews = TRUE; #endif /* MOZ_MAIL_NEWS */ + if(IsRuntimeSwitch("-calendar",TRUE)) + m_bCreateCalendar = TRUE; + if(IsRuntimeSwitch("-new_profile",TRUE)) m_bCreateNewProfile = TRUE; @@ -1428,20 +1441,55 @@ void CNetscapeApp::OnAppSuperExit() void CNetscapeApp::OnAppExit() { + int iExit = IDOK; - // if more than one top level window prompt to make sure they - // want to exit - if(m_pFrameList && m_pFrameList->m_pNext) { - int iExit = ::MessageBox(NULL, - szLoadString(IDS_CLOSEWINDOWS_EXIT), - szLoadString(IDS_EXIT_CONFIRMATION), - MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2); +#ifdef MOZ_OFFLINE + // Check prompt synchronization preference. If set bring up + // prompt otherwise, bring up regular dialog. - // false alarm, user didn't really want to exit - if(IDNO == iExit) - return; + XP_Bool promptSynch = TRUE; + PREF_GetBoolPref("offline.prompt_synch_on_exit", &promptSynch); + - } + if(promptSynch) + { + CAskSynchronizeExitDlg synchPromptDlg; + + iExit = synchPromptDlg.DoModal(); + // false alarm, user didn't really want to exit + if(iExit == IDCANCEL) + { + return; + } + else if(iExit == IDYES) + { + if(CanCloseAllFrames()) + { + m_bSynchronizingExit = TRUE; + WFE_Synchronize(NULL, TRUE); + } + return; + } + } + else + { +#endif /* MOZ_OFFLINE */ + // if more than one top level window prompt to make sure they + // want to exit + if(m_pFrameList && m_pFrameList->m_pNext){ + iExit = ::MessageBox(NULL, + szLoadString(IDS_CLOSEWINDOWS_EXIT), + szLoadString(IDS_EXIT_CONFIRMATION), + MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2); + + // false alarm, user didn't really want to exit + if(IDNO == iExit) + return; + + } +#ifdef MOZ_OFFLINE + } +#endif /* MOZ_OFFLINE */ CommonAppExit(); } @@ -1452,31 +1500,43 @@ void CNetscapeApp::CommonAppExit() // Make sure each frame window really does want to close for (CGenericFrame *pFrame = m_pFrameList; NULL != pFrame; pFrame = pFrame->m_pNext) { CDocument* pDocument = pFrame->GetActiveDocument(); + } - if (pDocument && !pDocument->CanCloseFrame(pFrame)) { - // Document doesn't want to close so don't close any of the frames +#ifdef MOZ_OFFLINE + //if we are synchronizing on exit then we've already checked this. + if(!m_bSynchronizingExit) + { +#endif /* MOZ_OFFLINE */ + // Make sure each frame window really does want to close + for (pFrame = m_pFrameList; NULL != pFrame; pFrame = pFrame->m_pNext) { + CDocument* pDocument = pFrame->GetActiveDocument(); - // Clear the flags previously set - // so we prompt to save edit changes next time we try to close - CGenericFrame *pCurrentFrame = pFrame; - for (pFrame = m_pFrameList; pCurrentFrame != pFrame; pFrame = pFrame->m_pNext) { - pFrame->m_bSkipSaveEditChanges = FALSE; - } + if (pDocument && !pDocument->CanCloseFrame(pFrame)) { + // Document doesn't want to close so don't close any of the frames - // We aren't going to close -- get out! - return; + // Clear the flags previously set + // so we prompt to save edit changes next time we try to close + CGenericFrame *pCurrentFrame = pFrame; + for (pFrame = m_pFrameList; pCurrentFrame != pFrame; pFrame = pFrame->m_pNext) { + pFrame->m_bSkipSaveEditChanges = FALSE; + } + + // We aren't going to close -- get out! + return; + } + // Set flag to prevent prompting for saving edit changes + // in CEditFrame::OnClose() since this was done in CanCloseFrame() + pFrame->m_bSkipSaveEditChanges = TRUE; } - // Set flag to prevent prompting for saving edit changes - // in CEditFrame::OnClose() since this was done in CanCloseFrame() - pFrame->m_bSkipSaveEditChanges = TRUE; +#ifdef MOZ_OFFLINE } +#endif /* MOZ_OFFLINE */ // Set wether or not the app is exiting. m_bExit = TRUE; #ifdef MOZ_MAIL_NEWS WFE_MSGSearchClose(); - WFE_MSGLDAPSearchClose(); #endif /* MOZ_MAIL_NEWS */ // Go through each frame, closing it.... @@ -1491,89 +1551,82 @@ void CNetscapeApp::CommonAppExit() } -#ifdef MOZ_LOC_INDEP -// LI_STUFF start -// REMIND: This is all experimental stuff which will get cleaned up and moved when -// we are done -void putFileClosure(void * closure, LIStatus result) +#ifdef MOZ_OFFLINE +BOOL CNetscapeApp::CanCloseAllFrames() { - LIActive = 0; -} + for (CGenericFrame *pFrame = m_pFrameList; NULL != pFrame; pFrame = pFrame->m_pNext) { + CDocument* pDocument = pFrame->GetActiveDocument(); -void putCookieFileClosure(void * closure, LIStatus result) -{ - // a cheesy place to put this. until I do clients - LIActive --; - -} + if (pDocument && !pDocument->CanCloseFrame(pFrame)) { + // Document doesn't want to close so don't close any of the frames -void getCookieFileClosure(void * closure, LIStatus result, XP_Bool fileExists) -{ - if (fileExists) { - /* remove and reset the cookies. */ - NET_RemoveAllCookies(); - NET_ReadCookies(""); - } -} + // Clear the flags previously set + // so we prompt to save edit changes next time we try to close + CGenericFrame *pCurrentFrame = pFrame; + for (pFrame = m_pFrameList; pCurrentFrame != pFrame; pFrame = pFrame->m_pNext) { + pFrame->m_bSkipSaveEditChanges = FALSE; + } -BOOL CNetscapeApp::LIStuffEnd() { - static BOOL beenHere = FALSE; - - /* if li is active then go through this to upload stuff, - when the uploads are done, isliactive gets set to false. - */ - if (LIActive > 0) { - if (beenHere) - return FALSE; - - //To save the prefs before the upload all: - char * prefName = WH_FileName(NULL, xpLIPrefs); - PREF_SaveLIPrefFile(prefName); - XP_FREEIF (prefName); - - LIMediator::uploadAll(putFileClosure, NULL); - beenHere = TRUE; - - - /* don't close the browser yet */ - return FALSE; - } - /* ok to close browser */ - return TRUE; -} - -void LIStuff() { - char * lifilename ; - BOOL prefBool; - - PREF_GetBoolPref("li.enabled", &LIActive); - - if (LIActive > 0) { - PREF_GetDefaultBoolPref("li.client.bookmarks", &prefBool); - if (prefBool) { - //BM_SetModified(theApp.m_pBmContext, FALSE); // REMIND - still needed? - //LIFile * file = new LIFile (theApp.m_pBookmarkFile,"bookmarks", "Bookmarks File"); - //file->startGettingIfNecessary(getBookmarkFileClosure, file); + // We aren't going to close -- get out! + return FALSE; } - //else - // BM_ReadBookmarksFromDisk(theApp.m_pBmContext, theApp.m_pBookmarkFile, NULL ); - // RDF is going to have to be hooked up here. (Dave H.) - // WORK STILL NEEDS TO BE DONE + // Set flag to prevent prompting for saving edit changes + // in CEditFrame::OnClose() since this was done in CanCloseFrame() + pFrame->m_bSkipSaveEditChanges = TRUE; + } + + if(theApp.m_pBookmarks != NULL && ::IsWindow(theApp.m_pBookmarks->m_hWnd)) + { + if(WS_DISABLED & ::GetWindowLong(theApp.m_pBookmarks->m_hWnd, GWL_STYLE)) + { + return FALSE; + } + } + + return TRUE; + +} + +void CNetscapeApp::HideFrames() +{ + + // Go through each frame and hide it + CGenericFrame *pFrame; + CGenericFrame *pNext = NULL; + for(pFrame = m_pFrameList; NULL != pFrame; pFrame = pNext) { + + // Extract the frame from the list. + pNext = pFrame->m_pNext; + + //Hide all of it's children + CWnd *pDesktop = CWnd::GetDesktopWindow(); + if(pDesktop) + { + CWnd* pChild = pDesktop->GetWindow(GW_CHILD); + while(pChild != NULL) + { + if(pChild->GetParent() == pFrame) + { + pChild->ShowWindow(SW_HIDE); + } + pChild = pChild->GetNextWindow(); - PREF_GetDefaultBoolPref("li.client.cookies", &prefBool); - if (prefBool) { - lifilename = WH_FileName("", xpHTTPCookie); - if (lifilename) { - LIFile * file2 = new LIFile (lifilename, "cookies", "Cookies File"); - file2->startGettingIfNecessary(getCookieFileClosure, file2); - XP_FREE(lifilename); } } + + pFrame->ShowWindow(SW_HIDE); + } + + if(theApp.m_pBookmarks != NULL && ::IsWindow(theApp.m_pBookmarks->m_hWnd)) + { + theApp.m_pBookmarks->ShowWindow(SW_HIDE); } - //else - // BM_ReadBookmarksFromDisk(theApp.m_pBmContext, theApp.m_pBookmarkFile, NULL ); + + //if there's a search frame then close it + WFE_MSGSearchClose(); } -#endif // MOZ_LOC_INDEP +#endif /* MOZ_OFFLINE */ + ///////////////////////////////////////////////////////////////////////////// // CNetscapeApp commands @@ -1589,10 +1642,6 @@ int CNetscapeApp::Run() BOOL bIdle = TRUE; LONG lIdleCount = 0; -#ifdef MOZ_LOC_INDEP - LIStuff(); -#endif // MOZ_LOC_INDEP - for(;;) { while(bIdle && !::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE)) { if (!OnIdle(lIdleCount++)) diff --git a/mozilla/cmd/winfe/nscpmapi.h b/mozilla/cmd/winfe/nscpmapi.h index 43205e36ddd..4be006c9eea 100644 --- a/mozilla/cmd/winfe/nscpmapi.h +++ b/mozilla/cmd/winfe/nscpmapi.h @@ -32,6 +32,8 @@ typedef unsigned char UCHAR; #endif +#define MAPI_CUSTOM_COMPOSE_MSG "NSCP_CUSTOM_MAPI_MESSAGE" +#define MAPI_CUSTOM_RET_CODE 1966 #define MAX_NAME_LEN 256 #define MAX_PW_LEN 256 @@ -93,7 +95,7 @@ public: // Defines needed for requests being made with the WM_COPYDATA call... // typedef enum { - NSCP_MAPIStartRequestID = 0, + NSCP_MAPIStartRequestID = 100, NSCP_MAPILogon, NSCP_MAPILogoff, NSCP_MAPIFree, @@ -106,6 +108,7 @@ typedef enum { NSCP_MAPIAddress, NSCP_MAPIDetails, NSCP_MAPIResolveName, + NSCP_MAPI_NSCP_SynchronizeClient, NSCP_MAPIEndRequestID // Note: this is a marker for MAPI IPC requests } NSCP_IPC_REQUEST; @@ -329,4 +332,10 @@ typedef struct { // } MAPIAddressType; +typedef struct { + LHANDLE lhSession; + ULONG ulUIParam; + DWORD ipcWorked; // Necessary for IPC check with Communicator +} MAPI_NSCP_SynchronizeClientType; + #endif // _NSCPMAPI diff --git a/mozilla/cmd/winfe/outliner.cpp b/mozilla/cmd/winfe/outliner.cpp index 6c98576b76f..1e7d571218a 100644 --- a/mozilla/cmd/winfe/outliner.cpp +++ b/mozilla/cmd/winfe/outliner.cpp @@ -162,10 +162,12 @@ COutliner::COutliner ( BOOL bUseTriggerAndLineBitmaps ) m_iTotalWidth = 0; m_idImageCol = 0; m_bHasPipes = TRUE; + m_bHasImageOnlyColumn = FALSE; m_pDropTarget = NULL; m_bDraggingData = FALSE; m_bClearOnRelease = FALSE; m_bSelectOnRelease = FALSE; + m_bLButtonDown = FALSE; m_pTip = new CTip(); m_pTip->Create(); @@ -492,6 +494,16 @@ void COutliner::LoadXPPrefs( const char *prefname ) GetParent()->Invalidate(); } +BOOL COutliner::GetIsColumnVisible( int columnID ) +{ + for (int i = 0; i < m_iVisColumns; i++) { + if ((UINT) columnID == GetColumnAtPos(i)) + return TRUE; + } + return FALSE; +} + + void COutliner::SaveXPPrefs( const char *prefname ) { CString cs, cs2; @@ -822,6 +834,8 @@ void COutliner::OnRButtonDown ( UINT nFlags, CPoint point ) CWnd::OnRButtonDown ( nFlags, point ); m_ptHit = point; int iSel = m_iTopLine + (point.y / m_itemHeight); + if (iSel >= m_iTotalLines) // Nothing to select + return; SelectItem( iSel, OUTLINER_RBUTTONDOWN ); } @@ -962,6 +976,11 @@ void COutliner::OnLButtonDown ( UINT nFlags, CPoint point ) if ( ColumnCommand( m_pColumn[ iCol ]->iCommand, iRow) ) return; + //Set m_bLButtonDown = true when really select an item, + //use in CFolderOutliner and CMessageOutliner for checking + //double click before really load a folder or message. + //Other outliner should not care for it. + m_bLButtonDown = TRUE; SetCapture(); SelectItem( iRow, OUTLINER_LBUTTONDOWN, nFlags ); } @@ -2017,7 +2036,9 @@ void COutliner::PaintLine ( int iLineNo, HDC hdc, LPRECT lpPaintRect ) if ( rectInter.IntersectRect ( &rectColumn, lpPaintRect ) ) { ::FillRect(hdc, &rectColumn, (HBRUSH) GetCurrentObject(hdc, OBJ_BRUSH)); - if ( m_pColumn[ iColumn ]->iCommand == m_idImageCol ) { + //if this is the image column and it also has text in it then call DrawPipes + // but if it's only an image, don't call DrawPipes. + if ( m_pColumn[ iColumn ]->iCommand == m_idImageCol && !m_bHasImageOnlyColumn ) { rectColumn.left = DrawPipes ( iLineNo, iColumn, offset, hdc, pLineData ); rectColumn.left += OUTLINE_TEXT_OFFSET; } @@ -2490,7 +2511,7 @@ LONG COutliner::OnProcessOLQAHook(WPARAM wParam, LPARAM lParam) void *pLineData = AcquireLineData ( lineNumber ); // Make this a parameter... memset(workLine, 0, sizeof(workLine)); - for (i=0; iiCommand, pLineData ); if (!colText) @@ -2556,6 +2577,7 @@ void CMSelectOutliner::ClearSelection() int i; for (i = 0; i < m_iIndicesCount; i++ ) { InvalidateLine(CASTINT(m_pIndices[i])); + m_pIndices[i] = 0; } m_iIndicesCount = 0; } @@ -2584,7 +2606,7 @@ void CMSelectOutliner::AddSelection( MSG_ViewIndex iSel ) m_pIndices = tmp; m_iIndicesSize *= 2; } - if (iSel >= 0 && iSel < m_iTotalLines) { + if (iSel >= 0 && iSel < (MSG_ViewIndex) m_iTotalLines) { m_pIndices[i] = iSel; m_iIndicesCount++; } @@ -2685,6 +2707,7 @@ BOOL CMSelectOutliner::HandleInsert( MSG_ViewIndex iStart, int32 iCount ) iCount++; } InvalidateLines( CASTINT(iStart), CASTINT(m_iTotalLines - iStart + iCount)); + EnableScrollBars(); return FALSE; } @@ -2755,6 +2778,7 @@ BOOL CMSelectOutliner::HandleDelete( MSG_ViewIndex iStart, int32 iCount ) iCount++; } InvalidateLines(CASTINT(iStart), CASTINT(m_iTotalLines - iStart + iCount)); + EnableScrollBars(); return res; } @@ -2836,6 +2860,12 @@ void CMSelectOutliner::PositionPageUp( ) } } +void CMSelectOutliner::SetMultipleSelection(BOOL bMultipleSelection) +{ + m_bNoMultiSel = !bMultipleSelection; +} + + void CMSelectOutliner::SetTotalLines ( int iLines ) { COutliner::SetTotalLines( iLines ); @@ -2997,7 +3027,7 @@ COutlinerDropTarget::COutlinerDropTarget( COutliner *pOutliner ) void COutlinerDropTarget::DragScroll( BOOL bBackwards ) { DWORD dwTicks = GetTickCount(); - if (!dwTicks || (dwTicks - m_dwOldTicks) > m_pOutliner->GetDragHeartbeat()) { + if (!dwTicks || (dwTicks - m_dwOldTicks) > (DWORD) m_pOutliner->GetDragHeartbeat()) { if (dwTicks) { m_pOutliner->OnVScroll(bBackwards ? SB_LINEUP : SB_LINEDOWN, 0, 0); m_pOutliner->UpdateWindow(); @@ -3934,7 +3964,7 @@ void COutlinerParent::OnPaint ( ) { HBRUSH hBrush = NULL; if (GetFocus() == m_pOutliner) - hBrush = ::CreateSolidBrush( GetSysColor( COLOR_HIGHLIGHT ) ); + hBrush = ::CreateSolidBrush( RGB(0, 0, 0) ); else hBrush = ::CreateSolidBrush( GetSysColor( COLOR_WINDOW ) ); diff --git a/mozilla/cmd/winfe/outliner.h b/mozilla/cmd/winfe/outliner.h index 8896c24fb5a..b4959cbb467 100644 --- a/mozilla/cmd/winfe/outliner.h +++ b/mozilla/cmd/winfe/outliner.h @@ -117,6 +117,7 @@ protected: int m_iPaintLines; UINT m_idImageCol; BOOL m_bHasPipes; + BOOL m_bHasImageOnlyColumn; int m_iCSID; @@ -143,6 +144,7 @@ protected: BOOL m_bClearOnRelease; BOOL m_bSelectOnRelease; + BOOL m_bLButtonDown; int m_iTotalWidth; @@ -292,10 +294,15 @@ public: void SetImageColumn( UINT idCol ) { m_idImageCol = idCol; } void SetHasPipes( BOOL bPipes ) { m_bHasPipes = bPipes; } + //Sometimes you want to distinguish between a column that only has an + //image versus one that has both text and image. + void SetHasImageOnlyColumn(Bool bImageOnly) {m_bHasImageOnlyColumn = bImageOnly;} int GetNumColumns() { return m_iNumColumns; } void SetVisibleColumns( UINT iVisCol ) { m_iVisColumns = iVisCol; } UINT GetVisibleColumns() { return m_iVisColumns; } + int GetNumberVisibleRows() { return m_iPaintLines; } + BOOL GetIsColumnVisible( int columnID ); void LoadXPPrefs( const char *prefname ); void SaveXPPrefs( const char *prefname ); @@ -376,12 +383,15 @@ public: virtual void SelectItem ( int iSel, int mode = OUTLINER_SET, UINT flags = 0 ); virtual void SelectRange( int iStart, int iEnd, BOOL bNotify ); + //multiple selection is on by default + virtual void SetMultipleSelection(BOOL bMultipleSelection); + protected: - void AddSelection( MSG_ViewIndex iSel ); - void SelectRange( MSG_ViewIndex iSelBegin, MSG_ViewIndex iSelEnd ); - void RemoveSelection( MSG_ViewIndex iSel ); - void RemoveSelectionRange( MSG_ViewIndex iSelBegin, MSG_ViewIndex iSelEnd ); - void ClearSelection(); + virtual void AddSelection( MSG_ViewIndex iSel ); + virtual void SelectRange( MSG_ViewIndex iSelBegin, MSG_ViewIndex iSelEnd ); + virtual void RemoveSelection( MSG_ViewIndex iSel ); + virtual void RemoveSelectionRange( MSG_ViewIndex iSelBegin, MSG_ViewIndex iSelEnd ); + virtual void ClearSelection(); virtual BOOL HandleInsert( MSG_ViewIndex iStart, LONG iCount ); virtual BOOL HandleDelete( MSG_ViewIndex iStart, LONG iCount ); diff --git a/mozilla/cmd/winfe/popup.cpp b/mozilla/cmd/winfe/popup.cpp index 945db9aa181..970f0af97d3 100755 --- a/mozilla/cmd/winfe/popup.cpp +++ b/mozilla/cmd/winfe/popup.cpp @@ -420,6 +420,7 @@ void CNetscapeView::AddBrowserItemsToPopup(CMenu * pMenu, LO_Element * pElement, pMenu->AppendMenu((SHIST_GetCurrent(&(pContext->hist)) != NULL) ? MF_ENABLED : MF_GRAYED, ID_POPUP_MAILTO, szLoadString(IDS_POPUP_SENDPAGE)); + } void CNetscapeView::AddNavigateItemsToPopup(CMenu *pMenu, LO_Element * pElement, CL_Layer *layer) @@ -573,7 +574,8 @@ public: virtual void SetText(LPCSTR lpszText) {} }; -void CNetscapeView::CreateMessagePopup(CMenu * pMenu, LO_Element * pElement, CL_Layer *layer) +void CNetscapeView::CreateMessagePopup(CMenu * pMenu, LO_Element * pElement, CL_Layer *layer, + MWContext *pContext) { BOOL bAddSeparator = FALSE; // @@ -605,7 +607,7 @@ void CNetscapeView::CreateMessagePopup(CMenu * pMenu, LO_Element * pElement, CL_ BOOL bNews = cmdUI.m_bEnabled; #ifdef MOZ_MAIL_NEWS - WFE_MSGBuildMessagePopup( pMenu->m_hMenu, bNews ); + WFE_MSGBuildMessagePopup( pMenu->m_hMenu, bNews, FALSE, pContext ); #endif /* MOZ_MAIL_NEWS */ } @@ -667,7 +669,7 @@ BOOL CNetscapeView::OnRButtonDownForLayer(UINT uFlags, CPoint& cpPoint, // These two shouldn't occur case MWContextNewsMsg: case MWContextNews: - CreateMessagePopup(&cmPopup, pElement, layer); + CreateMessagePopup(&cmPopup, pElement, layer, GetContext()->GetContext()); break; default: // just fall through and show the browser popup even though it diff --git a/mozilla/cmd/winfe/prefinfo.cpp b/mozilla/cmd/winfe/prefinfo.cpp index 60916e9aa0d..60d142aa194 100644 --- a/mozilla/cmd/winfe/prefinfo.cpp +++ b/mozilla/cmd/winfe/prefinfo.cpp @@ -21,6 +21,9 @@ #include "prefapi.h" #include "edt.h" #include "prefs.h" +#ifdef MOZ_OFFLINE +#include "statbar.h" +#endif //MOZ_OFFLINE int PR_CALLBACK prefWatcher(const char *pPrefName, void *pData) { @@ -132,6 +135,22 @@ int PR_CALLBACK SetToolbarButtonStyle(const char *newPref, void *data) return PREF_NOERROR; } +#ifdef MOZ_OFFLINE +int PR_CALLBACK HandleOnlineStateChange(const char*newPref, void *data) +{ + int count = CNetscapeStatusBar::gStatusBars.GetSize(); + + for(int i = 0; i < count; i++) + { + HWND hWnd = (HWND)CNetscapeStatusBar::gStatusBars.GetAt(i); + ::SendMessage(hWnd, WM_IDLEUPDATECMDUI, (WPARAM)TRUE, (LPARAM)0); + + } + + return PREF_NOERROR; +} +#endif //MOZ_OFFLINE + CPrefInfo prefInfo; CPrefInfo::CPrefInfo() @@ -246,5 +265,9 @@ void CPrefInfo::Initialize() theApp.m_pToolbarStyle = CASTINT(prefInt); PREF_RegisterCallback("browser.chrome.button_style", SetToolbarButtonStyle, NULL); +#ifdef MOZ_OFFLINE + //Online state + PREF_RegisterCallback("network.online", HandleOnlineStateChange, NULL); +#endif //MOZ_OFFLINE } diff --git a/mozilla/cmd/winfe/prefs.cpp b/mozilla/cmd/winfe/prefs.cpp index c0447ae481d..6f2799471c8 100644 --- a/mozilla/cmd/winfe/prefs.cpp +++ b/mozilla/cmd/winfe/prefs.cpp @@ -50,9 +50,6 @@ #include "mnprefs.h" #include "mailmisc.h" #include "wfemsg.h" -#endif /* MOZ_MAIL_NEWS */ -#include "dlgseldg.h" -#ifdef MOZ_MAIL_NEWS #include "addrbook.h" #include "addrfrm.h" // for creating vcards #ifdef FEATURE_ADDRPROP @@ -63,6 +60,9 @@ #include "VerReg.h" #include "softupdt.h" #endif /* MOZ_SMARTUPDATE */ +#ifdef MOZ_OFFLINE +#include "offpkdlg.h" +#endif // MOZ_OFFLINE extern "C" { #include "xpgetstr.h" @@ -82,9 +82,13 @@ extern int MK_MSG_REMOVE_MAILHOST_CONFIRM; BOOL g_bReloadAllWindows; +#ifdef MOZ_MAIL_NEWS extern "C" void GetFolderServerNames (char* lpName, int nDefaultID, CString& folder, CString& server); extern "C" MSG_Host *DoAddNewsServer(CWnd* pParent, int nFromWhere); +#endif + +extern "C" char *FE_GetProgramDirectory(char *buffer, int length); ///////////////////////////////////////////////////////////////////////////// // Helper functions @@ -860,7 +864,7 @@ CAppearancePrefs::GetCurrentCharset(LPDWORD pdwCharsetNum) class CMailNewsPreferences : public IMailNewsInterface { public: - CMailNewsPreferences(); + CMailNewsPreferences(MWContext *pContext); ~CMailNewsPreferences(); // IUnknown methods @@ -880,18 +884,20 @@ class CMailNewsPreferences : public IMailNewsInterface { STDMETHODIMP GetFolderServer(LPOLESTR lpFolderPath, DWORD dwType, LPOLESTR *lpFolder, LPOLESTR *lpServer); - STDMETHODIMP FillNewsServerList(HWND hControl, LPOLESTR lpServerName); - STDMETHODIMP GetNewsServerName(HWND hControl, LPOLESTR *lpServerName); + STDMETHODIMP FillNewsServerList(HWND hControl, LPOLESTR lpServerName, LPVOID FAR* ppServer); STDMETHODIMP_(BOOL) AddNewsServer(HWND hParent, HWND hControl); STDMETHODIMP_(BOOL) EditNewsServer(HWND hParent, HWND hControl, BOOL *pChanged); - STDMETHODIMP DeleteNewsServer(HWND hParent, HWND hControl); + STDMETHODIMP DeleteNewsServer(HWND hParent, HWND hControl, LPVOID FAR* lpDefault); STDMETHODIMP_(BOOL) AddMailServer(HWND hParent, HWND hControl, BOOL bAllowBoth, DWORD dwType); STDMETHODIMP_(BOOL) EditMailServer(HWND hParent, HWND hControl, BOOL bAllowBoth, DWORD dwType); STDMETHODIMP_(BOOL) DeleteMailServer(HWND hParent, HWND hControl, DWORD dwType); + STDMETHODIMP SetImapDefaultServer(HWND hControl); STDMETHODIMP FillLdapDirList(HWND hControl, LPOLESTR lpServerName); STDMETHODIMP SetLdapDirAutoComplete(HWND hControl, BOOL bOnOrOff); + STDMETHODIMP SaveLdapDirAutoComplete(); + // Initialization routine to create contained and aggregated objects HRESULT Init(); @@ -908,12 +914,13 @@ class CMailNewsPreferences : public IMailNewsInterface { HFONT m_hFont, m_hBoldFont; XP_List *m_pLdapServers; MSG_NewsHost** m_hNewsHost; + MWContext *m_pContext; }; ///////////////////////////////////////////////////////////////////////////// // CMailNewsPreferences -CMailNewsPreferences::CMailNewsPreferences() +CMailNewsPreferences::CMailNewsPreferences(MWContext *pContext) { m_uRef = 0; m_pCategory = NULL; @@ -923,10 +930,9 @@ CMailNewsPreferences::CMailNewsPreferences() m_hBoldFont = NULL; m_pLdapServers = NULL; m_hNewsHost = NULL; - char location[256]; int nLen = 255; - + m_pContext = pContext; m_pLdapServers = XP_ListNew(); PREF_GetDefaultCharPref("browser.addressbook_location", location, &nLen); DIR_GetServerPreferences (&m_pLdapServers, location); @@ -943,7 +949,6 @@ CMailNewsPreferences::~CMailNewsPreferences() theApp.ReleaseAppFont(m_hBoldFont); if (m_pLdapServers) { - DIR_DeleteServerList(m_pLdapServers); m_pLdapServers = NULL; } if (m_hNewsHost) @@ -1036,11 +1041,21 @@ CMailNewsPreferences::CreateAddressBookCard(HWND hParent) formattedString.Format(XP_GetString (MK_ADDR_BOOK_CARD), name); else formattedString = XP_GetString (MK_ADDR_NEW_CARD); +#ifndef MOZ_NEWADDR CAddrEditProperties prop(NULL, pab, (const char *) formattedString, &parent, 0, &person); prop.SetCurrentPage(0); if (prop.DoModal() == IDCANCEL) result = FALSE; +#else + MSG_Pane *pPane = NULL; + AB_GetIdentityPropertySheet(m_pContext, WFE_MSGGetMaster(), + &pPane); + CAddrEditProperties prop(NULL, (const char *) formattedString, + &parent, pPane, m_pContext, TRUE); + if(prop.DoModal() == IDCANCEL) + result = FALSE; +#endif } else { @@ -1086,19 +1101,38 @@ CMailNewsPreferences::EditAddressBookCard(HWND hParent) char fullname [kMaxFullNameLength]; AB_GetFullName(pab, theApp.m_pABook, entryID, fullname); formattedString.Format(XP_GetString (MK_ADDR_BOOK_CARD), fullname); +#ifndef MOZ_NEWADDR CAddrEditProperties prop(NULL, pab, (const char *) formattedString, &parent, entryID); prop.SetCurrentPage(0); prop.DoModal(); +#else + MSG_Pane *pPane = NULL; + AB_GetIdentityPropertySheet(m_pContext, WFE_MSGGetMaster(), + &pPane); + CAddrEditProperties prop(NULL, (const char *) formattedString, + &parent, pPane, m_pContext); + prop.DoModal(); +#endif } else { CString formattedString; formattedString.Format(XP_GetString (MK_ADDR_BOOK_CARD), name); +#ifndef MOZ_NEWADDR CAddrEditProperties prop(NULL, pab, (const char *) formattedString, &parent, 0, &person); prop.SetCurrentPage(0); prop.DoModal(); +#else + MSG_Pane *pPane = NULL; + AB_GetIdentityPropertySheet(m_pContext, WFE_MSGGetMaster(), + &pPane); + CAddrEditProperties prop(NULL, (const char *) formattedString, + &parent, pPane, m_pContext); + prop.DoModal(); + +#endif } } @@ -1163,16 +1197,9 @@ STDMETHODIMP CMailNewsPreferences::ShowChooseFolder LPOLESTR *lpServer, LPOLESTR *lpPref) { char* lpPath = (char*)lpFolderPath; - int nDefaultID; - if (dwType == TYPE_SENT) - nDefaultID = MK_MSG_SENT_L10N_NAME; - else if (dwType == TYPE_DRAFT) - nDefaultID = MK_MSG_DRAFTS_L10N_NAME; - else if (dwType == TYPE_TEMPLATE) - nDefaultID = MK_MSG_TEMPLATES_L10N_NAME; CWnd parent; parent.Attach(hParent); - CChooseFolderDialog folderDialog(&parent, lpPath, nDefaultID); + CChooseFolderDialog folderDialog(&parent, lpPath, (int)dwType); if (IDOK == folderDialog.DoModal()) { *lpFolder = AllocTaskOleString(LPCTSTR(folderDialog.m_szFolder)); @@ -1191,7 +1218,7 @@ STDMETHODIMP CMailNewsPreferences::GetFolderServer char* lpPath = (char*)lpFolderPath; int nDefaultID; - if (dwType == TYPE_SENT) + if (dwType == TYPE_SENTMAIL || dwType == TYPE_SENTNEWS) nDefaultID = MK_MSG_SENT_L10N_NAME; else if (dwType == TYPE_DRAFT) nDefaultID = MK_MSG_DRAFTS_L10N_NAME; @@ -1211,7 +1238,8 @@ STDMETHODIMP CMailNewsPreferences::GetFolderServer return NOERROR; } -STDMETHODIMP CMailNewsPreferences::FillNewsServerList(HWND hControl, LPOLESTR lpServerName) +STDMETHODIMP CMailNewsPreferences::FillNewsServerList +(HWND hControl, LPOLESTR lpServerName, LPVOID FAR* ppServer) { int nDefaultHost = 0; int nSelectedIndex = -1; @@ -1233,7 +1261,10 @@ STDMETHODIMP CMailNewsPreferences::FillNewsServerList(HWND hControl, LPOLESTR lp (LPARAM)(DWORD)m_hNewsHost[i]); const char *pName = MSG_GetNewsHostUIName(m_hNewsHost[i]); if (!XP_FILENAMECMP(lpPrefName, pName)) + { nSelectedIndex = nAddedIndex; + *ppServer = m_hNewsHost[i]; + } } } if (nSelectedIndex >= 0) @@ -1242,19 +1273,6 @@ STDMETHODIMP CMailNewsPreferences::FillNewsServerList(HWND hControl, LPOLESTR lp return NOERROR; } -STDMETHODIMP -CMailNewsPreferences::GetNewsServerName(HWND hControl, LPOLESTR *lpServerName) -{ - int nIndex = (int)SendMessage(hControl, LB_GETCURSEL, 0,0); - if (nIndex != CB_ERR) - { - MSG_NewsHost* pServer = (MSG_NewsHost*)SendMessage(hControl, LB_GETITEMDATA, - (WPARAM)nIndex, 0); - *lpServerName = AllocTaskOleString(MSG_GetHostUIName((MSG_Host*)pServer)); - } - return NOERROR; -} - STDMETHODIMP_(BOOL) CMailNewsPreferences::AddNewsServer(HWND hParent, HWND hControl) { @@ -1287,51 +1305,60 @@ CMailNewsPreferences::EditNewsServer(HWND hParent, HWND hControl, BOOL *pChanged if (nIndex >= 0) { parent.Attach(hParent); - MSG_Host* pServer = (MSG_Host*)SendMessage(hControl, LB_GETITEMDATA, + MSG_NewsHost* pServer = (MSG_NewsHost*)SendMessage(hControl, LB_GETITEMDATA, (WPARAM)nIndex, 0); + MSG_Host* pMsgHost = MSG_GetMSGHostFromNewsHost(pServer); - CNewsServerDialog addServerDialog(&parent, MSG_GetHostUIName(pServer), - FROM_PREFERENCE, (MSG_NewsHost*)pServer); - if (IDOK == addServerDialog.DoModal()) - { - char* pName = addServerDialog.GetNewsHostName(); - XP_Bool bSecure = addServerDialog.GetSecure(); - XP_Bool bAuthentication = addServerDialog.GetAuthentication(); - int32 nPort = addServerDialog.GetNewsHostPort(); - - // set the new value - MSG_SetNewsHostPushAuth ((MSG_NewsHost*)pServer, bAuthentication); - + CString csTitle; + csTitle.LoadString(IDS_NEWSHOSTPROP); + CNewsFolderPropertySheet editServerDialog(csTitle, &parent); + MSG_FolderInfo *pFolderInfo = MSG_GetFolderInfoForHost(pMsgHost); + editServerDialog.m_pNewsHostPage= new CNewsHostGeneralPropertyPage; + editServerDialog.m_pNewsHostPage->SetFolderInfo(pFolderInfo, pServer); + editServerDialog.AddPage(editServerDialog.m_pNewsHostPage); + if (IDOK == editServerDialog.DoModal()) *pChanged = TRUE; - parent.Detach(); - return TRUE; - } - else - { - parent.Detach(); - return FALSE; - } + + parent.Detach(); + } return FALSE; } -STDMETHODIMP CMailNewsPreferences::DeleteNewsServer(HWND hParent, HWND hControl) +STDMETHODIMP CMailNewsPreferences::DeleteNewsServer +(HWND hParent, HWND hControl, LPVOID FAR* lpDefault) { CWnd parent; parent.Attach(hParent); + + MSG_NewsHost* pDefaultServer = (MSG_NewsHost*)(*lpDefault); int nIndex = (int)SendMessage(hControl, LB_GETCURSEL, 0, 0); if (nIndex >= 0) { - MSG_Host* pServer = (MSG_Host*)SendMessage(hControl, LB_GETITEMDATA, - (WPARAM)nIndex, 0); + MSG_NewsHost* pServer = (MSG_NewsHost*)SendMessage(hControl, LB_GETITEMDATA, + (WPARAM)nIndex, 0); + MSG_Host* pMsgHost = MSG_GetMSGHostFromNewsHost(pServer); + char* tmp = PR_smprintf(XP_GetString(MK_MSG_REMOVE_HOST_CONFIRM), - MSG_GetHostUIName(pServer)); + MSG_GetHostUIName(pMsgHost)); if (IDOK == parent.MessageBox(tmp, szLoadString(AFX_IDS_APP_TITLE), MB_OKCANCEL)) { MSG_Master * pMaster = WFE_MSGGetMaster(); - MSG_DeleteNewsHost(pMaster, (MSG_NewsHost*)pServer); + MSG_DeleteNewsHost(pMaster, pServer); SendMessage(hControl, LB_DELETESTRING, nIndex, 0); + if (pDefaultServer == pServer) + { + int nNewDefault; + int nTotal = (int)SendMessage(hControl, LB_GETCOUNT, 0, 0); + if (nIndex >= nTotal) + nNewDefault = nTotal -1; + else + nNewDefault = nIndex; + + *lpDefault = (LPVOID)SendMessage(hControl, LB_GETITEMDATA, + (WPARAM)nNewDefault, 0); + } } if(tmp && tmp[0]) XP_FREE(tmp); @@ -1357,7 +1384,7 @@ STDMETHODIMP_(BOOL) CMailNewsPreferences::AddMailServer } CString title; - title.LoadString(IDS_ADD_MAIL_SERVER); + title.LoadString(IDS_MAIL_SERVER_PROPERTY); CMailServerPropertySheet addMailServer(&parent, title, NULL, TYPE_IMAP, FALSE, bAllowBoth); if (IDOK == addMailServer.DoModal()) { @@ -1390,12 +1417,24 @@ STDMETHODIMP_(BOOL) CMailNewsPreferences::EditMailServer int nIndex = (int)SendMessage(hControl, LB_GETCURSEL, 0, 0); SendMessage(hControl, LB_GETTEXT, (WPARAM)nIndex, (LPARAM)(DWORD)serverName); + + char* pDefault = XP_STRSTR(serverName, szLoadString(IDS_DEFAULT_STRING)); + if (pDefault) + *pDefault = '\0'; //get rid of (Default) CMailServerPropertySheet editMailServer(&parent, title, serverName, nType, TRUE, bAllowBoth); if (IDOK == editMailServer.DoModal()) { PREF_SavePrefFile(); + + char* pNewName = editMailServer.GetMailHostName(); + if ((nType == TYPE_POP && 0 != lstrcmp(pNewName, serverName)) || + (nType == TYPE_IMAP && editMailServer.IsPopServer())) + { + SendMessage(hControl, LB_DELETESTRING, nIndex, 0); + SendMessage(hControl, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)pNewName); + } parent.Detach(); return TRUE; } @@ -1421,7 +1460,7 @@ STDMETHODIMP_(BOOL) CMailNewsPreferences::DeleteMailServer int nIndex = (int)SendMessage(hControl, LB_GETCURSEL, 0, 0); int nType = (int)dwType; - if (nType = TYPE_IMAP) + if (nType == TYPE_IMAP) { char serverName[MSG_MAXGROUPNAMELENGTH]; @@ -1430,6 +1469,9 @@ STDMETHODIMP_(BOOL) CMailNewsPreferences::DeleteMailServer SendMessage(hControl, LB_GETTEXT, (WPARAM)nIndex, (LPARAM)(DWORD)serverName); + char* pDefault = XP_STRSTR(serverName, szLoadString(IDS_DEFAULT_STRING)); + if (pDefault) + *pDefault = '\0'; //get rid of (Default) int nTotal = MSG_GetIMAPHosts(pMaster, NULL, 0); if (nTotal) { @@ -1441,7 +1483,10 @@ STDMETHODIMP_(BOOL) CMailNewsPreferences::DeleteMailServer { MSG_Host* pMsgHost = MSG_GetMSGHostFromIMAPHost(hImapHost[i]); if (0 == lstrcmp(serverName, MSG_GetHostName(pMsgHost))) + { MSG_DeleteIMAPHost(pMaster, hImapHost[i]); + break; + } } if (hImapHost) delete [] hImapHost; @@ -1454,6 +1499,35 @@ STDMETHODIMP_(BOOL) CMailNewsPreferences::DeleteMailServer return TRUE; } +STDMETHODIMP CMailNewsPreferences::SetImapDefaultServer(HWND hControl) +{ + char serverName[MSG_MAXGROUPNAMELENGTH]; + SendMessage(hControl, LB_GETTEXT, (WPARAM)0, (LPARAM)(DWORD)serverName); + + MSG_Master* pMaster = WFE_MSGGetMaster(); + + int nTotal = MSG_GetIMAPHosts(pMaster, NULL, 0); + if (nTotal) + { + MSG_IMAPHost** hImapHost = NULL; + hImapHost = new MSG_IMAPHost* [nTotal]; + ASSERT(hImapHost != NULL); + nTotal = MSG_GetIMAPHosts(pMaster, hImapHost, nTotal); + for (int i = 0; i < nTotal; i++) + { + MSG_Host* pMsgHost = MSG_GetMSGHostFromIMAPHost(hImapHost[i]); + if (XP_STRSTR(serverName, MSG_GetHostName(pMsgHost))) + { + MSG_ReorderIMAPHost(pMaster, hImapHost[i], NULL); + break; + } + } + if (hImapHost) + delete [] hImapHost; + } + return NOERROR; +} + STDMETHODIMP CMailNewsPreferences::FillLdapDirList(HWND hControl, LPOLESTR lpServerName) { if (0 == XP_ListCount(m_pLdapServers)) @@ -1491,6 +1565,12 @@ STDMETHODIMP CMailNewsPreferences::SetLdapDirAutoComplete(HWND hControl, BOOL bO return NOERROR; } + +STDMETHODIMP CMailNewsPreferences::SaveLdapDirAutoComplete() +{ + DIR_SaveServerPreferences(m_pLdapServers); + return NOERROR; +} #endif /* MOZ_MAIL_NEWS */ #ifdef MOZ_OFFLINE @@ -1579,7 +1659,7 @@ COfflinePreference::DoSelectDiscussion(HWND hParent) parent.Attach(hParent); - CDlgSelectGroups selDiscussionDlg(&parent); + CDlgOfflinePicker selDiscussionDlg(&parent); selDiscussionDlg.DoModal(); parent.Detach(); @@ -1587,14 +1667,67 @@ COfflinePreference::DoSelectDiscussion(HWND hParent) } #endif // MOZ_OFFLINE +typedef HRESULT (*DllServerFunction)(void); + +static BOOL +RegisterCLSIDForDll(char * dllName) +{ + BOOL bRetval = FALSE; + char szLib[_MAX_PATH + 32]; + FE_GetProgramDirectory( szLib, _MAX_PATH + 32 ); + if ( *szLib ) { + strcat( szLib, dllName ); + + if(szLib) { + HINSTANCE hLibInstance = hLibInstance = LoadLibrary(szLib); +#ifdef WIN32 + if(hLibInstance) +#else + if(hLibInstance > (HINSTANCE)HINSTANCE_ERROR) +#endif + { + FARPROC RegistryFunc = NULL; + + RegistryFunc = ::GetProcAddress(hLibInstance, "DllRegisterServer"); + + if(RegistryFunc) { + HRESULT hResult = (RegistryFunc)(); + + if(GetScode(hResult) == S_OK) { + bRetval = TRUE; + } + + RegistryFunc = NULL; + } + else { + /* If the DLL doesn't have those functions then it just doesn't support + * self-registration. We don't consider that to be an error + * + * We should consider checking for the "OleSelfRegister" string in the + * StringFileInfo section of the version information resource. If the DLL + * has "OleSelfRegister" but doesn't have the self-registration functions + * then that would be an error + */ + bRetval = TRUE; + } + + FreeLibrary(hLibInstance); + hLibInstance = NULL; + } + } + } + + return bRetval; +} + #ifdef MOZ_MAIL_NEWS static BOOL -CreateMailNewsCategory(LPSPECIFYPROPERTYPAGEOBJECTS *pCategory) +CreateMailNewsCategory(MWContext *pContext, LPSPECIFYPROPERTYPAGEOBJECTS *pCategory) { BOOL bResult = FALSE; // Create the property page providers - CMailNewsPreferences *pMailNews = new CMailNewsPreferences; + CMailNewsPreferences *pMailNews = new CMailNewsPreferences(pContext); pMailNews->AddRef(); // Initialize the mail news object. This allows it to load any objects that are @@ -1604,6 +1737,23 @@ CreateMailNewsCategory(LPSPECIFYPROPERTYPAGEOBJECTS *pCategory) if (SUCCEEDED(pMailNews->QueryInterface(IID_ISpecifyPropertyPageObjects, (LPVOID *)pCategory))) bResult = TRUE; } + else { + // Try to register the dll and initialize again +#ifdef _WIN32 + bResult = RegisterCLSIDForDll("mnpref32.dll"); +#else + bResult = RegisterCLSIDForDll("mnpref16.dll"); +#endif + if (bResult) { + if (SUCCEEDED(pMailNews->Init())) { + // Get the interface pointer for ISpecifyPropertyPageObjects + if (SUCCEEDED(pMailNews->QueryInterface(IID_ISpecifyPropertyPageObjects, (LPVOID *)pCategory))) + bResult = TRUE; + } + else + bResult = FALSE; + } + } // We're all done with the object pMailNews->Release(); @@ -1611,7 +1761,6 @@ CreateMailNewsCategory(LPSPECIFYPROPERTYPAGEOBJECTS *pCategory) } #endif /* MOZ_MAIL_NEWS */ - #ifdef MOZ_LOC_INDEP ///////////////////////////////////////////////////////////////////////////// // CLIPreference @@ -1900,6 +2049,23 @@ CreateAppearancesCategory(int nCharsetId, LPSPECIFYPROPERTYPAGEOBJECTS *pCategor if (SUCCEEDED(pAppearance->QueryInterface(IID_ISpecifyPropertyPageObjects, (LPVOID *)pCategory))) bResult = TRUE; } + else { + // Try to register the dll and initialize again +#ifdef _WIN32 + bResult = RegisterCLSIDForDll("brpref32.dll"); +#else + bResult = RegisterCLSIDForDll("brpref16.dll"); +#endif + if (bResult) { + if (SUCCEEDED(pAppearance->Init())) { + // Get the interface pointer for ISpecifyPropertyPageObjects + if (SUCCEEDED(pAppearance->QueryInterface(IID_ISpecifyPropertyPageObjects, (LPVOID *)pCategory))) + bResult = TRUE; + } + else + bResult = FALSE; + } + } // We're all done with the object pAppearance->Release(); @@ -1925,12 +2091,59 @@ CreateBrowserCategory(MWContext *pContext, LPSPECIFYPROPERTYPAGEOBJECTS *pCatego if (SUCCEEDED(pBrowser->QueryInterface(IID_ISpecifyPropertyPageObjects, (LPVOID *)pCategory))) bResult = TRUE; } + else { + // Try to register the dll and initialize again +#ifdef _WIN32 + bResult = RegisterCLSIDForDll("brpref32.dll"); +#else + bResult = RegisterCLSIDForDll("brpref16.dll"); +#endif + if (bResult) { + if (SUCCEEDED(pBrowser->Init())) { + // Get the interface pointer for ISpecifyPropertyPageObjects + if (SUCCEEDED(pBrowser->QueryInterface(IID_ISpecifyPropertyPageObjects, (LPVOID *)pCategory))) + bResult = TRUE; + } + else + bResult = FALSE; + } + } // We're all done with the object pBrowser->Release(); return bResult; } +#ifdef EDITOR +static BOOL +CreateComposerCategory(LPSPECIFYPROPERTYPAGEOBJECTS *pCategory) +{ + if (SUCCEEDED(CoCreateInstance(CLSID_EditorPrefs, + NULL, + CLSCTX_INPROC_SERVER, + IID_ISpecifyPropertyPageObjects, + (LPVOID *)pCategory))) { + return TRUE; + } + else { + // Try to register the dll and initialize again +#ifdef _WIN32 + if (RegisterCLSIDForDll("edpref32.dll")) { +#else + if (RegisterCLSIDForDll("edpref16.dll")) { +#endif + if (SUCCEEDED(CoCreateInstance(CLSID_EditorPrefs, + NULL, + CLSCTX_INPROC_SERVER, + IID_ISpecifyPropertyPageObjects, + (LPVOID *)pCategory))) { + return TRUE; + } + } + } + return FALSE; +} +#endif /* EDITOR */ #ifdef MOZ_OFFLINE static BOOL @@ -1949,7 +2162,24 @@ CreateOfflineCategory(LPSPECIFYPROPERTYPAGEOBJECTS *pCategory) if (SUCCEEDED(pOffline->QueryInterface(IID_ISpecifyPropertyPageObjects, (LPVOID *)pCategory))) bResult = TRUE; } - + else { + // Try to register the dll and initialize again +#ifdef _WIN32 + bResult = RegisterCLSIDForDll("mnpref32.dll"); +#else + bResult = RegisterCLSIDForDll("mnpref16.dll"); +#endif + if (bResult) { + if (SUCCEEDED(pOffline->Init())) { + // Get the interface pointer for ISpecifyPropertyPageObjects + if (SUCCEEDED(pOffline->QueryInterface(IID_ISpecifyPropertyPageObjects, (LPVOID *)pCategory))) + bResult = TRUE; + } + else + bResult = FALSE; + } + } + // We're all done with the object pOffline->Release(); return bResult; @@ -2073,7 +2303,7 @@ wfe_DisplayPreferences(CGenericFrame *pFrame) #ifdef MOZ_MAIL_NEWS // Mail and News category - if (CreateMailNewsCategory(&categories[nCategories])) + if (CreateMailNewsCategory(pContext, &categories[nCategories])) nCategories++; #endif // MOZ_MAIL_NEWS @@ -2103,8 +2333,8 @@ wfe_DisplayPreferences(CGenericFrame *pFrame) // Advanced category if (CreateAdvancedCategory(pContext, &categories[nCategories])) { nCategories++; - } - + } + // Make sure we have at least one category if (nCategories == 0) { pFrame->MessageBox(szLoadString(IDS_CANT_LOAD_PREFS), NULL, MB_OK | MB_ICONEXCLAMATION); diff --git a/mozilla/cmd/winfe/prefs/brpref/src/advpages.cpp b/mozilla/cmd/winfe/prefs/brpref/src/advpages.cpp index 0de14706c18..aa67c2ca56a 100644 --- a/mozilla/cmd/winfe/prefs/brpref/src/advpages.cpp +++ b/mozilla/cmd/winfe/prefs/brpref/src/advpages.cpp @@ -985,4 +985,4 @@ CSmartUpdatePrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) return CBrowserPropertyPage::OnCommand(id, hwndCtl, notifyCode); } -#endif /* MOZ_SMARTUPDATE */ \ No newline at end of file +#endif /* MOZ_SMARTUPDATE */======= diff --git a/mozilla/cmd/winfe/prefs/brpref/src/brpages.cpp b/mozilla/cmd/winfe/prefs/brpref/src/brpages.cpp index f231d4b05e6..88a945b585f 100644 --- a/mozilla/cmd/winfe/prefs/brpref/src/brpages.cpp +++ b/mozilla/cmd/winfe/prefs/brpref/src/brpages.cpp @@ -939,6 +939,10 @@ class CEditTypeDialog : public CDialog { BOOL m_bConfirmBeforeOpening; CString m_strOpenCmd; BOOL m_bURLProtocol; +#ifdef MOZ_MAIL_NEWS + int m_UseAsDefaultMIMEType; + BOOL m_LockDefaultMIMEType; +#endif /* MOZ_MAIL_NEWS */ private: void CheckControls(); @@ -949,6 +953,10 @@ CEditTypeDialog::CEditTypeDialog() { m_bConfirmBeforeOpening = TRUE; m_bURLProtocol = FALSE; +#ifdef MOZ_MAIL_NEWS + m_UseAsDefaultMIMEType = 0; // initialized later from the caller, which knows about extension lists + m_LockDefaultMIMEType = FALSE; // initialized later from the caller, which knows about extension lists +#endif /* MOZ_MAIL_NEWS */ } BOOL @@ -976,8 +984,19 @@ CEditTypeDialog::InitDialog() EnableDlgItem(IDC_EDIT1, FALSE); EnableDlgItem(IDC_RADIO2, FALSE); EnableDlgItem(IDC_CHECK1, FALSE); +#ifdef MOZ_MAIL_NEWS + EnableDlgItem(IDC_USEASDEFAULT, FALSE); +#endif /* MOZ_MAIL_NEWS */ } +#ifdef MOZ_MAIL_NEWS + // Check for locked preferences + if (m_LockDefaultMIMEType) { + // Disable the "Set this type as the default" pref + EnableDlgItem(IDC_USEASDEFAULT, FALSE); + } +#endif /* MOZ_MAIL_NEWS */ + return CDialog::InitDialog(); } @@ -1020,6 +1039,9 @@ CEditTypeDialog::DoTransfer(BOOL bSaveAndValidate) EditFieldTransfer(IDC_EDIT1, m_strMimeType, bSaveAndValidate); EditFieldTransfer(IDC_EDIT2, m_strOpenCmd, bSaveAndValidate); CheckBoxTransfer(IDC_CHECK1, m_bConfirmBeforeOpening, bSaveAndValidate); +#ifdef MOZ_MAIL_NEWS + CheckBoxTransfer(IDC_USEASDEFAULT, m_UseAsDefaultMIMEType, bSaveAndValidate); +#endif /* MOZ_MAIL_NEWS */ if (bSaveAndValidate) { // Map it back to the values the browser uses @@ -1066,6 +1088,22 @@ CEditTypeDialog::OnCommand(int id, HWND hwndCtl, UINT notifyCode) // file should be enabled CheckControls(); } +#ifdef MOZ_MAIL_NEWS + else if (id == IDC_USEASDEFAULT && notifyCode == BN_CLICKED) + { + // handle tri-state silliness + if (m_UseAsDefaultMIMEType == 0 || m_UseAsDefaultMIMEType == 2) // off, or partial + { + m_UseAsDefaultMIMEType = 1; // set it on for all of them + } + else + { + m_UseAsDefaultMIMEType = 0; // it was on; set it to off. + } + CheckBoxTransfer(IDC_USEASDEFAULT, m_UseAsDefaultMIMEType, FALSE); + return TRUE; + } +#endif /* MOZ_MAIL_NEWS */ return CDialog::OnCommand(id, hwndCtl, notifyCode); } @@ -1088,6 +1126,9 @@ class CNewTypeDialog : public CDialog { CString m_strExtension; CString m_strMimeType; CString m_strOpenCmd; +#ifdef MOZ_MAIL_NEWS + int m_UseAsDefaultMIMEType; +#endif /* MOZ_MAIL_NEWS */ private: void DisplayMessageBox(UINT nID); @@ -1096,6 +1137,9 @@ class CNewTypeDialog : public CDialog { CNewTypeDialog::CNewTypeDialog() : CDialog(CComDll::m_hInstance, IDD_NEW_TYPE) { +#ifdef MOZ_MAIL_NEWS + m_UseAsDefaultMIMEType = 0; +#endif /* MOZ_MAIL_NEWS */ } void @@ -1149,6 +1193,9 @@ CNewTypeDialog::DoTransfer(BOOL bSaveAndValidate) EditFieldTransfer(IDC_EDIT2, m_strExtension, bSaveAndValidate); EditFieldTransfer(IDC_EDIT3, m_strMimeType, bSaveAndValidate); EditFieldTransfer(IDC_EDIT4, m_strOpenCmd, bSaveAndValidate); +#ifdef MOZ_MAIL_NEWS + CheckBoxTransfer(IDC_USEASDEFAULT, m_UseAsDefaultMIMEType, bSaveAndValidate); +#endif /* MOZ_MAIL_NEWS */ // Validate the data if (bSaveAndValidate) { @@ -1440,6 +1487,83 @@ BuildExtensionList(NET_cdataStruct *pcdata, CString &strExts) strExts.MakeUpper(); } +#ifdef MOZ_MAIL_NEWS +// Scans through prefs for the extensions listed in cdata, and sees whether or +// not this is the default outgoing MIME type for the given list. If all in the +// list say it is the default, returns 1. If none do, returns 0. If some do and +// some don't, returns 2. +static int +GetDefaultMIMEStateFromExtensionList(NET_cdataStruct *pcdata) +{ + BOOL someDefaultsFound = FALSE, someNonDefaultsFound = FALSE; + int i = 0; + + while (i < pcdata->num_exts) + { + BOOL defaultFound = FALSE; + CString pref("mime.table.extension."); + pref += CString(pcdata->exts[i]); + pref += CString(".outgoing_default_type"); + CString defaultMimeTypeFromPrefs; + PREF_GetStringPref(pref, defaultMimeTypeFromPrefs); + defaultFound = (defaultMimeTypeFromPrefs.CompareNoCase(pcdata->ci.type) == 0); + + someDefaultsFound = someDefaultsFound || defaultFound; + someNonDefaultsFound = someNonDefaultsFound || !defaultFound; + i++; + } + + if (someDefaultsFound && someNonDefaultsFound) + return 2; + else if (someDefaultsFound && !someNonDefaultsFound) + return 1; + else // none in the list, or none are the default + return 0; +} + +static void +SetDefaultMIMEStateFromExtensionList(NET_cdataStruct *pcdata, int newState) +{ + int i = 0; + + if (newState != 0 && newState != 1) + return; + + while (i < pcdata->num_exts) + { + CString pref("mime.table.extension."); + pref += CString(pcdata->exts[i]); + pref += CString(".outgoing_default_type"); + CString defaultMimeTypeFromPrefs; + if (newState == 1) + PREF_SetCharPref(pref, pcdata->ci.type); + else + PREF_ClearUserPref(pref); + i++; + } +} + +// Scans through prefs for the extensions listed in cdata, and sees whether or +// not those preferences are locked down. If any of them are, returns TRUE, otherwise FALSE. +static BOOL +GetDefaultMIMEStateLockedFromExtensionList(NET_cdataStruct *pcdata) +{ + BOOL locked = FALSE; + int i = 0; + + while (i < pcdata->num_exts && !locked) + { + CString pref("mime.table.extension."); + pref += CString(pcdata->exts[i]); + pref += (".outgoing_default_type"); + locked = PREF_PrefIsLocked(pref); + i++; + } + + return locked; +} +#endif /* MOZ_MAIL_NEWS */ + static HICON GetNavigatorAppIcon(HINSTANCE hInstance) { @@ -1681,9 +1805,22 @@ CApplicationsPrefs::OnEditItem() // Build the file extension list BuildExtensionList(cdata, dlg.m_strExtension); +#ifdef MOZ_MAIL_NEWS + int originalUseAsDefaultMIMEType = GetDefaultMIMEStateFromExtensionList(cdata); + dlg.m_UseAsDefaultMIMEType = originalUseAsDefaultMIMEType; + dlg.m_LockDefaultMIMEType = GetDefaultMIMEStateLockedFromExtensionList(cdata); +#endif /* MOZ_MAIL_NEWS */ // Display the dialog if (dlg.DoModal(GetParent(m_hwndDlg)) == IDOK) { + +#ifdef MOZ_MAIL_NEWS + if (originalUseAsDefaultMIMEType != dlg.m_UseAsDefaultMIMEType) + { + SetDefaultMIMEStateFromExtensionList(cdata, dlg.m_UseAsDefaultMIMEType); + } +#endif /* MOZ_MAIL_NEWS */ + if (!cdata->ci.fe_data) { CString strDescription; @@ -1753,6 +1890,17 @@ CApplicationsPrefs::OnNewItem() nIndex = ListBox_AddString(hList, cdata->ci.desc); ListBox_SetItemData(hList, nIndex, cdata); +#ifdef MOZ_MAIL_NEWS + if (dlg.m_UseAsDefaultMIMEType) + { + CString pref("mime.table.extension."); + pref += CString(dlg.m_strExtension); + pref += CString(".outgoing_default_type"); + if (!PREF_PrefIsLocked(pref)) + PREF_SetCharPref(pref, dlg.m_strMimeType); + } +#endif /* MOZ_MAIL_NEWS */ + // Select the item and update the file details ListBox_SetCurSel(hList, nIndex); DisplayFileDetails(); diff --git a/mozilla/cmd/winfe/prefs/brpref/src/brpref.rc b/mozilla/cmd/winfe/prefs/brpref/src/brpref.rc index bb7da6cb727..b4a1806a2ce 100644 --- a/mozilla/cmd/winfe/prefs/brpref/src/brpref.rc +++ b/mozilla/cmd/winfe/prefs/brpref/src/brpref.rc @@ -318,45 +318,6 @@ BEGIN ICON "",IDC_ICON2,18,158,20,20 END -IDD_DISK_SPACE DIALOG DISCARDABLE 0, 0, 256, 190 -STYLE WS_CHILD | WS_CLIPSIBLINGS -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "All Messages",IDC_STATIC,6,7,242,47 - CONTROL "&Do not download any message larger than ", - IDC_CHECK_MSG_SIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 20,17,149,14 - LTEXT "&kB",IDC_STATIC,202,19,25,8 - EDITTEXT IDC_EDIT_MSG_SIZE,171,18,28,12,ES_AUTOHSCROLL - CONTROL "Auto&matically compact folders when it will save over", - IDC_CHECK_COMPACT_SIZE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,20,33,179,14 - LTEXT "k&B",IDC_STATIC,232,35,11,8 - EDITTEXT IDC_EDIT_COMPACT_SIZE,201,34,28,12,ES_AUTOHSCROLL - GROUPBOX "Discussion Groups Messages Only",IDC_STATIC,6,60,242, - 106 - LTEXT "When it's time to clean up messages:",IDC_STATIC,12,74, - 161,10,NOT WS_GROUP - CONTROL "Keep messages which have arrived within the &past", - IDC_KEEP_MSG_DAYS,"Button",BS_AUTORADIOBUTTON | WS_GROUP | - WS_TABSTOP,20,86,175,10 - CONTROL "Keep &all messages",IDC_KEEP_ALL,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,20,99,123,10 - CONTROL "Keep the &newest",IDC_KEEP_COUNT,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,20,112,69,10 - LTEXT "&days",IDC_STATIC,223,86,19,8,NOT WS_GROUP - EDITTEXT IDC_EDIT_MSG_DAYS,196,85,24,12,ES_AUTOHSCROLL - LTEXT "&messages",IDC_STATIC,117,112,65,8 - EDITTEXT IDC_EDIT_MSG_COUNT,90,111,24,12,ES_AUTOHSCROLL - CONTROL "Keep only &unread messages",IDC_KEEP_UNREAD,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,21,128,150,12 - CONTROL "&Remove message bodies only older than ", - IDC_CHECK_MSG_DAYS2,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,21,143,145,13 - LTEXT "da&ys",IDC_STATIC,203,144,24,8 - EDITTEXT IDC_EDIT_MSG_DAYS2,167,143,32,12,ES_AUTOHSCROLL -END - IDD_CACHE16 DIALOG DISCARDABLE 0, 0, 256, 190 STYLE WS_CHILD | WS_CLIPSIBLINGS FONT 8, "MS Sans Serif" @@ -385,6 +346,59 @@ BEGIN 35,10 END +#ifdef MOZ_MAIL_NEWS +IDD_EDIT_TYPE DIALOG DISCARDABLE 0, 0, 223, 220 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Edit Type" +FONT 8, "MS Sans Serif" +BEGIN + ICON "",IDC_ICON1,7,4,18,20 + LTEXT "Description",IDC_DESCRIPTION,34,10,180,8,SS_NOPREFIX + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,28,209,1 + LTEXT "Extension:",IDC_STATIC,7,40,34,8 + LTEXT "GIF",IDC_EXTENSION,50,40,165,8 + LTEXT "&MIME Type:",IDC_STATIC,7,56,40,8 + EDITTEXT IDC_EDIT1,50,53,166,14,ES_AUTOHSCROLL + GROUPBOX "Handled By",IDC_STATIC,7,89,209,77 + CONTROL "&Navigator",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_DISABLED | WS_GROUP | WS_TABSTOP,17,101,47,10 + CONTROL "&Save to Disk",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON, + 17,115,57,10 + CONTROL "&Application:",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON, + 17,129,51,10 + EDITTEXT IDC_EDIT2,70,128,140,14,ES_AUTOHSCROLL + PUSHBUTTON "&Browse...",IDC_BUTTON1,160,145,50,14 + DEFPUSHBUTTON "OK",IDOK,111,199,50,14,WS_GROUP + PUSHBUTTON "Cancel",IDCANCEL,166,199,50,14 + CONTROL "As&k me before opening downloaded files of this type", + IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,171, + 179,10 + CONTROL "Use this MIME as the outgoing default for these file extensions", + IDC_USEASDEFAULT,"Button",BS_AUTO3STATE | WS_TABSTOP,7, + 72,211,10 +END + +IDD_NEW_TYPE DIALOG DISCARDABLE 0, 0, 222, 142 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "New Type" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "&Description of type:",IDC_STATIC,7,10,62,8 + EDITTEXT IDC_EDIT1,71,8,144,14,ES_AUTOHSCROLL + LTEXT "File &extension:",IDC_STATIC,7,27,46,8 + EDITTEXT IDC_EDIT2,71,25,144,14,ES_AUTOHSCROLL + LTEXT "&MIME Type:",IDC_STATIC,7,43,40,8 + EDITTEXT IDC_EDIT3,71,42,144,14,ES_AUTOHSCROLL + LTEXT "&Application to use:",IDC_STATIC,7,61,59,8 + EDITTEXT IDC_EDIT4,71,59,144,14,ES_AUTOHSCROLL + PUSHBUTTON "&Browse...",IDC_BUTTON1,165,76,50,14 + DEFPUSHBUTTON "OK",IDOK,109,121,50,14,WS_GROUP + PUSHBUTTON "Cancel",IDCANCEL,165,121,50,14 + CONTROL "Use this MIME as the outgoing default for this file extension", + IDC_USEASDEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7, + 100,201,10 +END +#else IDD_EDIT_TYPE DIALOG DISCARDABLE 0, 0, 223, 199 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Edit Type" @@ -466,6 +480,7 @@ BEGIN BS_AUTOCHECKBOX | WS_TABSTOP,17,109,97,10 END +#endif @@ -565,14 +580,6 @@ BEGIN BOTTOMMARGIN, 183 END - IDD_DISK_SPACE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 249 - TOPMARGIN, 7 - BOTTOMMARGIN, 183 - END - IDD_CACHE16, DIALOG BEGIN LEFTMARGIN, 7 @@ -689,7 +696,6 @@ BEGIN IDS_HISTORY "History" IDS_CONTINUE_CLEAR_HISTORY "This will clear the list of pages you have previously visited.\r\nContinue?" - IDD_DISK_SPACE "Disk Space\nManage the amount of disk space taken by messages" IDD_CACHE16 "Cache\nDesignate the size of the cache" IDS_FILTER_HTM32 "HTML Files\n*.html;*.htm\n\n" IDS_BROWSE_HOMEPAGE "Browse for Home Page" diff --git a/mozilla/cmd/winfe/prefs/brpref/src/resource.h b/mozilla/cmd/winfe/prefs/brpref/src/resource.h index 9112d8649a7..e71df5f67a8 100644 --- a/mozilla/cmd/winfe/prefs/brpref/src/resource.h +++ b/mozilla/cmd/winfe/prefs/brpref/src/resource.h @@ -201,6 +201,7 @@ #define IDC_LIST3 1050 #define IDC_LANGUAGE_HEADING 1051 #define IDC_DESCRIPTION 1052 +#define IDC_USEASDEFAULT 1053 #define IDC_MIME_TYPE 1254 #define IDC_HANDLED_BY 1256 #define IDC_BUTTON_MORE 1395 diff --git a/mozilla/cmd/winfe/prefs/makefile.win b/mozilla/cmd/winfe/prefs/makefile.win index 881c8e74398..c81f939c077 100644 --- a/mozilla/cmd/winfe/prefs/makefile.win +++ b/mozilla/cmd/winfe/prefs/makefile.win @@ -23,12 +23,13 @@ DIRS = prefuuid nsdlg nsprefui brpref \ !ifdef EDITOR edpref \ !endif -!ifdef MOZ_MAIL_NEWS - mnpref \ -!endif !ifdef MOZ_LOC_INDEP lipref \ !endif +!ifdef MOZ_MAIL_NEWS + mnpref \ +!endif + !include "$(DEPTH)\config\rules.mak" diff --git a/mozilla/cmd/winfe/prefs/mnpref/makefile.win b/mozilla/cmd/winfe/prefs/mnpref/makefile.win new file mode 100644 index 00000000000..40f77adab63 --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/makefile.win @@ -0,0 +1,21 @@ +# 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. + + +DEPTH = ..\..\..\.. +DIRS = public src + +!include "$(DEPTH)\config\rules.mak" + diff --git a/mozilla/cmd/winfe/prefs/mnpref/public/makefile.win b/mozilla/cmd/winfe/prefs/mnpref/public/makefile.win new file mode 100644 index 00000000000..8435c8cc1aa --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/public/makefile.win @@ -0,0 +1,22 @@ +IGNORE_MANIFEST=1 +# 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. + + +MODULE=winprefs +DEPTH=..\..\..\..\.. +EXPORTS=mnprefid.h mninterf.h + +!include "$(DEPTH)\config\rules.mak" diff --git a/mozilla/cmd/winfe/prefs/mnpref/public/mninterf.h b/mozilla/cmd/winfe/prefs/mnpref/public/mninterf.h new file mode 100644 index 00000000000..9831f48de40 --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/public/mninterf.h @@ -0,0 +1,124 @@ +/* -*- 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. + */ + +#ifndef __MNINTERF_H_ +#define __MNINTERF_H_ + +///////////////////////////////////////////////////////////////////////////// +// IMailNewsInterface interface + +#ifdef __cplusplus +interface IMailNewsInterface; +#else +typedef interface IMailNewsInterface IMailNewsInterface; +#endif + +typedef IMailNewsInterface FAR* LPMAILNEWSINTERFACE; + +#undef INTERFACE +#define INTERFACE IMailNewsInterface + +#ifdef XP_WIN16 +#ifndef LPOLESTR + +typedef char OLECHAR; +typedef OLECHAR FAR* LPOLESTR; +typedef const OLECHAR FAR* LPCOLESTR; + +#endif +#endif + +// IMailNewsInterface provides the Mail News preference UI to call back to .Exe +DECLARE_INTERFACE_(IMailNewsInterface, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + // IMailNewsPrefs methods + STDMETHOD_(BOOL, CreateAddressBookCard)(HWND hParent) PURE; + STDMETHOD(EditAddressBookCard)(HWND hParent) PURE; + + STDMETHOD(GetSigFile)(THIS_ HWND hParent, LPOLESTR *pszSigFile) PURE; + STDMETHOD(ShowDirectoryPicker)(THIS_ HWND hParent, LPOLESTR lpIniDir, LPOLESTR *pszNewDir) PURE; + + STDMETHOD(ShowChooseFolder)(THIS_ HWND hParent, LPOLESTR lpFolderPath, + DWORD dwType, LPOLESTR *lpFolder, LPOLESTR *lpServer, LPOLESTR *lpPref) PURE; + STDMETHOD(GetFolderServer)(LPOLESTR lpFolderPath, DWORD dwType, + LPOLESTR *lpFolder, LPOLESTR *lpServer) PURE; + + STDMETHOD(FillNewsServerList)(THIS_ HWND hControl, LPOLESTR lpServerName, LPVOID FAR* ppServer) PURE; + STDMETHOD_(BOOL, AddNewsServer)(THIS_ HWND hParent, HWND hControl) PURE; + STDMETHOD_(BOOL, EditNewsServer)(THIS_ HWND hParent, HWND hControl, BOOL *pChanged) PURE; + STDMETHOD(DeleteNewsServer)(THIS_ HWND hParent, HWND hControl, LPVOID FAR* lpDefault) PURE; + + STDMETHOD_(BOOL, AddMailServer)(THIS_ HWND hParent, HWND hControl, BOOL bAllowBoth, DWORD dwType) PURE; + STDMETHOD_(BOOL, EditMailServer)(THIS_ HWND hParent, HWND hControl, BOOL bAllowBoth, DWORD dwType) PURE; + STDMETHOD_(BOOL, DeleteMailServer)(THIS_ HWND hParent, HWND hControl, DWORD dwType) PURE; + STDMETHOD(SetImapDefaultServer)(THIS_ HWND hControl) PURE; + + STDMETHOD(FillLdapDirList)(THIS_ HWND hControl, LPOLESTR lpServerName) PURE; + STDMETHOD(SetLdapDirAutoComplete)(THIS_ HWND hControl, BOOL bOnOrOff) PURE; + STDMETHOD(SaveLdapDirAutoComplete)(THIS) PURE; + +}; + +///////////////////////////////////////////////////////////////////////////// +// IOfflineInterface interface + +#ifdef __cplusplus +interface IOfflineInterface; +#else +typedef interface IOfflineInterface IOfflineInterface; +#endif + +typedef IOfflineInterface FAR* LPOFFLINEINTERFACE; + +#undef INTERFACE +#define INTERFACE IOfflineInterface + + +// IMailNewsInterface provides the Mail News preference UI to call back to .Exe +DECLARE_INTERFACE_(IOfflineInterface, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + // IOfflineInterface methods + STDMETHOD(DoSelectDiscussion)(THIS_ HWND hParent) PURE; +}; + +typedef enum +{ + TYPE_SENTMAIL, + TYPE_SENTNEWS, + TYPE_DRAFT, + TYPE_TEMPLATE +}FolderType; + +typedef enum +{ + TYPE_POP, + TYPE_IMAP, +}MailServerType; + +#endif /* __MNINTERF_H_ */ + diff --git a/mozilla/cmd/winfe/prefs/mnpref/public/mnprefid.h b/mozilla/cmd/winfe/prefs/mnpref/public/mnprefid.h new file mode 100644 index 00000000000..214522831a5 --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/public/mnprefid.h @@ -0,0 +1,61 @@ +/* -*- 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. + */ + +#ifndef __MNPREFID_H_ +#define __MNPREFID_H_ + +#ifndef MOZ_COMMUNICATOR_IIDS + +/* d3852820-f7dd-11d0-b099-00805f8a1db7 */ +DEFINE_GUID(IID_MailNewsInterface, +0xd3852820, 0xf7dd, 0x11d0, 0xb0, 0x99, 0x00, 0x80, 0x5f, 0x8a, 0x1d, 0xb7); + +/* cd252be0-f7dd-11d0-b099-00805f8a1db7 */ +DEFINE_GUID(IID_OfflineInterface, +0xcd252be0, 0xf7dd, 0x11d0, 0xb0, 0x99, 0x00, 0x80, 0x5f, 0x8a, 0x1d, 0xb7); + +/* c53af140-f7dd-11d0-b099-00805f8a1db7 */ +DEFINE_GUID(CLSID_MailNewsPrefs, +0xc53af140, 0xf7dd, 0x11d0, 0xb0, 0x99, 0x00, 0x80, 0x5f, 0x8a, 0x1d, 0xb7); + +/* a61b8da0-f7dd-11d0-b099-00805f8a1db7 */ +DEFINE_GUID(CLSID_OfflinePrefs, +0xa61b8da0, 0xf7dd, 0x11d0, 0xb0, 0x99, 0x00, 0x80, 0x5f, 0x8a, 0x1d, 0xb7); + +#else /* MOZ_COMMUNICATOR_IIDS */ + +// {E8D6B4F0-8B58-11d0-9B63-00805F8ADDDE} +DEFINE_GUID(IID_MailNewsInterface, +0xe8d6b4f0, 0x8b58, 0x11d0, 0x9b, 0x63, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0xde); + +// {DDF4AB60-8B84-11d0-9B63-00805F8ADDDE} +DEFINE_GUID(IID_OfflineInterface, +0xddf4ab60, 0x8b84, 0x11d0, 0x9b, 0x63, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0xde); + +// {CC3E2871-43CA-11d0-B6D8-00805F8ADDDE} +DEFINE_GUID(CLSID_MailNewsPrefs, +0xcc3e2871, 0x43ca, 0x11d0, 0xb6, 0xd8, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0xde); + +// {CC3E2872-43CA-11d0-B6D8-00805F8ADDDE} +DEFINE_GUID(CLSID_OfflinePrefs, +0xcc3e2872, 0x43ca, 0x11d0, 0xb6, 0xd8, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0xde); + +#endif /* MOZ_COMMUNICATOR_IIDS */ + +#endif /* __MNPREFID_H_ */ + diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/makefile.win b/mozilla/cmd/winfe/prefs/mnpref/src/makefile.win new file mode 100644 index 00000000000..c04b765187c --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/makefile.win @@ -0,0 +1,70 @@ +IGNORE_MANIFEST=1 +# 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. + + +!if "$(MOZ_BITS)" == "16" +DLL_CFLAGS=/GA /GEd /GEf /D_WINDLL + +!ifndef MOZ_DEBUG +OPTIMIZER=-O1 -UDEBUG -DNDEBUG +!endif +!endif + +DLLNAME = mnpref$(MOZ_BITS) +PDBFILE = $(DLLNAME).pdb +MAPFILE = $(DLLNAME).map +DLL =.\$(OBJDIR)\$(DLLNAME).dll +DEFFILE = mnpref$(MOZ_BITS).def +RESFILE = mnpref.res +MAKE_OBJ_TYPE = DLL + +LLIBS = $(DIST)\lib\prefuuid.lib \ + $(DIST)\lib\dllcom.lib \ + $(DIST)\lib\nsdlg$(MOZ_BITS).lib \ + $(DIST)\lib\xppref$(MOZ_BITS).lib +LLIBS16 = ole2.lib shell.lib commdlg.lib toolhelp.lib +LLIBS32 = ole32.lib comdlg32.lib shell32.lib uuid.lib + +!if "$(_MSC_VER)" != "1100" +LLIBS32 = $(LLIBS32) uuid2.lib +!endif + +!if "$(MOZ_BITS)" == "32" +LLIBS = $(LLIBS) $(LLIBS32) +!else +LLIBS = $(LLIBS) $(LLIBS16) +!endif + +MODULE=winprefs +DEPTH=..\..\..\..\.. +REQUIRES=dllcom winprefs pref dbm nspr js security +CPPSRCS=mnpref.cpp pages.cpp mnpages.cpp offpages.cpp +CPP_OBJS=.\$(OBJDIR)\mnpref.obj .\$(OBJDIR)\pages.obj \ + .\$(OBJDIR)\mnpages.obj .\$(OBJDIR)\offpages.obj +!if "$(MOZ_BITS)" != "16" +LINCS=-I$(XPDIST)\public\dllcom -I$(XPDIST)\public\winprefs \ + -I$(XPDIST)\public\pref -I$(XPDIST)\public\dbm \ + -I$(XPDIST)\public\nspr -I$(XPDIST)\public\js -I$(XPDIST)\public\security +!endif + +!include "$(DEPTH)\config\rules.mak" + +libs:: $(DLL) + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin +!if "$(WINOS)" != "WIN95" + @$(DIST)\bin\dllreg $(DIST)\bin\$(DLLNAME).dll +!endif + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/mnpages.cpp b/mozilla/cmd/winfe/prefs/mnpref/src/mnpages.cpp new file mode 100644 index 00000000000..edb185c492a --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/mnpages.cpp @@ -0,0 +1,1985 @@ +/* -*- 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. + */ + +#include "xp_help.h" +#include "pch.h" +#include +#include "dllcom.h" +#include "pages.h" +#include "resource.h" +#include "structs.h" +#include "xp_core.h" +#include "prefapi.h" +#include "colorbtn.h" +#include "bitmpbtn.h" +#include "mninterf.h" +#include "mnprefid.h" +#include "msgcom.h" + +//#define MOZ_NO_LDAP 1 +#undef MOZ_LDAP + +#include "dirprefs.h" + +extern "C" BOOL IsNumeric(char* pStr) +{ + + for (char* p = pStr; p && *p; p++) + { + if (0 == isdigit(*p)) + return FALSE; + } + return TRUE; +} + +void ValidateNumeric +(HWND hParent, HINSTANCE hInst, int nCaptionID, int nID, int& data) +{ + HWND hwndCtl = GetDlgItem(hParent, nID); + char szBuf[32]; + DWORD dwStart, dwEnd; + + assert(hwndCtl); + Edit_GetText(hwndCtl, szBuf, sizeof(szBuf)); + SendMessage(hwndCtl, EM_GETSEL, (WPARAM)(LPDWORD)&dwStart, + (LPARAM)(LPDWORD)&dwEnd); + if (!IsNumeric(szBuf)) + { + CString strText, strCaption; + + strText.LoadString(hInst, IDS_NUMERIC_ONLY); + strCaption.LoadString(hInst, nCaptionID); + + MessageBeep(MB_ICONHAND); + MessageBox(GetParent(hParent), (LPCSTR)strText, (LPCSTR)strCaption, + MB_OK | MB_ICONSTOP); + wsprintf(szBuf, "%i", data); + Edit_SetText(hwndCtl, szBuf); + Edit_SetSel(hwndCtl, dwStart - 1, dwEnd - 1); + } + else + { + data = atoi(szBuf); + } +} + +///////////////////////////////////////////////////////////////////////////// +// CMailNewsPrefs implementation + +CMailNewsPrefs::CMailNewsPrefs() + : CMailNewsPropertyPage(IDD_MAILNEWS, HELP_PREFS_MAILNEWS_MAIN_PANE) +{ + // Set member data using XP preferences + m_rgbQuotedColor = RGB(0,0,0); +} + +BOOL CMailNewsPrefs::InitDialog() +{ + char szBuf[256]; + HWND hwndCombo = GetDlgItem(m_hwndDlg, IDC_FONT_STYLE); + for (int i = IDS_PLAIN; i <= IDS_BOLD_ITALIC; i++) + { + int nLen = LoadString(m_hInstance, i, szBuf, sizeof(szBuf)); + + assert(nLen > 0); + ComboBox_AddString(hwndCombo, szBuf); + } + + // Fill in the list of font sizes + hwndCombo = GetDlgItem(m_hwndDlg, IDC_FONT_SIZE); + for (i = IDS_FONT_SIZE_FIRST; i <= IDS_FONT_SIZE_LAST; i++) + { + int nLen = LoadString(m_hInstance, i, szBuf, sizeof(szBuf)); + + assert(nLen > 0); + ComboBox_AddString(hwndCombo, szBuf); + } + + // Check for locked preferences + CheckIfLockedPref("mail.quoted_style", IDC_FONT_STYLE); + CheckIfLockedPref("mail.quoted_size", IDC_FONT_SIZE); + CheckIfLockedPref("mail.citation_color", IDC_COLOR); + + if (MNPREF_PrefIsLocked("mail.fixed_width_messages")) + { + EnableDlgItem(IDC_RADIO_FIXED, FALSE); + EnableDlgItem(IDC_RADIO_VARIABLE, FALSE); + } + + CheckIfLockedPref("mail.play_sound", IDC_ENABLE_SOUND); + CheckIfLockedPref("mailnews.confirm.moveFoldersToTrash", IDC_REMEMBER_LAST_MESSAGE); + CheckIfLockedPref("mailnews.remember_selected_message", IDC_CONFIRM_ON_DELETE); + CheckIfLockedPref("mail.use_mapi_server", IDC_USE_MAPI); + + return CMailNewsPropertyPage::InitDialog(); +} + +// Initialize member data using XP preferences +STDMETHODIMP CMailNewsPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) { + int32 n; + + PREF_GetIntPref("mail.quoted_style", &n); + m_nFontStyle = (int)n; + PREF_GetIntPref("mail.quoted_size", &n); + m_nFontSize = (int)n; + PREF_GetColorPrefDWord("mail.citation_color", &m_rgbQuotedColor); + PREF_GetBoolPref("mail.fixed_width_messages", &m_bFixWidthFont); + if (m_bFixWidthFont) + m_nWidthRadio = 0; + else + m_nWidthRadio = 1; + PREF_GetBoolPref("mail.play_sound", &m_bEnableSound); + PREF_GetBoolPref("mailnews.remember_selected_message", &m_bRemeberLastMsg); + PREF_GetBoolPref("mailnews.confirm.moveFoldersToTrash", &m_bConfirmOnDelete); + PREF_GetBoolPref("mail.use_mapi_server", &m_bUseMapi); + } + + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL CMailNewsPrefs::DoTransfer(BOOL bSaveAndValidate) +{ + ComboBoxTransfer(IDC_FONT_STYLE , m_nFontStyle, bSaveAndValidate); + ComboBoxTransfer(IDC_FONT_SIZE, m_nFontSize, bSaveAndValidate); + RadioButtonTransfer(IDC_RADIO_FIXED, m_nWidthRadio, bSaveAndValidate); + CheckBoxTransfer(IDC_ENABLE_SOUND, m_bEnableSound, bSaveAndValidate); + CheckBoxTransfer(IDC_REMEMBER_LAST_MESSAGE, m_bRemeberLastMsg, bSaveAndValidate); + CheckBoxTransfer(IDC_CONFIRM_ON_DELETE, m_bConfirmOnDelete, bSaveAndValidate); + CheckBoxTransfer(IDC_USE_MAPI, m_bUseMapi, bSaveAndValidate); + return TRUE; +} + +BOOL CMailNewsPrefs::ApplyChanges() +{ + // Apply changes using XP preferences + PREF_SetIntPref("mail.quoted_style", (int32)m_nFontStyle); + PREF_SetIntPref("mail.quoted_size", (int32)m_nFontSize); + PREF_SetColorPrefDWord("mail.citation_color", m_rgbQuotedColor); + if (m_nWidthRadio == 0) + PREF_SetBoolPref("mail.fixed_width_messages", TRUE); + else + PREF_SetBoolPref("mail.fixed_width_messages", FALSE); + PREF_SetBoolPref("mail.play_sound", m_bEnableSound); + PREF_SetBoolPref("mailnews.remember_selected_message", m_bRemeberLastMsg); + PREF_SetBoolPref("mailnews.confirm.moveFoldersToTrash", m_bConfirmOnDelete); + PREF_SetBoolPref("mail.use_mapi_server", m_bUseMapi); + return TRUE; +} + +COLORREF CMailNewsPrefs::GetColorButtonColor(UINT nCtlID) +{ + if (nCtlID == IDC_COLOR) + return m_rgbQuotedColor; + + assert(FALSE); + return 0; +} + +void CMailNewsPrefs::SetColorButtonColor(UINT nCtlID, COLORREF cr) +{ + if (nCtlID == IDC_COLOR) + m_rgbQuotedColor = cr; + else + assert(FALSE); +} + +LRESULT CMailNewsPrefs::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + HBRUSH hBrush; + + switch (uMsg) { + case WM_DRAWITEM: + hBrush = CreateSolidBrush(GetColorButtonColor(((LPDRAWITEMSTRUCT)lParam)->CtlID)); + DrawColorButtonControl((LPDRAWITEMSTRUCT)lParam, hBrush); + DeleteBrush(hBrush); + return TRUE; + + default: + return CMailNewsPropertyPage::WindowProc(uMsg, wParam, lParam); + } +} + +BOOL CMailNewsPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) +{ + switch (id) + { + case IDC_COLOR: + if (notifyCode == BN_CLICKED) + { + CHOOSECOLOR cc; + COLORREF custColors[16]; + + // Initialize the structure + memset(&cc, 0, sizeof(cc)); + cc.lStructSize = sizeof(cc); + cc.rgbResult = GetColorButtonColor(id); + cc.hwndOwner = GetParent(m_hwndDlg); + cc.lpCustColors = custColors; + cc.Flags = CC_RGBINIT; + + // Initialize the custom colors to white + for (int i = 0; i < 16; i++) + custColors[i] = RGB(255,255,255); + + if (ChooseColor(&cc) == IDOK) + { + SetColorButtonColor(id, cc.rgbResult); + InvalidateRect(hwndCtl, NULL, FALSE); + } + + return TRUE; + } + break; + } + return CMailNewsPropertyPage::OnCommand(id, hwndCtl, notifyCode); +} + +///////////////////////////////////////////////////////////////////////////// +// CIdentityPrefs implementation + +CIdentityPrefs::CIdentityPrefs() +#ifndef MOZ_MAIL_NEWS + : CMailNewsPropertyPage(IDD_IDENTITY, HELP_PREFS_IDENTITY) +#else + : CMailNewsPropertyPage(IDD_IDENTITY, HELP_PREFS_MAILNEWS_IDENTITY) +#endif /* MOZ_MAIL_NEWS */ +{ + // Set member data using XP preferences +} + +BOOL CIdentityPrefs::InitDialog() +{ + // Check for locked preferences + CheckIfLockedPref("mail.identity.username", IDC_EDIT_NAME); + CheckIfLockedPref("mail.identity.useremail", IDC_EDIT_EMAIL); + CheckIfLockedPref("mail.identity.reply_to", IDC_EDIT_REPLYTO); + CheckIfLockedPref("mail.identity.organization", IDC_EDIT_ORGANIZATION); + if (CheckIfLockedPref("mail.signature_file", IDC_EDIT_SIGFILE)) + EnableDlgItem(IDC_BUTTON_BROWSE, FALSE); + if (CheckIfLockedPref("mail.attach_vcard", IDC_ATTACH_VCARD)) + EnableDlgItem(IDC_BUTTON_EDITCARD, FALSE); + + return CMailNewsPropertyPage::InitDialog(); +} + +STDMETHODIMP CIdentityPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) { + PREF_GetStringPref("mail.identity.username", m_strName); + PREF_GetStringPref("mail.identity.useremail", m_strEmail); + PREF_GetStringPref("mail.identity.reply_to", m_strReply); + PREF_GetStringPref("mail.identity.organization", m_strOrganization); + PREF_GetStringPref("mail.signature_file", m_strSigFile); + PREF_GetBoolPref("mail.attach_vcard", &m_bAttchVCard); + } + + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL CIdentityPrefs::DoTransfer(BOOL bSaveAndValidate) +{ + EditFieldTransfer(IDC_EDIT_NAME, m_strName, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_EMAIL, m_strEmail, bSaveAndValidate); +#ifdef MOZ_MAIL_NEWS + EditFieldTransfer(IDC_EDIT_REPLYTO, m_strReply, bSaveAndValidate); +#endif + EditFieldTransfer(IDC_EDIT_ORGANIZATION, m_strOrganization, bSaveAndValidate); +#ifdef MOZ_MAIL_NEWS + EditFieldTransfer(IDC_EDIT_SIGFILE, m_strSigFile, bSaveAndValidate); + CheckBoxTransfer(IDC_ATTACH_VCARD, m_bAttchVCard, bSaveAndValidate); +#endif + return TRUE; +} + +BOOL CIdentityPrefs::ApplyChanges() +{ + PREF_SetCharPref("mail.identity.username", m_strName); + PREF_SetCharPref("mail.identity.useremail", m_strEmail); + PREF_SetCharPref("mail.identity.reply_to", m_strReply); + PREF_SetCharPref("mail.identity.organization", m_strOrganization); + if (m_strSigFile.IsEmpty()) + PREF_SetBoolPref("mail.use_signature_file", FALSE); + else + PREF_SetBoolPref("mail.use_signature_file", TRUE); + PREF_SetCharPref("mail.signature_file", m_strSigFile); + PREF_SetBoolPref("mail.attach_vcard",m_bAttchVCard); + return TRUE; +} + +BOOL CIdentityPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) +{ + switch (id) + { + case IDC_BUTTON_BROWSE: + if (notifyCode == BN_CLICKED) + { + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + LPOLESTR lpoleSigFile = NULL; + + lpInterface->GetSigFile(GetParent(m_hwndDlg), &lpoleSigFile); + if (lpoleSigFile) + { + m_strSigFile = lpoleSigFile; + CoTaskMemFree(lpoleSigFile); + Edit_SetText(GetDlgItem(m_hwndDlg, IDC_EDIT_SIGFILE), + (LPCSTR)m_strSigFile); + } + lpInterface->Release(); + } + } + } + break; + + case IDC_ATTACH_VCARD: + if (notifyCode == BN_CLICKED) + { + if (IsDlgButtonChecked(m_hwndDlg, IDC_ATTACH_VCARD)) + { + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + if (lpInterface->CreateAddressBookCard(GetParent(m_hwndDlg))) + { + m_bAttchVCard = TRUE; + } + else + { + m_bAttchVCard = FALSE; + CheckDlgButton(m_hwndDlg, IDC_ATTACH_VCARD, FALSE); + } + // Get the number of encodings + lpInterface->Release(); + } + } + + } + return TRUE; + } + break; + case IDC_BUTTON_EDITCARD: + if (notifyCode == BN_CLICKED) + { + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + // Get the number of encodings + lpInterface->EditAddressBookCard(GetParent(m_hwndDlg)); + lpInterface->Release(); + } + } + } + return TRUE; + } + return CMailNewsPropertyPage::OnCommand(id, hwndCtl, notifyCode); +} + +///////////////////////////////////////////////////////////////////////////// +// CMessagesPrefs implementation + +CMessagesPrefs::CMessagesPrefs() + : CMailNewsPropertyPage(IDD_MESSAGES, HELP_PREFS_MAILNEWS_MESSAGES) +{ +} + +BOOL CMessagesPrefs::InitDialog() +{ + if(MNPREF_PrefIsLocked("mail.forward_message_mode")) + { + EnableDlgItem(IDC_COMBO_FORWARD, FALSE); + } + + char szBuf[256]; + + HWND hwndCombo = GetDlgItem(m_hwndDlg, IDC_COMBO_FORWARD); + + for(int i = IDS_FORWARDINLINE; i <= IDS_FORWARDATTACHMENT; i++) + { + int nLen = LoadString(m_hInstance, i, szBuf, sizeof(szBuf)); + assert(nLen > 0); + ComboBox_AddString(hwndCombo, szBuf); + } + + + CheckIfLockedPref("mail.auto_quote", IDC_CHECK_AUTO_QUOTE); + + + if (MNPREF_PrefIsLocked("mailnews.reply_on_top")) + { + EnableDlgItem(IDC_COMBO_REPLY, FALSE); + } + + hwndCombo = GetDlgItem(m_hwndDlg, IDC_COMBO_REPLY); + + for(int j = IDS_REPLYABOVE; j <= IDS_REPLYSELECT; j++) + { + int nLen = LoadString(m_hInstance, j, szBuf, sizeof(szBuf)); + assert(nLen > 0); + ComboBox_AddString(hwndCombo, szBuf); + } + + CheckIfLockedPref("mail.wrap_long_lines", IDC_WRAP_INCOMING); + + Edit_LimitText(GetDlgItem(m_hwndDlg, IDC_EDIT_WRAP_LEN), 5); + CheckIfLockedPref("mailnews.wraplength", IDC_EDIT_WRAP_LEN); + + if (MNPREF_PrefIsLocked("mail.strictly_mime")) + { + EnableDlgItem(IDC_RADIO_8BITS, FALSE); + EnableDlgItem(IDC_RADIO_MIME, FALSE); + } + + return CMailNewsPropertyPage::InitDialog(); +} + +STDMETHODIMP +CMessagesPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) { + int32 n; + + PREF_GetIntPref("mail.forward_message_mode", &n); + + if(n == 0) + m_nForwardChoice = 2; + else if(n==1) + m_nForwardChoice = 1; + else + m_nForwardChoice = 0; + + PREF_GetBoolPref("mail.auto_quote", &m_bAutoQuote); + + PREF_GetIntPref("mailnews.reply_on_top", &n); + if (n == 0) + m_nRadioQuoteType = 1; + else if (n == 1) + m_nRadioQuoteType = 0; + else + m_nRadioQuoteType = 2; + + PREF_GetBoolPref("mail.wrap_long_lines", &m_bWarpIncoming); + + PREF_GetIntPref("mailnews.wraplength", &n); + if (n == 0) + PREF_GetDefaultIntPref("mailnews.wraplength", &n); + else if (n < 10) + n = 10; + m_nWrapLen = (int)n; + + BOOL bPref; + PREF_GetBoolPref("mail.strictly_mime", &bPref); + if (bPref) + m_nRadio8bits = 1; + else + m_nRadio8bits = 0; + + } + + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL CMessagesPrefs::DoTransfer(BOOL bSaveAndValidate) +{ + ComboBoxTransfer(IDC_COMBO_FORWARD, m_nForwardChoice, bSaveAndValidate); + CheckBoxTransfer(IDC_CHECK_AUTO_QUOTE, m_bAutoQuote, bSaveAndValidate); + ComboBoxTransfer(IDC_COMBO_REPLY, m_nRadioQuoteType, bSaveAndValidate); + CheckBoxTransfer(IDC_WRAP_INCOMING, m_bWarpIncoming, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_WRAP_LEN, m_nWrapLen, bSaveAndValidate); + RadioButtonTransfer(IDC_RADIO_8BITS, m_nRadio8bits, bSaveAndValidate); + + return TRUE; +} + +BOOL CMessagesPrefs::ApplyChanges() +{ + if(m_nForwardChoice == 0) + PREF_SetIntPref("mail.forward_message_mode", (int32)2); + else if(m_nForwardChoice == 1) + PREF_SetIntPref("mail.forward_message_mode", (int32)1); + else + PREF_SetIntPref("mail.forward_message_mode", (int32)0); + + PREF_SetBoolPref("mail.auto_quote", m_bAutoQuote); + if (m_nRadioQuoteType == 0) + PREF_SetIntPref("mailnews.reply_on_top", (int32)1); + else if (m_nRadioQuoteType == 1) + PREF_SetIntPref("mailnews.reply_on_top", (int32)0); + else + PREF_SetIntPref("mailnews.reply_on_top", (int32)2); + + PREF_SetBoolPref("mail.wrap_long_lines", m_bWarpIncoming); + + PREF_SetIntPref("mailnews.wraplength", (int32)m_nWrapLen); + if (m_nRadio8bits == 0) + PREF_SetBoolPref("mail.strictly_mime", FALSE); + else + PREF_SetBoolPref("mail.strictly_mime", TRUE); + + return TRUE; +} + +BOOL CMessagesPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) +{ + if (id == IDC_EDIT_WRAP_LEN && notifyCode == EN_UPDATE) + { + ValidateNumeric(m_hwndDlg, m_hInstance, IDS_MESSAGES, + id, m_nWrapLen); + ValidateNonZero(); + return TRUE; + } + return CMailNewsPropertyPage::OnCommand(id, hwndCtl, notifyCode); +} + +void CMessagesPrefs::ValidateNonZero() +{ + HWND hwndCtl = GetDlgItem(m_hwndDlg, IDC_EDIT_WRAP_LEN); + char szBuf[32]; + DWORD dwStart, dwEnd; + + assert(hwndCtl); + Edit_GetText(hwndCtl, szBuf, sizeof(szBuf)); + SendMessage(hwndCtl, EM_GETSEL, (WPARAM)(LPDWORD)&dwStart, + (LPARAM)(LPDWORD)&dwEnd); + + if (szBuf[0] == '\0' || szBuf[0] == '0') + { + CString strText, strCaption; + + strText.LoadString(m_hInstance, IDS_NON_ZERO); + strCaption.LoadString(m_hInstance, IDS_MESSAGES); + + MessageBeep(MB_ICONHAND); + MessageBox(GetParent(m_hwndDlg), (LPCSTR)strText, (LPCSTR)strCaption, + MB_OK | MB_ICONSTOP); + if (m_nWrapLen == 0) + { + int32 n; + PREF_GetDefaultIntPref("mailnews.wraplength", &n); + m_nWrapLen = (int)n; + } + wsprintf(szBuf, "%i", m_nWrapLen); + Edit_SetText(hwndCtl, szBuf); + Edit_SetSel(hwndCtl, dwStart - 1, dwEnd - 1); + } + else + { + m_nWrapLen = atoi(szBuf); + } +} + +///////////////////////////////////////////////////////////////////////////// +// CMailServerPrefs implementation + +CMailServerPrefs::CMailServerPrefs() + : CMailNewsPropertyPage(IDD_MAILSERVER, HELP_PREFS_MAILNEWS_MAILSERVER) +{ + m_nServerType = -1; + m_bSetDefault = FALSE; +} + +STDMETHODIMP CMailServerPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) { + int32 n; + + GetMailServerType(); + + PREF_GetIntPref("mail.smtp.ssl", &n); + m_nUseSSL = (int)n; + + GetPopServerName(); + + PREF_GetStringPref("mail.pop_name", m_strUserName); + PREF_GetStringPref("network.hosts.smtp_server", m_strOutServer); + PREF_GetStringPref("mail.directory", m_strMailDir); + } + + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL CMailServerPrefs::InitDialog() +{ + HWND hwndList = GetDlgItem(m_hwndDlg, IDC_SERVERS_LIST); + if (m_nServerType == TYPE_POP) + { + ListBox_AddString(hwndList, (LPCSTR)m_strPopServer); + } + else if (m_nServerType == TYPE_IMAP) + { + GetIMAPServers(hwndList); + } + if (ListBox_GetCount(hwndList)) + { + ListBox_SetCurSel(hwndList, 0); + EnableDlgItem(IDC_DEFAULT, FALSE); + } + + if (CheckIfLockedPref("network.hosts.pop_server", IDC_SERVERS_LIST)) + { + EnableDlgItem(IDC_NEW, FALSE); + EnableDlgItem(IDC_EDIT, FALSE); + EnableDlgItem(IDC_DELETE, FALSE); + } + CheckIfLockedPref("mail.pop_name", IDC_EDIT_NAME); + CheckIfLockedPref("network.hosts.smtp_server", IDC_EDIT_SMTP_SERVER); + if (MNPREF_PrefIsLocked("mail.smtp.ssl")) + { + EnableDlgItem(IDC_RADIO_NEVER, FALSE); + EnableDlgItem(IDC_RADIO_POSSIBLE, FALSE); + EnableDlgItem(IDC_RADIO_ALWAYS, FALSE); + } + + if (CheckIfLockedPref("mail.directory", IDC_EDIT_MAIL_DIR)) + EnableDlgItem(IDC_BUTTON_BROWSE, FALSE); + + return CMailNewsPropertyPage::InitDialog(); +} + +BOOL CMailServerPrefs::DoTransfer(BOOL bSaveAndValidate) +{ + if (m_nServerType == TYPE_POP) + ListBoxTransfer(IDC_SERVERS_LIST, m_strPopServer, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_NAME, m_strUserName, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_SMTP_SERVER, m_strOutServer, bSaveAndValidate); + RadioButtonTransfer(IDC_RADIO_NEVER, m_nUseSSL, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_MAIL_DIR, m_strMailDir, bSaveAndValidate); + return TRUE; +} + +BOOL CMailServerPrefs::ApplyChanges() +{ + PREF_SetIntPref("mail.server_type", (int32)m_nServerType); + PREF_SetCharPref("mail.pop_name", m_strUserName); + PREF_SetCharPref("network.hosts.smtp_server", m_strOutServer); + PREF_SetIntPref("mail.smtp.ssl", (int32)m_nUseSSL); + PREF_SetCharPref("mail.directory", m_strMailDir); + + if (!m_bSetDefault) + return TRUE; + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + HWND hwndList = GetDlgItem(m_hwndDlg, IDC_SERVERS_LIST); + if (m_nServerType == TYPE_IMAP) + lpInterface->SetImapDefaultServer(hwndList); + lpInterface->Release(); + } + } + return TRUE; +} + +void CMailServerPrefs::GetPopServerName() +{ + PREF_GetStringPref("network.hosts.pop_server", m_strPopServer); +} + +void CMailServerPrefs::GetMailServerType() +{ + int32 n; + + PREF_GetIntPref("mail.server_type", &n); + m_nServerType = (int)n; +} + +void CMailServerPrefs::CheckButtons(HWND hwndList) +{ + int nIndex = ListBox_GetCurSel(hwndList); + if (ListBox_GetCount(hwndList) && nIndex >= 0) + { + EnableDlgItem(IDC_EDIT, TRUE); + EnableDlgItem(IDC_DELETE, TRUE); + if (nIndex == 0) + EnableDlgItem(IDC_DEFAULT, FALSE); + else + EnableDlgItem(IDC_DEFAULT, TRUE); + } + else + { + EnableDlgItem(IDC_EDIT, FALSE); + EnableDlgItem(IDC_DELETE, FALSE); + EnableDlgItem(IDC_DEFAULT, FALSE); + SetFocus(GetDlgItem(m_hwndDlg, IDC_NEW)); + } +} + +void CMailServerPrefs::DoDefaultServer(HWND hwndList) +{ + if (m_nServerType == TYPE_IMAP) + { + CString strNewServer, strDefault, strOldServer, strServer; + int nListCount = ListBox_GetCount(hwndList); + int nCurSel = ListBox_GetCurSel(hwndList); + int nLen = ListBox_GetTextLen(hwndList, nCurSel); + + ListBox_GetText(hwndList, nCurSel, strNewServer.BufferSetLength(nLen)); + strDefault.LoadString(m_hInstance, IDS_DEFAULT); + strNewServer += strDefault; + + nLen = ListBox_GetTextLen(hwndList, 0); + ListBox_GetText(hwndList, 0, strOldServer.BufferSetLength(nLen)); + strServer = strOldServer.Left(strOldServer.GetLength() - strDefault.GetLength()); + ListBox_DeleteString(hwndList, 0); + ListBox_InsertString(hwndList, 0, (LPCSTR)strServer); + ListBox_DeleteString(hwndList, nCurSel); + ListBox_InsertString(hwndList, 0, (LPCSTR)strNewServer); + ListBox_SetCurSel(hwndList, 0); + } +} + +void CMailServerPrefs::GetIMAPServers(HWND hwndList) +{ + char serverStr[512]; + int nLen = 511; + + if (PREF_NOERROR == PREF_GetCharPref("network.hosts.imap_servers", serverStr, &nLen)) + { + int nListCount = ListBox_GetCount(hwndList); + int nOldSel = ListBox_GetCurSel(hwndList); + if (nListCount) + ListBox_ResetContent(hwndList); + + char name[128]; + char* pTemp = serverStr; + nLen = strlen(serverStr); + if (nLen) + { + int j = 0; + BOOL nFirst = TRUE; + for (int i = 0; i <= nLen; i++) + { + if (*pTemp != ',' && *pTemp != '\0') + name[j++] = *pTemp; + else + { + name[j] = '\0'; + CString strText = name; + if (nFirst) + { + nFirst = FALSE; + + CString strDefault; + strDefault.LoadString(m_hInstance, IDS_DEFAULT); + strText += strDefault; + } + ListBox_AddString(hwndList, (LPCSTR)strText); + j = 0; + } + pTemp++; + } + int nTotal = ListBox_GetCount(hwndList); + if (nOldSel < nTotal) + nOldSel = ListBox_SetCurSel(hwndList, nOldSel); + else if (nTotal) + ListBox_SetCurSel(hwndList, 0); + } + } +} + +BOOL CMailServerPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) +{ + if (id == IDC_SERVERS_LIST && notifyCode == LBN_SELCHANGE) + { + CheckButtons(GetDlgItem(m_hwndDlg, IDC_SERVERS_LIST)); + return TRUE; + } + if (notifyCode == BN_CLICKED && + (id == IDC_NEW || id == IDC_EDIT || + id == IDC_DELETE || id == IDC_BUTTON_BROWSE + || id == IDC_DEFAULT)) + { + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + HWND hwndList = GetDlgItem(m_hwndDlg, IDC_SERVERS_LIST); + BOOL bAllowBothTypes = FALSE; + + switch (id) + { + case IDC_NEW: + if (ListBox_GetCount(hwndList) == 0) + bAllowBothTypes = TRUE; + if (lpInterface->AddMailServer(GetParent(m_hwndDlg), + hwndList, bAllowBothTypes, (DWORD)m_nServerType)) + { + GetMailServerType(); + if (m_nServerType == TYPE_IMAP) + { + GetIMAPServers(hwndList); + } + else + GetPopServerName(); + } + break; + case IDC_EDIT: + if (ListBox_GetCount(hwndList) <= 1) + bAllowBothTypes = TRUE; + if (lpInterface->EditMailServer(GetParent(m_hwndDlg), + hwndList, bAllowBothTypes, (DWORD)m_nServerType)) + { + GetMailServerType(); + if (m_nServerType == TYPE_IMAP) + { + GetIMAPServers(hwndList); + } + else + GetPopServerName(); + } + break; + case IDC_DELETE: + if (lpInterface->DeleteMailServer(GetParent(m_hwndDlg), hwndList, + (DWORD)m_nServerType)) + { + if (m_nServerType == TYPE_IMAP) + { + GetIMAPServers(hwndList); + } + else + { //only support one pop server now + m_strPopServer = ""; + } + } + break; + case IDC_BUTTON_BROWSE: + { + LPOLESTR lpoleDirFile = NULL; + + lpInterface->ShowDirectoryPicker(GetParent(m_hwndDlg), + (LPOLESTR)LPCSTR(m_strMailDir), &lpoleDirFile); + if (lpoleDirFile) + { + m_strMailDir = lpoleDirFile; + CoTaskMemFree(lpoleDirFile); + Edit_SetText(GetDlgItem(m_hwndDlg, IDC_EDIT_MAIL_DIR), + (LPCSTR)m_strMailDir); + } + } + break; + case IDC_DEFAULT: + m_bSetDefault = TRUE; + DoDefaultServer(hwndList); + break; + } + lpInterface->Release(); + CheckButtons(hwndList); + return TRUE; + } + } + } + + return CMailNewsPropertyPage::OnCommand(id, hwndCtl, notifyCode); +} + +///////////////////////////////////////////////////////////////////////////// +// CNewsServerPrefs implementation + +CNewsServerPrefs::CNewsServerPrefs() + : CMailNewsPropertyPage(IDD_NEWSSERVER, HELP_PREFS_MAILNEWS_GROUPSERVER) +{ + // Set member data using XP preferences +} + +STDMETHODIMP CNewsServerPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) + { + int32 n; + + PREF_GetStringPref("network.hosts.nntp_server", m_strNewsServer); + PREF_GetStringPref("news.directory", m_strNewsDir); + PREF_GetBoolPref("news.notify.on", &m_bNotify); + PREF_GetBoolPref("news.server_is_secure", &m_bSecure); + PREF_GetIntPref("news.max_articles", &n); + m_nMaxMsgs = (int)n; + PREF_GetIntPref("news.server_port", &n); + m_nPort = (int)n; + } + + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL CNewsServerPrefs::InitDialog() +{ + // Limit the length of the string the user can type + Edit_LimitText(GetDlgItem(m_hwndDlg, IDC_EDIT_MSG_COUNT), 5); + + HWND hwndList = GetDlgItem(m_hwndDlg, IDC_SERVERS_LIST); + if (0 == ListBox_GetCount(hwndList)) + EnableDlgItem(IDC_DEFAULT, FALSE); + + if (CheckIfLockedPref("network.hosts.nntp_server", IDC_SERVERS_LIST)) + { + EnableDlgItem(IDC_NEW, FALSE); + EnableDlgItem(IDC_EDIT, FALSE); + EnableDlgItem(IDC_DELETE, FALSE); + } + if (CheckIfLockedPref("news.directory", IDC_EDIT_NEWS_DIR)) + EnableDlgItem(IDC_BUTTON_BROWSE, FALSE); + CheckIfLockedPref("news.notify.on", IDC_CHECK_NOTIFY); + CheckIfLockedPref("news.max_articles", IDC_EDIT_MSG_COUNT); + + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + CString strNewServer, strDefault; + + HWND hwndList = GetDlgItem(m_hwndDlg, IDC_SERVERS_LIST); + lpInterface->FillNewsServerList(hwndList, (LPOLESTR)LPCSTR(m_strNewsServer), + (LPVOID FAR*)&m_pDefaultServer); + lpInterface->Release(); + + int nServerIndex = GetDefaultServerIndex(hwndList); + if (nServerIndex != -1) + { + strNewServer = m_strNewsServer; + strDefault.LoadString(m_hInstance, IDS_DEFAULT); + strNewServer += strDefault; + + SetServerName(hwndList, nServerIndex, strNewServer); + ListBox_SetCurSel(hwndList, nServerIndex); + } + } + } + return CMailNewsPropertyPage::InitDialog(); +} + +BOOL CNewsServerPrefs::DoTransfer(BOOL bSaveAndValidate) +{ + EditFieldTransfer(IDC_EDIT_NEWS_DIR, m_strNewsDir, bSaveAndValidate); + CheckBoxTransfer(IDC_CHECK_NOTIFY, m_bNotify, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_MSG_COUNT, m_nMaxMsgs, bSaveAndValidate); + return TRUE; +} + +BOOL CNewsServerPrefs::ApplyChanges() +{ + int32 tempInt; + PREF_SetCharPref("network.hosts.nntp_server", m_strNewsServer); + PREF_SetCharPref("news.directory", m_strNewsDir); + PREF_SetBoolPref("news.notify.on", m_bNotify); + PREF_SetIntPref("news.max_articles", (int32)m_nMaxMsgs); + PREF_GetIntPref("news.server_change_xaction", &tempInt); + PREF_SetIntPref("news.server_change_xaction", ++tempInt); + return TRUE; +} + +void CNewsServerPrefs::CheckButtons(HWND hwndList) +{ + int nIndex = ListBox_GetCurSel(hwndList); + if (ListBox_GetCount(hwndList) && nIndex >= 0) + { + EnableDlgItem(IDC_EDIT, TRUE); + EnableDlgItem(IDC_DELETE, TRUE); + int nCurSel = ListBox_GetCurSel(hwndList); + if (nCurSel != GetDefaultServerIndex(hwndList)) + EnableDlgItem(IDC_DEFAULT, TRUE); + else + EnableDlgItem(IDC_DEFAULT, FALSE); + } + else + { + EnableDlgItem(IDC_EDIT, FALSE); + EnableDlgItem(IDC_DELETE, FALSE); + EnableDlgItem(IDC_DEFAULT, FALSE); + SetFocus(GetDlgItem(m_hwndDlg, IDC_NEW)); + } +} + +void CNewsServerPrefs::SetServerName(HWND hwndList, int nIndex, CString& name) +{ + LPVOID pServer = (LPVOID)ListBox_GetItemData(hwndList, nIndex); + ListBox_DeleteString(hwndList, nIndex); + ListBox_InsertString(hwndList, nIndex, (LPCSTR)name); + ListBox_SetItemData(hwndList, nIndex, pServer); +} + +int CNewsServerPrefs::GetDefaultServerIndex(HWND hwndList) +{ + LPVOID pServer = NULL; + int nListCount = ListBox_GetCount(hwndList); + for (int i = 0; i < nListCount; i++) + { + pServer = (LPVOID)ListBox_GetItemData(hwndList, i); + if (m_pDefaultServer == pServer) + { + return i; + } + } + return -1; +} + +void CNewsServerPrefs::DoDefaultServer(HWND hwndList) +{ + CString strNewServer, strDefault, strOldServer, strServer; + int nListCount = ListBox_GetCount(hwndList); + int nCurSel = ListBox_GetCurSel(hwndList); + int nLen = ListBox_GetTextLen(hwndList, nCurSel); + + ListBox_GetText(hwndList, nCurSel, strNewServer.BufferSetLength(nLen)); + m_strNewsServer = strNewServer; + strDefault.LoadString(m_hInstance, IDS_DEFAULT); + strNewServer += strDefault; + + SetServerName(hwndList, nCurSel, strNewServer); + + int nServerIndex = GetDefaultServerIndex(hwndList); + if (nServerIndex >= 0) + { + nLen = ListBox_GetTextLen(hwndList, nServerIndex); + ListBox_GetText(hwndList, nServerIndex, strOldServer.BufferSetLength(nLen)); + strServer = strOldServer.Left(strOldServer.GetLength() - strDefault.GetLength()); + SetServerName(hwndList, nServerIndex, strServer); + } + + m_pDefaultServer = (LPVOID)ListBox_GetItemData(hwndList, nCurSel); + ListBox_SetCurSel(hwndList, nCurSel); +} + +BOOL CNewsServerPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) +{ + if (id == IDC_EDIT_MSG_COUNT && notifyCode == EN_UPDATE) + { + ValidateNumeric(m_hwndDlg, m_hInstance, IDS_GROUPS_SERVER, + id, m_nMaxMsgs); + return TRUE; + } + if (id == IDC_SERVERS_LIST && notifyCode == LBN_SELCHANGE) + { + CheckButtons(GetDlgItem(m_hwndDlg, IDC_SERVERS_LIST)); + return TRUE; + } + if (notifyCode == BN_CLICKED && + (id == IDC_NEW || id == IDC_EDIT || id == IDC_DELETE || + id == IDC_DEFAULT || id == IDC_BUTTON_BROWSE)) + { + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + HWND hwndList = GetDlgItem(m_hwndDlg, IDC_SERVERS_LIST); + BOOL bChanged = FALSE; + int nIndex = -1; + LPVOID lpOldDefault = m_pDefaultServer; + + switch (id) + { + case IDC_NEW: + lpInterface->AddNewsServer(GetParent(m_hwndDlg), hwndList); + break; + case IDC_EDIT: + lpInterface->EditNewsServer(GetParent(m_hwndDlg), hwndList, &bChanged); + break; + case IDC_DELETE: + lpInterface->DeleteNewsServer(GetParent(m_hwndDlg), hwndList, &m_pDefaultServer); + if (m_pDefaultServer != lpOldDefault) + { + CString strNewServer, strDefault; + int nIndex = GetDefaultServerIndex(hwndList); + int nLen = ListBox_GetTextLen(hwndList, nIndex); + + ListBox_GetText(hwndList, nIndex, strNewServer.BufferSetLength(nLen)); + m_strNewsServer = strNewServer; + strDefault.LoadString(m_hInstance, IDS_DEFAULT); + strNewServer += strDefault; + + SetServerName(hwndList, nIndex, strNewServer); + ListBox_SetCurSel(hwndList, nIndex); + } + break; + case IDC_DEFAULT: + DoDefaultServer(hwndList); + break; + case IDC_BUTTON_BROWSE: + LPOLESTR lpoleDirFile = NULL; + + lpInterface->ShowDirectoryPicker(GetParent(m_hwndDlg), + (LPOLESTR)LPCSTR(m_strNewsDir), &lpoleDirFile); + if (lpoleDirFile) + { + m_strNewsDir = lpoleDirFile; + CoTaskMemFree(lpoleDirFile); + Edit_SetText(GetDlgItem(m_hwndDlg, IDC_EDIT_NEWS_DIR), + (LPCSTR)m_strNewsDir); + } + break; + } + lpInterface->Release(); + CheckButtons(hwndList); + + return TRUE; + } + } + } + return CMailNewsPropertyPage::OnCommand(id, hwndCtl, notifyCode); +} + +///////////////////////////////////////////////////////////////////////////// +// CCustomizedDialog implementation + +class CCustomizedDialog : public CDialog { + public: + CCustomizedDialog(); + + protected: + BOOL InitDialog(); + BOOL DoTransfer(BOOL bSaveAndValidate); + + // Event processing + void OnOK(); + + private: + + int m_nCheckGeneral; + int m_nCheckOtherDomain; + int m_nCheckNotOnList; +}; + +CCustomizedDialog::CCustomizedDialog() + : CDialog(CComDll::m_hInstance, IDD_RECEIPT_CUSTOMIZE) +{ + m_nCheckGeneral = 0; + m_nCheckOtherDomain = 0; + m_nCheckNotOnList = 0; + + int32 n = 0; + PREF_GetIntPref("mail.mdn.report.other", &n); + m_nCheckGeneral = (int)n; + PREF_GetIntPref("mail.mdn.report.outside_domain", &n); + m_nCheckOtherDomain = (int)n; + PREF_GetIntPref("mail.mdn.report.not_in_to_cc", &n); + m_nCheckNotOnList = (int)n; + +} + +BOOL CCustomizedDialog::InitDialog() +{ + char szBuf[256]; + //make sure the control IDs and string IDs are continuous number + for (int j = IDC_NOT_TOCC; j <= IDC_GENERAL; j++) + { + HWND hwndCombo = GetDlgItem(m_hwndDlg, j); + for (int i = IDS_NEVER; i <= IDS_ASK_ME; i++) + { + int nLen = LoadString(m_hInstance, i, szBuf, sizeof(szBuf)); + + assert(nLen > 0); + ComboBox_AddString(hwndCombo, szBuf); + } + } + + if (MNPREF_PrefIsLocked("mail.mdn.report.other")) + { + EnableDlgItem(IDC_STATIC1, FALSE); + EnableDlgItem(IDC_GENERAL, FALSE); + } + if (MNPREF_PrefIsLocked("mail.mdn.report.outside_domain")) + { + EnableDlgItem(IDC_STATIC2, FALSE); + EnableDlgItem(IDC_OUTSIDE_DOMAIN, FALSE); + } + if (MNPREF_PrefIsLocked("mail.mdn.report.not_in_to_cc")) + { + EnableDlgItem(IDC_STATIC3, FALSE); + EnableDlgItem(IDC_NOT_TOCC, FALSE); + } + + return CDialog::InitDialog(); +} + +BOOL CCustomizedDialog::DoTransfer(BOOL bSaveAndValidate) +{ + ComboBoxTransfer(IDC_GENERAL , m_nCheckGeneral, bSaveAndValidate); + ComboBoxTransfer(IDC_OUTSIDE_DOMAIN , m_nCheckOtherDomain, bSaveAndValidate); + ComboBoxTransfer(IDC_NOT_TOCC , m_nCheckNotOnList, bSaveAndValidate); + return TRUE; +} + +void CCustomizedDialog::OnOK() +{ + // Transfer data from the dialog and then destroy the dialog window + CDialog::OnOK(); + + // Apply changes using XP preferences + + PREF_SetIntPref("mail.mdn.report.other", (int32)m_nCheckGeneral); + PREF_SetIntPref("mail.mdn.report.outside_domain", (int32)m_nCheckOtherDomain); + PREF_SetIntPref("mail.mdn.report.not_in_to_cc", (int32)m_nCheckNotOnList); +} + +///////////////////////////////////////////////////////////////////////////// +// CMailReceiptPrefs implementation + +CMailReceiptPrefs::CMailReceiptPrefs() + : CMailNewsPropertyPage(IDD_READRECEIPT, HELP_PREFS_MAILNEWS_RECEIPTS) +{ + m_nRequestReceipt = 0; + m_nReceiptArrive = 0; + m_nEnableRespond = 0; +} + +BOOL CMailReceiptPrefs::InitDialog() +{ + if (MNPREF_PrefIsLocked("mail.request.return_receipt")) + { + EnableDlgItem(IDC_RADIO_SERVER_ONLY, FALSE); + EnableDlgItem(IDC_RADIO_CLIENT_ONLY, FALSE); + EnableDlgItem(IDC_RADIO_BOTH, FALSE); + } + if (MNPREF_PrefIsLocked("mail.incorporate.return_receipt")) + { + EnableDlgItem(IDC_RADIO_IN_INBOX, FALSE); + EnableDlgItem(IDC_RADIO_TO_SENT, FALSE); + } + if (MNPREF_PrefIsLocked("mail.mdn.report.enabled")) + { + EnableDlgItem(IDC_RADIO_NO_RECEIPT, FALSE); + EnableDlgItem(IDC_RADIO_CUSTOMIZE_RECEIPT, FALSE); + } + + return CMailNewsPropertyPage::InitDialog(); +} + +STDMETHODIMP CMailReceiptPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) + { + int32 n = 0; + + PREF_GetIntPref("mail.request.return_receipt", &n); + m_nRequestReceipt = (int)(n-1); + PREF_GetIntPref("mail.incorporate.return_receipt", &n); + m_nReceiptArrive = (int)n; + + BOOL bPref = FALSE; + PREF_GetBoolPref("mail.mdn.report.enabled", &bPref); + if (bPref) + m_nEnableRespond = 1; + else + m_nEnableRespond = 0; + } + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL CMailReceiptPrefs::DoTransfer(BOOL bSaveAndValidate) +{ + RadioButtonTransfer(IDC_RADIO_SERVER_ONLY, m_nRequestReceipt, bSaveAndValidate); + RadioButtonTransfer(IDC_RADIO_IN_INBOX, m_nReceiptArrive, bSaveAndValidate); + RadioButtonTransfer(IDC_RADIO_NO_RECEIPT, m_nEnableRespond, bSaveAndValidate); + return TRUE; +} + +BOOL CMailReceiptPrefs::ApplyChanges() +{ + // Apply changes using XP preferences + PREF_SetIntPref("mail.request.return_receipt", (int32)(m_nRequestReceipt+1)); + PREF_SetIntPref("mail.incorporate.return_receipt", (int32)m_nReceiptArrive); + if (m_nEnableRespond == 0) + PREF_SetBoolPref("mail.mdn.report.enabled", FALSE); + else + PREF_SetBoolPref("mail.mdn.report.enabled", TRUE); + return TRUE; +} + +BOOL CMailReceiptPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) +{ + if (id == IDC_CUSTOMIZE && notifyCode == BN_CLICKED) + { + CCustomizedDialog customDialog; + customDialog.DoModal(GetParent(m_hwndDlg)); + return TRUE; + } + + return CMailNewsPropertyPage::OnCommand(id, hwndCtl, notifyCode); +} + +///////////////////////////////////////////////////////////////////////////// +// CHTMLFormatPrefs implementation + +CHTMLFormatPrefs::CHTMLFormatPrefs() + : CMailNewsPropertyPage(IDD_HTML_FORMATTING, HELP_PREFS_MAILNEWS_FORMATTING) +{ +} + +BOOL CHTMLFormatPrefs::InitDialog() +{ + CheckIfLockedPref("mail.html_compose", IDC_HTMLCOMPOSE); + CheckIfLockedPref("mail.html_compose", IDC_PLAINCOMPOSE); + + if (MNPREF_PrefIsLocked("mail.default_html_action")) + { + EnableDlgItem(IDC_ASK, FALSE); + EnableDlgItem(IDC_PLAIN, FALSE); + EnableDlgItem(IDC_ANYWAY, FALSE); + EnableDlgItem(IDC_BOTH, FALSE); + } + + return CMailNewsPropertyPage::InitDialog(); +} + +STDMETHODIMP CHTMLFormatPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) + { + BOOL bHtmlCompose; + int32 n = 0; + + PREF_GetBoolPref("mail.html_compose", &bHtmlCompose); + if (bHtmlCompose) + m_nRadioCompose = 0; + else + m_nRadioCompose = 1; + PREF_GetIntPref("mail.default_html_action", &n); + m_nRadioHTML = (int)n; + } + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL CHTMLFormatPrefs::DoTransfer(BOOL bSaveAndValidate) +{ + RadioButtonTransfer(IDC_HTMLCOMPOSE, m_nRadioCompose, bSaveAndValidate); + RadioButtonTransfer(IDC_ASK, m_nRadioHTML, bSaveAndValidate); + return TRUE; +} + +BOOL CHTMLFormatPrefs::ApplyChanges() +{ + // Apply changes using XP preferences + if (m_nRadioCompose == 0) + PREF_SetBoolPref("mail.html_compose", TRUE); + else + PREF_SetBoolPref("mail.html_compose", FALSE); + PREF_SetIntPref("mail.default_html_action", (int32)m_nRadioHTML); + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// COutgoingMsgPrefs implementation + +COutgoingMsgPrefs::COutgoingMsgPrefs() + : CMailNewsPropertyPage(IDD_OUTGOING_MSG, HELP_PREFS_MAILNEWS_COPIES) +{ +} + +BOOL COutgoingMsgPrefs::InitDialog() +{ + CheckIfLockedPref("mail.cc_self", IDC_CHECK_MAIL_SELF); + CheckIfLockedPref("mail.default_cc", IDC_EDIT_MAIL_TOADDRESS); + CheckIfLockedPref("news.cc_self", IDC_CHECK_NEWS_SELF); + CheckIfLockedPref("news.default_cc", IDC_EDIT_NEWS_TOADDRESS); + CheckIfLockedPref("mail.use_fcc", IDC_CHECK_MAIL_FOLDER); + CheckIfLockedPref("mail.default_fcc", IDC_CHECK_MAIL_FOLDER); + CheckIfLockedPref("news.use_fcc", IDC_CHECK_NEWS_FOLDER); + CheckIfLockedPref("news.default_fcc", IDC_CHECK_NEWS_FOLDER); + CheckIfLockedPref("mail.default_drafts", IDC_STATIC_DRAFT); + CheckIfLockedPref("mail.default_templates", IDC_STATIC_TEMPLATE); + + if (m_bMailImapFcc) + PREF_GetStringPref("mail.imap_sentmail_path", m_strMailFccFolder); + else + PREF_GetStringPref("mail.default_fcc", m_strMailFccFolder); + if (m_bNewsImapFcc) + PREF_GetStringPref("news.imap_sentmail_path", m_strNewsFccFolder); + else + PREF_GetStringPref("news.default_fcc", m_strNewsFccFolder); + PREF_GetStringPref("mail.default_drafts", m_strDraftFolder); + PREF_GetStringPref("mail.default_templates", m_strTemplateFolder); + GetCheckText(m_strMailFccFolder, TYPE_SENTMAIL, IDC_CHECK_MAIL_FOLDER, + IDS_FOLDER_MAIL); + GetCheckText(m_strNewsFccFolder, TYPE_SENTNEWS, IDC_CHECK_NEWS_FOLDER, + IDS_FOLDER_NEWS); + GetCheckText(m_strDraftFolder, TYPE_DRAFT, IDC_STATIC_DRAFT, + IDS_FOLDER_DRAFT); + GetCheckText(m_strTemplateFolder, TYPE_TEMPLATE, IDC_STATIC_TEMPLATE, + IDS_FOLDER_TEMPLATE); + + return CMailNewsPropertyPage::InitDialog(); +} + +STDMETHODIMP +COutgoingMsgPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) { + + PREF_GetBoolPref("mail.cc_self", &m_bMailCcSelf); + PREF_GetStringPref("mail.default_cc", m_strMailDefaultCc); + PREF_GetBoolPref("news.cc_self", &m_bNewsCcSelf); + PREF_GetStringPref("news.default_cc", m_strNewsDefaultCc); + + PREF_GetBoolPref("mail.use_fcc", &m_bMailUseFcc); + PREF_GetBoolPref("news.use_fcc", &m_bNewsUseFcc); + + PREF_GetBoolPref("mail.use_imap_sentmail", &m_bMailImapFcc); + PREF_GetBoolPref("news.use_imap_sentmail", &m_bNewsImapFcc); + } + + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL COutgoingMsgPrefs::DoTransfer(BOOL bSaveAndValidate) +{ + CheckBoxTransfer(IDC_CHECK_MAIL_SELF, m_bMailCcSelf, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_MAIL_TOADDRESS, m_strMailDefaultCc, bSaveAndValidate); + CheckBoxTransfer(IDC_CHECK_NEWS_SELF, m_bNewsCcSelf, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_NEWS_TOADDRESS, m_strNewsDefaultCc, bSaveAndValidate); + CheckBoxTransfer(IDC_CHECK_MAIL_FOLDER, m_bMailUseFcc, bSaveAndValidate); + CheckBoxTransfer(IDC_CHECK_NEWS_FOLDER, m_bNewsUseFcc, bSaveAndValidate); + + return TRUE; +} + +BOOL COutgoingMsgPrefs::ApplyChanges() +{ + CString tmpStr; + PREF_SetBoolPref("mail.cc_self", m_bMailCcSelf); + PREF_SetCharPref("mail.default_cc", m_strMailDefaultCc); + PREF_SetBoolPref("news.cc_self", m_bNewsCcSelf); + PREF_SetCharPref("news.default_cc", m_strNewsDefaultCc); + + PREF_SetBoolPref("mail.use_fcc", m_bMailUseFcc); + tmpStr = m_strMailFccFolder; + tmpStr.MakeLower(); + if (strstr(tmpStr, "imap://")) + { + PREF_SetBoolPref("mail.use_imap_sentmail", TRUE); + PREF_SetCharPref("mail.imap_sentmail_path", m_strMailFccFolder); + } + else + { + PREF_SetBoolPref("mail.use_imap_sentmail", FALSE); + PREF_SetCharPref("mail.default_fcc", m_strMailFccFolder); + } + PREF_SetBoolPref("news.use_fcc", m_bNewsUseFcc); + tmpStr = m_strNewsFccFolder; + tmpStr.MakeLower(); + if (strstr(tmpStr, "imap://")) + { + PREF_SetBoolPref("news.use_imap_sentmail", TRUE); + PREF_SetCharPref("news.imap_sentmail_path", m_strNewsFccFolder); + } + else + { + PREF_SetBoolPref("news.use_imap_sentmail", FALSE); + PREF_SetCharPref("news.default_fcc", m_strNewsFccFolder); + } + + PREF_SetCharPref("mail.default_drafts", m_strDraftFolder); + PREF_SetCharPref("mail.default_templates", m_strTemplateFolder); + return TRUE; +} + +BOOL COutgoingMsgPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) +{ + if (notifyCode == BN_CLICKED) + { + switch (id) + { + case IDC_CHOOSE_FOLDER_MAIL: + ChooseFolder(m_strMailFccFolder, TYPE_SENTMAIL, + IDC_CHECK_MAIL_FOLDER, IDS_FOLDER_MAIL); + return TRUE; + case IDC_CHOOSE_FOLDER_NEWS: + ChooseFolder(m_strNewsFccFolder, TYPE_SENTNEWS, + IDC_CHECK_NEWS_FOLDER, IDS_FOLDER_NEWS); + return TRUE; + case IDC_CHOOSE_FOLDER_DRAFT: + ChooseFolder(m_strDraftFolder, TYPE_DRAFT, + IDC_STATIC_DRAFT, IDS_FOLDER_DRAFT); + return TRUE; + case IDC_CHOOSE_FOLDER_TEMPLATE: + ChooseFolder(m_strTemplateFolder, TYPE_TEMPLATE, + IDC_STATIC_TEMPLATE, IDS_FOLDER_TEMPLATE); + return TRUE; + } + } + + return CMailNewsPropertyPage::OnCommand(id, hwndCtl, notifyCode); +} + +void COutgoingMsgPrefs::GetCheckText +(CString& szFolderPath, int nType, int nCtlID, int nStrID) +{ + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + LPOLESTR lpoleFolder = NULL; + LPOLESTR lpoleServer = NULL; + lpInterface->GetFolderServer((LPOLESTR)LPCSTR(szFolderPath), (DWORD)nType, + &lpoleFolder, &lpoleServer); + if (lpoleFolder && lpoleServer) + { + CString folder = lpoleFolder; + CString server = lpoleServer; + SetCheckText(LPCSTR(folder), LPCSTR(server), nCtlID, nStrID); + CoTaskMemFree(lpoleFolder); + CoTaskMemFree(lpoleServer); + } + lpInterface->Release(); + } + } +} + +void COutgoingMsgPrefs::ChooseFolder +(CString& szFolderPath, int nType, int nCtlID, int nStrID) +{ + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + LPOLESTR lpoleFolder = NULL; + LPOLESTR lpoleServer = NULL; + LPOLESTR lpolePref = NULL; + lpInterface->ShowChooseFolder(GetParent(m_hwndDlg), + (LPOLESTR)LPCSTR(szFolderPath), (DWORD)nType, + &lpoleFolder, &lpoleServer, &lpolePref); + if (lpoleFolder && lpoleServer) + { + CString folder = lpoleFolder; + CString server = lpoleServer; + SetCheckText(LPCSTR(folder), LPCSTR(server), nCtlID, nStrID); + CoTaskMemFree(lpoleFolder); + CoTaskMemFree(lpoleServer); + } + if (lpolePref) + { + szFolderPath = lpolePref; + CoTaskMemFree(lpolePref); + } + lpInterface->Release(); + } + } +} + +void COutgoingMsgPrefs::SetCheckText(const char* pFolder, const char* pServer, int nCtlID, int nStrID) +{ + char szFormat[256], szText[256]; + int nLen = LoadString(m_hInstance, nStrID, szFormat, sizeof(szFormat)); + sprintf(szText, LPCSTR(szFormat), pFolder, pServer); + if (nCtlID == IDC_STATIC_DRAFT || nCtlID == IDC_STATIC_TEMPLATE) + Static_SetText(GetDlgItem(m_hwndDlg, nCtlID), szText); + else + Button_SetText(GetDlgItem(m_hwndDlg, nCtlID), szText); +} + + +///////////////////////////////////////////////////////////////////////////// +// CAddressingPrefs implementation + +CAddressingPrefs::CAddressingPrefs() + : CMailNewsPropertyPage(IDD_ADDRESSING, HELP_PREFS_MAILNEWS_ADDRESSING) +{ + m_bInAddressBook = FALSE; + m_bInDirectory = FALSE; + m_bMatchPabName = FALSE; +} + +STDMETHODIMP CAddressingPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) + { + PREF_GetBoolPref("ldap_1.autoComplete.useAddressBooks", &m_bInAddressBook); + PREF_GetBoolPref("ldap_1.autoComplete.useDirectory", &m_bInDirectory); + PREF_GetBoolPref("ldap_1.autoComplete.skipDirectoryIfLocalMatchFound", &m_bMatchPabName); + BOOL bTemp; + PREF_GetBoolPref("ldap_1.autoComplete.showDialogForMultipleMatches", &bTemp); + if (bTemp) + m_nRadioListChoice = 0; + else + m_nRadioListChoice = 1; + PREF_GetBoolPref("mail.addr_book.lastnamefirst", &bTemp); + if (bTemp) + m_nRadioSortChoice = 1; + else + m_nRadioSortChoice = 0; + } + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL CAddressingPrefs::DoTransfer(BOOL bSaveAndValidate) +{ + CheckBoxTransfer(IDC_CHECK_IN_PAB, m_bInAddressBook, bSaveAndValidate); + CheckBoxTransfer(IDC_CHECK_IN_DIR, m_bInDirectory, bSaveAndValidate); + ComboBoxTransfer(IDC_COMBO_DIRS, m_strLdapDir, bSaveAndValidate); + CheckBoxTransfer(IDC_CHECK_PAB_FIRST, m_bMatchPabName, bSaveAndValidate); + + RadioButtonTransfer(IDC_RADIO_SHOW, m_nRadioListChoice, bSaveAndValidate); + RadioButtonTransfer(IDC_FIRSTNAME_FIRST, m_nRadioSortChoice, bSaveAndValidate); + return TRUE; +} + +BOOL CAddressingPrefs::ApplyChanges() +{ + // Apply changes using XP preferences + PREF_SetBoolPref("ldap_1.autoComplete.useAddressBooks", m_bInAddressBook); + PREF_SetBoolPref("ldap_1.autoComplete.useDirectory", m_bInDirectory); + PREF_SetBoolPref("ldap_1.autoComplete.skipDirectoryIfLocalMatchFound", m_bMatchPabName); + if (m_nRadioListChoice == 0) + PREF_SetBoolPref("ldap_1.autoComplete.showDialogForMultipleMatches", TRUE); + else + PREF_SetBoolPref("ldap_1.autoComplete.showDialogForMultipleMatches", FALSE); + + if (m_nRadioSortChoice == 0) + PREF_SetBoolPref("mail.addr_book.lastnamefirst", FALSE); + else + PREF_SetBoolPref("mail.addr_book.lastnamefirst", TRUE); + + //we need to save the changes made to which directory to autocomplete from + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + lpInterface->SaveLdapDirAutoComplete(); + lpInterface->Release(); + } + } + + return TRUE; +} + +BOOL CAddressingPrefs::InitDialog() +{ + // Fill the list box with the list of accept languages + FillDirComboBox(); + + if (m_bInAddressBook && m_bInDirectory) + EnableDlgItem(IDC_CHECK_PAB_FIRST, TRUE); + else + EnableDlgItem(IDC_CHECK_PAB_FIRST, FALSE); + + if (MNPREF_PrefIsLocked("ldap_1.autoComplete.useAddressBooks")) + EnableDlgItem(IDC_CHECK_IN_PAB, FALSE); + if (MNPREF_PrefIsLocked("ldap_1.autoComplete.useDirectory")) + { + EnableDlgItem(IDC_CHECK_IN_DIR, FALSE); + EnableDlgItem(IDC_COMBO_DIRS, FALSE); + } + if (MNPREF_PrefIsLocked("ldap_1.autoComplete.skipDirectoryIfLocalMatchFound")) + EnableDlgItem(IDC_CHECK_PAB_FIRST, FALSE); + if (MNPREF_PrefIsLocked("ldap_1.autoComplete.showDialogForMultipleMatches")) + { + EnableDlgItem(IDC_RADIO_SHOW, FALSE); + EnableDlgItem(IDC_RADIO_NO_SHOW, FALSE); + } + if (MNPREF_PrefIsLocked("mail.addr_book.lastnamefirst")) + { + EnableDlgItem(IDC_FIRSTNAME_FIRST, FALSE); + EnableDlgItem(IDC_LASTNAME_FIRST, FALSE); + } + + return CMailNewsPropertyPage::InitDialog(); +} + +void CAddressingPrefs::FillDirComboBox() +{ + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + char szDir[256]; + HWND hwndList = GetDlgItem(m_hwndDlg, IDC_COMBO_DIRS); + lpInterface->FillLdapDirList(hwndList, NULL); + int index = ComboBox_GetCurSel(hwndList); + ComboBox_GetLBText(hwndList, index, szDir); + m_strLdapDir = szDir; + lpInterface->Release(); + } + } +} + +void CAddressingPrefs::SetDirAutoComplete(BOOL bOnOrOff) +{ + assert(m_pObject); + if (m_pObject) + { + LPMAILNEWSINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_MailNewsInterface, + (void **)&lpInterface))) + { + HWND hwndList = GetDlgItem(m_hwndDlg, IDC_COMBO_DIRS); + lpInterface->SetLdapDirAutoComplete(hwndList, bOnOrOff); + lpInterface->Release(); + } + } +} + +BOOL CAddressingPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) +{ + if ((id == IDC_CHECK_IN_PAB || id == IDC_CHECK_IN_DIR) && + notifyCode == BN_CLICKED) + { + if (IsDlgButtonChecked(m_hwndDlg, IDC_CHECK_IN_PAB) && + IsDlgButtonChecked(m_hwndDlg, IDC_CHECK_IN_DIR)) + EnableDlgItem(IDC_CHECK_PAB_FIRST, TRUE); + else + EnableDlgItem(IDC_CHECK_PAB_FIRST, FALSE); + } + + if (id == IDC_CHECK_IN_DIR && notifyCode == BN_CLICKED) + { + if (IsDlgButtonChecked(m_hwndDlg, IDC_CHECK_IN_DIR)) + SetDirAutoComplete(TRUE); + else + SetDirAutoComplete(FALSE); + } + if (id == IDC_COMBO_DIRS && notifyCode == CBN_SELCHANGE) + { + if (IsDlgButtonChecked(m_hwndDlg, IDC_CHECK_IN_DIR)) + SetDirAutoComplete(TRUE); + + char szDir[256]; + HWND hwndList = GetDlgItem(m_hwndDlg, IDC_COMBO_DIRS); + int index = ComboBox_GetCurSel(hwndList); + ComboBox_GetLBText(hwndList, index, szDir); + m_strLdapDir = szDir; + } + return CMailNewsPropertyPage::OnCommand(id, hwndCtl, notifyCode); +} + +///////////////////////////////////////////////////////////////////////////// +// CDiskSpacePrefs implementation + +CDiskSpacePrefs::CDiskSpacePrefs() + : CMailNewsPropertyPage(IDD_DISK_SPACE, HELP_PREFS_ADVANCED_DISK_SPACE) +{ +} + +// Initialize member data using XP preferences +STDMETHODIMP CDiskSpacePrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) { + int32 n; + + PREF_GetBoolPref("mail.limit_message_size", &m_bLimitSize); + PREF_GetIntPref("mail.max_size", &n); + m_nLimitSize = (int)n; + + PREF_GetBoolPref("mail.prompt_purge_threshhold", &m_bPromptPurge); + PREF_GetIntPref("mail.purge_threshhold", &n); + m_nPurgeSize = (int)n; + + PREF_GetIntPref("news.keep.method", &n); + + // ui radio buttons do not correspond to the preference + if (n == 0) + m_nKeepMethod = 1; + else if (n == 1) + m_nKeepMethod = 0; + else + m_nKeepMethod = n; + + PREF_GetIntPref("news.keep.days", &n); + m_nKeepDays = (int)n; + PREF_GetIntPref("news.keep.count", &n); + m_nKeepCounts = (int)n; + + PREF_GetBoolPref("news.keep.only_unread", &m_bKeepUnread); + + PREF_GetBoolPref("news.remove_bodies.by_age", &m_bRemoveBody); + PREF_GetIntPref("news.remove_bodies.days", &n); + m_nRemoveDays = (int)n; + } + + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL CDiskSpacePrefs::InitDialog() +{ + // Limit the length of the string the user can type + Edit_LimitText(GetDlgItem(m_hwndDlg, IDC_EDIT_MSG_SIZE), 5); + Edit_LimitText(GetDlgItem(m_hwndDlg, IDC_EDIT_COMPACT_SIZE), 5); + Edit_LimitText(GetDlgItem(m_hwndDlg, IDC_EDIT_MSG_DAYS), 5); + Edit_LimitText(GetDlgItem(m_hwndDlg, IDC_EDIT_MSG_COUNT), 5); + Edit_LimitText(GetDlgItem(m_hwndDlg, IDC_EDIT_REMOVE_DAYS), 5); + + // Check for locked preferences + if (MNPREF_PrefIsLocked("mail.limit_message_size")) + EnableDlgItem(IDC_CHECK_MSG_SIZE, FALSE); + if (MNPREF_PrefIsLocked("mail.max_size")) + EnableDlgItem(IDC_EDIT_MSG_SIZE, FALSE); + if (MNPREF_PrefIsLocked("mail.prompt_purge_threshhold")) + EnableDlgItem(IDC_CHECK_COMPACT_SIZE, FALSE); + if (MNPREF_PrefIsLocked("mail.purge_threshhold")) + EnableDlgItem(IDC_EDIT_COMPACT_SIZE, FALSE); + + if (MNPREF_PrefIsLocked("news.keep.method")) { + EnableDlgItem(IDC_KEEP_MSG_DAYS, FALSE); + EnableDlgItem(IDC_KEEP_ALL, FALSE); + EnableDlgItem(IDC_KEEP_COUNT, FALSE); + } + + if (MNPREF_PrefIsLocked("news.keep.days")) + EnableDlgItem(IDC_EDIT_MSG_DAYS, FALSE); + if (MNPREF_PrefIsLocked("news.keep.count")) + EnableDlgItem(IDC_EDIT_MSG_COUNT, FALSE); + if (MNPREF_PrefIsLocked("news.keep.only_unread")) + EnableDlgItem(IDC_KEEP_UNREAD, FALSE); + + if (MNPREF_PrefIsLocked("news.remove_bodies.by_age")) + EnableDlgItem(IDC_CHECK_MSG_DAYS, FALSE); + if (MNPREF_PrefIsLocked("news.remove_bodies.days")) + EnableDlgItem(IDC_EDIT_REMOVE_DAYS, FALSE); + + return CMailNewsPropertyPage::InitDialog(); +} + +BOOL CDiskSpacePrefs::DoTransfer(BOOL bSaveAndValidate) +{ + CheckBoxTransfer(IDC_CHECK_MSG_SIZE, m_bLimitSize, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_MSG_SIZE, m_nLimitSize, bSaveAndValidate); + CheckBoxTransfer(IDC_CHECK_COMPACT_SIZE, m_bPromptPurge, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_COMPACT_SIZE, m_nPurgeSize, bSaveAndValidate); + RadioButtonTransfer(IDC_KEEP_MSG_DAYS, m_nKeepMethod, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_MSG_DAYS, m_nKeepDays, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_MSG_COUNT, m_nKeepCounts, bSaveAndValidate); + CheckBoxTransfer(IDC_KEEP_UNREAD, m_bKeepUnread, bSaveAndValidate); + CheckBoxTransfer(IDC_CHECK_MSG_DAYS, m_bRemoveBody, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_REMOVE_DAYS, m_nRemoveDays, bSaveAndValidate); + return TRUE; +} + +// Apply changes using XP preferences +BOOL CDiskSpacePrefs::ApplyChanges() +{ + PREF_SetBoolPref("mail.limit_message_size", m_bLimitSize); + PREF_SetIntPref("mail.max_size", (int32)m_nLimitSize); + + PREF_SetBoolPref("mail.prompt_purge_threshhold", m_bPromptPurge); + PREF_SetIntPref("mail.purge_threshhold", (int32)m_nPurgeSize); + + // ui radio buttons do not correspond to the preference + int32 realKeepMethod; + if (m_nKeepMethod == 0) + realKeepMethod = 1; + else if (m_nKeepMethod == 1) + realKeepMethod = 0; + else + realKeepMethod = m_nKeepMethod; + + PREF_SetIntPref("news.keep.method", (int32)realKeepMethod); + PREF_SetIntPref("news.keep.days", (int32)m_nKeepDays); + PREF_SetIntPref("news.keep.count", (int32)m_nKeepCounts); + + PREF_SetBoolPref("news.keep.only_unread", m_bKeepUnread); + + PREF_SetBoolPref("news.remove_bodies.by_age", m_bRemoveBody); + PREF_SetIntPref("news.remove_bodies.days", (int32)m_nRemoveDays); + + // Apply changes using XP preferences + return TRUE; +} + +BOOL CDiskSpacePrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) +{ + switch (id) + { + case IDC_EDIT_MSG_SIZE: + if (notifyCode == EN_UPDATE) + ValidateNumeric(m_hwndDlg, m_hInstance, IDS_DISK_SPACE, + id, m_nLimitSize); + return TRUE; + + case IDC_EDIT_COMPACT_SIZE: + if (notifyCode == EN_UPDATE) + ValidateNumeric(m_hwndDlg, m_hInstance, IDS_DISK_SPACE, + id, m_nPurgeSize); + return TRUE; + + case IDC_EDIT_MSG_DAYS: + if (notifyCode == EN_UPDATE) + ValidateNumeric(m_hwndDlg, m_hInstance, IDS_DISK_SPACE, + id, m_nKeepDays); + return TRUE; + + case IDC_EDIT_MSG_COUNT: + if (notifyCode == EN_UPDATE) + ValidateNumeric(m_hwndDlg, m_hInstance, IDS_DISK_SPACE, + id, m_nKeepCounts); + return TRUE; + case IDC_EDIT_REMOVE_DAYS: + if (notifyCode == EN_UPDATE) + ValidateNumeric(m_hwndDlg, m_hInstance, IDS_DISK_SPACE, + id, m_nRemoveDays); + return TRUE; + } + return CMailNewsPropertyPage::OnCommand(id, hwndCtl, notifyCode); +} diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/mnpref.cpp b/mozilla/cmd/winfe/prefs/mnpref/src/mnpref.cpp new file mode 100644 index 00000000000..fa776849d8e --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/mnpref.cpp @@ -0,0 +1,509 @@ +/* -*- 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. + */ + +#include "pch.h" +#include "mnpref.h" +#include "pages.h" +#include "mnprefid.h" +#include "prefuiid.h" +#include "isppageo.h" +#include + +// Create a new instance of our derived class and return it. +CComDll * +DLL_ConsumerCreateInstance() +{ + return new CMailNewsPrefsDll; +} + +///////////////////////////////////////////////////////////////////////////// +// Global new/delete operators + +// Override the global new/delete operators to allocate memory owned by the +// application and not by the DLL; _fmalloc calls GlobalAlloc with GMEM_SHARE +// for DLLs and that means the memory will not be freed until the DLL is +// unloaded. _fmalloc only maintains one heap for a DLL which is shared by +// all applications that use the DLL +#ifndef _WIN32 +void * +operator new (size_t size) +{ + return CoTaskMemAlloc(size); +} + +void +operator delete (void *lpMem) +{ + CoTaskMemFree(lpMem); +} +#endif + +///////////////////////////////////////////////////////////////////////////// +// CSpecifyPropertyPageObjects + +// Abstract class that supports aggregation as an inner object +class CCategory : public IUnknown { + public: + CCategory(); + + // IUnknown methods. Doesn't delegate (explicit IUnknown) + STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj) PURE; + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + public: + // Abstract nested class that implements ISpecifyPropertyPageObjects + class CSpecifyPageObjects : public ISpecifyPropertyPageObjects { + public: + CSpecifyPageObjects(CCategory *pBackObj, LPUNKNOWN pUnkOuter); + + // IUnknown methods. Always delegates to controlling unknown + STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + // ISpecifyPropertyPageObjects methods + STDMETHODIMP GetPageObjects(CAPPAGE FAR* pPages) PURE; + + private: + CCategory *m_pBackObj; + LPUNKNOWN m_pUnkOuter; + }; + + private: + ULONG m_uRef; +}; + +CCategory::CCategory() +{ + m_uRef = 0; +} + +STDMETHODIMP_(ULONG) +CCategory::AddRef() +{ + return ++m_uRef; +} + +STDMETHODIMP_(ULONG) +CCategory::Release() +{ + if (--m_uRef == 0) { +#ifdef _DEBUG + OutputDebugString("Destroying CCategory object.\n"); +#endif + delete this; + return 0; + } + + return m_uRef; +} + +CCategory::CSpecifyPageObjects::CSpecifyPageObjects(CCategory *pBackObj, LPUNKNOWN pUnkOuter) +{ + assert(pBackObj); + + // Don't add references to either the back pointer or the controlling unknown + m_pBackObj = pBackObj; + m_pUnkOuter = pUnkOuter; + + // If we're not being aggregated then pUnkOuter will be NULL. In that case + // delegate to the object in which we're contained + if (!m_pUnkOuter) + m_pUnkOuter = pBackObj; +} + +STDMETHODIMP +CCategory::CSpecifyPageObjects::QueryInterface(REFIID riid, LPVOID FAR* ppvObj) +{ + // Delegate to the controlling unknown + assert(m_pUnkOuter); + return m_pUnkOuter->QueryInterface(riid, ppvObj); +} + +STDMETHODIMP_(ULONG) +CCategory::CSpecifyPageObjects::AddRef() +{ + // Delegate to the controlling unknown + assert(m_pUnkOuter); + return m_pUnkOuter->AddRef(); +} + +STDMETHODIMP_(ULONG) +CCategory::CSpecifyPageObjects::Release() +{ + // Delegate to the controlling unknown + assert(m_pUnkOuter); + return m_pUnkOuter->Release(); +} + +///////////////////////////////////////////////////////////////////////////// +// CMailNewsCategory + +class CMailNewsCategory : public CCategory { + public: + CMailNewsCategory(LPUNKNOWN pUnkOuter); + + // IUnknown methods. Doesn't delegate (explicit IUnknown) + STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj); + + private: + class CSpecifyMailNewsPageObjects : public CCategory::CSpecifyPageObjects { + public: + CSpecifyMailNewsPageObjects(CCategory *pBackObj, LPUNKNOWN pUnkOuter); + + // ISpecifyPropertyPageObjects methods + STDMETHODIMP GetPageObjects(CAPPAGE *pPages); + }; + + CSpecifyMailNewsPageObjects m_innerObj; +}; + +CMailNewsCategory::CMailNewsCategory(LPUNKNOWN pUnkOuter) + : m_innerObj(this, pUnkOuter) +{ +} + +STDMETHODIMP +CMailNewsCategory::QueryInterface(REFIID riid, LPVOID FAR* ppvObj) +{ + if (riid == IID_IUnknown) { + *ppvObj = (LPVOID)this; + AddRef(); + return NOERROR; + + } else if (riid == IID_ISpecifyPropertyPageObjects) { + *ppvObj = (LPVOID)&m_innerObj; + m_innerObj.AddRef(); + return NOERROR; + + } else { + *ppvObj = NULL; + return ResultFromScode(E_NOINTERFACE); + } +} + +CMailNewsCategory::CSpecifyMailNewsPageObjects::CSpecifyMailNewsPageObjects(CCategory *pBackObj, LPUNKNOWN pUnkOuter) + : CSpecifyPageObjects(pBackObj, pUnkOuter) +{ +} + +STDMETHODIMP +CMailNewsCategory::CSpecifyMailNewsPageObjects::GetPageObjects(CAPPAGE *pPages) +{ + if (!pPages) + return ResultFromScode(E_POINTER); + +#ifndef MOZ_MAIL_NEWS + pPages->cElems = 1; +#else + pPages->cElems = 10; +#endif /* MOZ_MAIL_NEWS */ + pPages->pElems = (LPPROPERTYPAGE *)CoTaskMemAlloc(pPages->cElems * sizeof(LPPROPERTYPAGE)); + if (!pPages->pElems) + return ResultFromScode(E_OUTOFMEMORY); + +#ifndef MOZ_MAIL_NEWS + pPages->pElems[0] = new CIdentityPrefs; +#else /* MOZ_MAIL_NEWS */ + pPages->pElems[0] = new CMailNewsPrefs; + pPages->pElems[1] = new CIdentityPrefs; + pPages->pElems[2] = new CMailServerPrefs; + pPages->pElems[3] = new CNewsServerPrefs; + pPages->pElems[4] = new CAddressingPrefs; + pPages->pElems[5] = new CMessagesPrefs; + pPages->pElems[6] = new COutgoingMsgPrefs; + pPages->pElems[7] = new CHTMLFormatPrefs; + pPages->pElems[8] = new CMailReceiptPrefs; + pPages->pElems[9] = new CDiskSpacePrefs; +#endif /* MOZ_MAIL_NEWS */ + + for (ULONG i = 0; i < pPages->cElems; i++) + pPages->pElems[i]->AddRef(); + + return NOERROR; +} + +///////////////////////////////////////////////////////////////////////////// +// COfflineCategory + +class COfflineCategory : public CCategory { + public: + COfflineCategory(LPUNKNOWN pUnkOuter); + + // IUnknown methods. Doesn't delegate (explicit IUnknown) + STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj); + + private: + class CSpecifyOfflinePageObjects : public CCategory::CSpecifyPageObjects { + public: + CSpecifyOfflinePageObjects(CCategory *pBackObj, LPUNKNOWN pUnkOuter); + + // ISpecifyPropertyPageObjects methods + STDMETHODIMP GetPageObjects(CAPPAGE *pPages); + }; + + CSpecifyOfflinePageObjects m_innerObj; +}; + +COfflineCategory::COfflineCategory(LPUNKNOWN pUnkOuter) + : m_innerObj(this, pUnkOuter) +{ +} + +STDMETHODIMP +COfflineCategory::QueryInterface(REFIID riid, LPVOID FAR* ppvObj) +{ + if (riid == IID_IUnknown) { + *ppvObj = (LPVOID)this; + AddRef(); + return NOERROR; + + } else if (riid == IID_ISpecifyPropertyPageObjects) { + *ppvObj = (LPVOID)&m_innerObj; + m_innerObj.AddRef(); + return NOERROR; + + } else { + *ppvObj = NULL; + return ResultFromScode(E_NOINTERFACE); + } +} + +COfflineCategory::CSpecifyOfflinePageObjects::CSpecifyOfflinePageObjects(CCategory *pBackObj, LPUNKNOWN pUnkOuter) + : CSpecifyPageObjects(pBackObj, pUnkOuter) +{ +} + +STDMETHODIMP +COfflineCategory::CSpecifyOfflinePageObjects::GetPageObjects(CAPPAGE *pPages) +{ + if (!pPages) + return ResultFromScode(E_POINTER); + + pPages->cElems = 2; + pPages->pElems = (LPPROPERTYPAGE *)CoTaskMemAlloc(pPages->cElems * sizeof(LPPROPERTYPAGE)); + if (!pPages->pElems) + return ResultFromScode(E_OUTOFMEMORY); + + pPages->pElems[0] = new COfflinePrefs; + pPages->pElems[1] = new COfflineNewsPrefs; + + for (ULONG i = 0; i < pPages->cElems; i++) + pPages->pElems[i]->AddRef(); + + return NOERROR; +} + + +///////////////////////////////////////////////////////////////////////////// +// Class CPropertyPageFactory + +// Class factory for our property pages. We use the same C++ class +// to handle all of our CLSIDs +class CPropertyPageFactory : public IClassFactory { + public: + CPropertyPageFactory(REFCLSID rClsid); + + // *** IUnknown methods *** + STDMETHODIMP QueryInterface(REFIID, LPVOID FAR*); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + // *** IClassFactory methods *** + STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR*); + STDMETHODIMP LockServer(BOOL bLock); + + private: + CRefDll m_refDll; + ULONG m_uRef; + CLSID m_clsid; +}; + +///////////////////////////////////////////////////////////////////////////// +// CPropertyPageFactory implementation + +CPropertyPageFactory::CPropertyPageFactory(REFCLSID rClsid) +{ + m_uRef = 0; + m_clsid = rClsid; +} + +// *** IUnknown methods *** +STDMETHODIMP CPropertyPageFactory::QueryInterface(REFIID riid, LPVOID FAR* ppvObj) +{ + *ppvObj = NULL; + + if (riid == IID_IUnknown || riid == IID_IClassFactory) + *ppvObj = (LPVOID)this; + + if (*ppvObj) { + AddRef(); + return NOERROR; + } + + return ResultFromScode(E_NOINTERFACE); +} + + +STDMETHODIMP_(ULONG) CPropertyPageFactory::AddRef() +{ + return ++m_uRef; +} + + +STDMETHODIMP_(ULONG) CPropertyPageFactory::Release(void) +{ + if (--m_uRef == 0) { +#ifdef _DEBUG + OutputDebugString("Destroying CPropertyPageFactory class object.\n"); +#endif + delete this; + return 0; + } + + return m_uRef; +} + +// *** IClassFactory methods *** +STDMETHODIMP CPropertyPageFactory::CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppvObj) +{ + // When requesting aggregation, the outer object must explicitly ask + // for IUnknown + if (pUnkOuter && riid != IID_IUnknown) + return ResultFromScode(CLASS_E_NOAGGREGATION); + +#ifdef _DEBUG + OutputDebugString("CPropertyPageFactory::CreateInstance() called.\n"); +#endif + LPUNKNOWN pCategory; + + if (m_clsid == CLSID_MailNewsPrefs) + pCategory = new CMailNewsCategory(pUnkOuter); + else if (m_clsid == CLSID_OfflinePrefs) + pCategory = new COfflineCategory(pUnkOuter); + + if (!pCategory) + return ResultFromScode(E_OUTOFMEMORY); + + pCategory->AddRef(); + HRESULT hRes = pCategory->QueryInterface(riid, ppvObj); + pCategory->Release(); + return hRes; +} + + +STDMETHODIMP CPropertyPageFactory::LockServer(BOOL bLock) +{ + CComDll *pDll = CProcess::GetProcessDll(); + HRESULT hres; + + assert(pDll); + hres = CoLockObjectExternal(pDll, bLock, TRUE); + pDll->Release(); + return hres; +} + +///////////////////////////////////////////////////////////////////////////// +// CMailNewsPrefsDll implementation + +HRESULT +CMailNewsPrefsDll::GetClassObject(REFCLSID rClsid, REFIID riid, LPVOID *ppObj) +{ + HRESULT hres = ResultFromScode(E_UNEXPECTED); + *ppObj = NULL; + +#ifdef _DEBUG + OutputDebugString("CMailNewsPrefsDll::GetClassObject() called.\n"); +#endif + + // See if we have that particular class object. + if (rClsid == CLSID_MailNewsPrefs || + rClsid == CLSID_OfflinePrefs ) { + + // Create a class object + CPropertyPageFactory *pFactory = new CPropertyPageFactory(rClsid); + + if (!pFactory) + return ResultFromScode(E_OUTOFMEMORY); + + // Get the desired interface. Note if the QueryInterface fails, the Release + // will delete the class object + pFactory->AddRef(); + hres = pFactory->QueryInterface(riid, ppObj); + pFactory->Release(); + + } else { + hres = ResultFromScode(CLASS_E_CLASSNOTAVAILABLE); + } + + return hres; +} + +// Return array of implemented CLSIDs by this DLL. Allocated +// memory freed by caller. +const CLSID ** +CMailNewsPrefsDll::GetCLSIDs() +{ + const CLSID **ppRetval = (const CLSID **)CoTaskMemAlloc(sizeof(CLSID *) * 3); + + if (ppRetval) { + ppRetval[0] = &CLSID_MailNewsPrefs; + ppRetval[1] = &CLSID_OfflinePrefs; + ppRetval[2] = NULL; + } + + return ppRetval; +} + +#ifdef _WIN32 +BOOL WINAPI +DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpvReserved) +{ + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + // The DLL is being loaded for the first time by a given process + CComDll::m_hInstance = hInstance; + break; + + case DLL_PROCESS_DETACH: + // The DLL is being unloaded by a given process + break; + + case DLL_THREAD_ATTACH: + // A thread is being created in a process that has already loaded + // this DLL + break; + + case DLL_THREAD_DETACH: + // A thread is exiting cleanly in a process that has already + // loaded this DLL + break; + } + + return TRUE; +} +#else +extern "C" int CALLBACK +LibMain(HINSTANCE hInstance, WORD wDataSeg, WORD cbHeapSize, LPSTR) +{ + CComDll::m_hInstance = hInstance; + return TRUE; +} +#endif + diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/mnpref.h b/mozilla/cmd/winfe/prefs/mnpref/src/mnpref.h new file mode 100644 index 00000000000..a2746923886 --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/mnpref.h @@ -0,0 +1,35 @@ +/* -*- 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. + */ + +#ifndef __MNPREF_H_ +#define __MNPREF_H_ + +#include "dllcom.h" + +class CMailNewsPrefsDll : public CComDll { + public: + virtual HRESULT GetClassObject(REFCLSID rClsid, REFIID rIid, LPVOID *ppObj); + virtual const CLSID **GetCLSIDs(); +}; + +// Create our CComDll derived class +CComDll *DLL_ConsumerCreateInstance(void); + +#endif /* __MNPREF_H_ */ + + diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/mnpref.rc b/mozilla/cmd/winfe/prefs/mnpref/src/mnpref.rc new file mode 100644 index 00000000000..052f26de790 --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/mnpref.rc @@ -0,0 +1,609 @@ +/* -*- 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. + */ + +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" +#include +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "#include \0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_MESSAGES DIALOG DISCARDABLE 0, 0, 256, 181 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Forwarding and Replying to messages",IDC_STATIC,7,7,242, + 57 + CONTROL "&Automatically quote original message when replying", + IDC_CHECK_AUTO_QUOTE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,18,32,210,12 + LTEXT "Add my reply:",IDC_STATIC,29,46,53,9 + GROUPBOX "Message wrapping",IDC_STATIC,7,71,242,40 + CONTROL "&Wrap incoming, plain text messages to window width", + IDC_WRAP_INCOMING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 17,80,222,14 + CONTROL "Wrap outgoing, plain text messages at:",IDC_STATIC, + "Static",SS_LEFTNOWORDWRAP | WS_GROUP,17,97,128,11 + EDITTEXT IDC_EDIT_WRAP_LEN,145,95,28,12,ES_AUTOHSCROLL + LTEXT "&characters",IDC_STATIC,177,97,56,11 + GROUPBOX "Send messages that use 8-bit characters",IDC_STATIC,7, + 117,242,56 + CONTROL "As &is (does not work well with some mail servers)", + IDC_RADIO_8BITS,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,18,127,182,10 + CONTROL "&Using the ""quoted printable"" MIME encoding", + IDC_RADIO_MIME,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, + 18,140,186,10 + LTEXT "(does not work well with some mail or newsgroups readers)", + IDC_STATIC,30,150,159,18 + LTEXT "By Default Forward Messages:",IDC_STATIC,18,19,97,8 + COMBOBOX IDC_COMBO_FORWARD,120,18,117,48,CBS_DROPDOWNLIST | + WS_TABSTOP + COMBOBOX IDC_COMBO_REPLY,89,44,148,40,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP +END + +IDD_IDENTITY DIALOG DISCARDABLE 0, 0, 256, 200 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "",IDC_STATIC,7,6,242,188 + LTEXT "The information is needed before you can send mail. If you do not know the information requested, please contact your system administrator or Internet Service Provider.", + IDC_STATIC,17,16,226,24 + LTEXT "Your &name:",IDC_STATIC,17,43,223,8 + EDITTEXT IDC_EDIT_NAME,17,52,180,12,ES_AUTOHSCROLL + LTEXT "E&mail address:",IDC_STATIC,17,69,225,8 + EDITTEXT IDC_EDIT_EMAIL,17,78,180,12,ES_AUTOHSCROLL + LTEXT "&Reply-to address(only needed if different from email address):", + IDC_STATIC,17,96,223,10 + EDITTEXT IDC_EDIT_REPLYTO,17,105,180,13,ES_AUTOHSCROLL + LTEXT "&Organization:",IDC_STATIC,17,122,216,8 + EDITTEXT IDC_EDIT_ORGANIZATION,17,131,180,13,ES_AUTOHSCROLL + LTEXT "&Signature File:",IDC_STATIC,17,148,222,8 + EDITTEXT IDC_EDIT_SIGFILE,17,158,175,12,ES_AUTOHSCROLL + PUSHBUTTON "&Choose...",IDC_BUTTON_BROWSE,197,157,45,14 + CONTROL "Always attach &Address Book Card to messages.", + IDC_ATTACH_VCARD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 17,175,178,13 + PUSHBUTTON "&Edit Card...",IDC_BUTTON_EDITCARD,197,175,45,14 +END + +IDD_MAILNEWS DIALOG DISCARDABLE 0, 0, 256, 200 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Plain quoted text beginning with "">"" is displayed with", + IDC_STATIC,7,7,242,66 + LTEXT "S&tyle:",IDC_STATIC,17,21,18,8 + COMBOBOX IDC_FONT_STYLE,39,19,75,41,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + LTEXT "&Size:",IDC_STATIC,17,39,16,8 + COMBOBOX IDC_FONT_SIZE,39,37,62,41,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + LTEXT "&Color:",IDC_STATIC,17,56,19,8 + CONTROL "",IDC_COLOR,"Button",BS_OWNERDRAW | WS_TABSTOP,39,55,23, + 12 + GROUPBOX "Display plain text messages and articles with", + IDC_STATIC,7,78,242,39 + CONTROL "&Fixed width font",IDC_RADIO_FIXED,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,17,88,130,12 + CONTROL "&Variable width font",IDC_RADIO_VARIABLE,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,17,102,130,12 + GROUPBOX "",IDC_STATIC,7,122,242,72 + CONTROL "&Enable sound alert when messages arrive", + IDC_ENABLE_SOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 17,135,228,10 + CONTROL "Use &Netscape Messenger from MAPI-based applications", + IDC_USE_MAPI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17, + 178,227,10 + CONTROL "&Remember the last selected message", + IDC_REMEMBER_LAST_MESSAGE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,17,147,222,13 + CONTROL "C&onfirm when moving folders to the trash", + IDC_CONFIRM_ON_DELETE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,17,161,222,13 +END + +IDD_NEWSSERVER DIALOG DISCARDABLE 0, 0, 256, 200 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "",IDC_STATIC,5,109,242,63 + LTEXT "Ne&wsgroup folder:",IDC_STATIC,15,117,194,8 + EDITTEXT IDC_EDIT_NEWS_DIR,15,129,169,12,ES_AUTOHSCROLL | + ES_READONLY + PUSHBUTTON "&Choose...",IDC_BUTTON_BROWSE,190,127,50,14 + CONTROL "&Ask me before downloading more than",IDC_CHECK_NOTIFY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,151,137,13 + LTEXT "&messages",IDC_STATIC,189,153,40,8 + EDITTEXT IDC_EDIT_MSG_COUNT,152,151,34,12,ES_AUTOHSCROLL + GROUPBOX "",IDC_STATIC,5,3,241,101 + LISTBOX IDC_SERVERS_LIST,15,15,154,82,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&New...",IDC_NEW,182,16,56,14 + PUSHBUTTON "&Edit...",IDC_EDIT,182,34,56,14 + PUSHBUTTON "&Delete",IDC_DELETE,182,52,56,14 + PUSHBUTTON "&Set as Default",IDC_DEFAULT,182,72,56,14 +END + +IDD_OFFLINE DIALOG DISCARDABLE 0, 0, 256, 200 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Startup State",IDC_STATIC,6,6,242,98 + LTEXT "Communicator can start in either online or offline modes. When online you have full access to your network. When offline you can only read messages that you have previously downloaded.", + IDC_STATIC,15,17,226,29 + CONTROL "&Remember Previous State",IDC_PREVIOUS_STATE,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,15,46,200,12 + CONTROL "&Ask Me",IDC_ASK_ME,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,15,78,200,12 + LTEXT "Communicator will remember the state it was in last and start in that mode.", + IDC_STATIC,27,59,182,18 + LTEXT "Communicator will ask you each time you start the program.", + IDC_STATIC,27,90,199,13 + GROUPBOX "When Going Online",IDC_STATIC,5,107,241,53 + CONTROL "A&sk me if I want to send my unsent messages", + IDC_ONLINE_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,15,117,219,13 + CONTROL "A&utomatically send my unsent mesages", + IDC_ONLINE_RADIO2,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,15,130,219,13 + CONTROL "&Do not send my unsent messages",IDC_ONLINE_RADIO3, + "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,143,219,13 + GROUPBOX "When Exiting Communicator",IDC_STATIC,5,164,241,29 + CONTROL "&Prompt me to synchronize my messages", + IDC_PROMPT_SYNCHRONIZE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,178,207,10 +END + +IDD_OFFLINE_NEWS DIALOG DISCARDABLE 0, 0, 256, 200 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Newsgroup Messages",IDC_STATIC,7,9,242,77 + CONTROL "Download only &unread messages",IDC_UNREAD_ONLY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,20,166,12 + CONTROL "Download by da&te",IDC_DOWNLOAD_BY_DATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,20,34,166,12 + COMBOBOX IDC_COMBO_FROM,68,47,78,56,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "&from",IDC_RADIO_FROM,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,33,49,29,10 + CONTROL "&since",IDC_RADIO_SINCE,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,33,65,33,10 + LTEXT "&days ago",IDC_STATIC_DAYS_AGO,101,65,47,8 + EDITTEXT IDC_EDIT_DAYS,68,63,30,12,ES_AUTOHSCROLL + GROUPBOX "All Messages",IDC_STATIC,7,92,242,65 + LTEXT "In order to read mail and newsgroups offline, you must first select them for downloading. Click the Select... button to choose newsgroups for downloading.", + IDC_STATIC,20,102,212,27 + PUSHBUTTON "&Select ...",IDC_SELECT_DOWNLOAD,19,134,65,14 +END + +IDD_READRECEIPT DIALOG DISCARDABLE 0, 0, 256, 200 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "If I request a receipt when sending a message, I want", + IDC_STATIC,3,6,249,68 + CONTROL "A delivery receipt(DSN) from the receiving &server", + IDC_RADIO_SERVER_ONLY,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,12,20,231,10 + CONTROL "&A read receipt(MDN), notifying me when recipients display ", + IDC_RADIO_CLIENT_ONLY,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,12,35,231,12 + CONTROL "&Both types of receipt",IDC_RADIO_BOTH,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,12,58,231,10 + GROUPBOX "When a receipt arrives",IDC_STATIC,3,80,249,43 + CONTROL "&Leave it in my Inbox",IDC_RADIO_IN_INBOX,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,12,91,233,10 + CONTROL "&Move it to my Sent Mail folder",IDC_RADIO_TO_SENT, + "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,106,233,10 + GROUPBOX "When I receive a message and the sender requested a receipt (MDN)", + IDC_STATIC,3,130,249,51 + CONTROL "&Never return a receipt",IDC_RADIO_NO_RECEIPT,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,12,142,156,12 + CONTROL "&Return receipts for some messages", + IDC_RADIO_CUSTOMIZE_RECEIPT,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,12,157,143,12 + PUSHBUTTON "&Customize...",IDC_CUSTOMIZE,155,157,60,14 + LTEXT "the message",IDC_STATIC,23,46,222,10 +END + +IDD_RECEIPT_CUSTOMIZE DIALOG DISCARDABLE 0, 0, 240, 143 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION +CAPTION "Customize Return Receipts" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "When I receive a message and its sender requested a receipt(MDN), send one in the following cases:", + IDC_STATIC,5,7,228,18 + LTEXT "If I'm not in the To or CC list of the message (as for a message to a mailing list):", + IDC_STATIC1,5,35,150,20 + COMBOBOX IDC_NOT_TOCC,160,35,72,45,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + LTEXT "If the message comes from outside the domain netscape.com:", + IDC_STATIC2,5,65,150,20 + COMBOBOX IDC_OUTSIDE_DOMAIN,160,65,72,45,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "In all other cases:",IDC_STATIC3,5,96,150,12 + COMBOBOX IDC_GENERAL,160,96,71,45,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,117,120,50,14 + PUSHBUTTON "Cancel",IDCANCEL,182,120,50,14 +END + +IDD_OUTGOING_MSG DIALOG DISCARDABLE 0, 0, 256, 200 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "When sending a mail message, automatically",IDC_STATIC, + 4,7,248,60 + CONTROL "&BCC: user's@email.address",IDC_CHECK_MAIL_SELF, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,35,140,10 + CONTROL "BCC &Other",IDC_CHECK_MAIL_OTHER,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,9,50,48,10 + CONTROL "a&ddress:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | + WS_GROUP,58,50,28,8 + EDITTEXT IDC_EDIT_MAIL_TOADDRESS,87,49,111,12,ES_AUTOHSCROLL + CONTROL "Folder",IDC_CHECK_MAIL_FOLDER,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,9,20,176,10 + PUSHBUTTON "&Choose Folder...",IDC_CHOOSE_FOLDER_MAIL,188,20,60,11 + GROUPBOX "When sending a newsgroup message, automatically", + IDC_STATIC,4,72,248,61 + CONTROL "BCC: &user's@email.address",IDC_CHECK_NEWS_SELF, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,101,172,10 + CONTROL "BCC O&ther",IDC_CHECK_NEWS_OTHER,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,9,116,50,10 + CONTROL "add&ress:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | + WS_GROUP,59,116,28,8 + EDITTEXT IDC_EDIT_NEWS_TOADDRESS,87,116,111,12,ES_AUTOHSCROLL + CONTROL "Folder",IDC_CHECK_NEWS_FOLDER,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,9,86,176,10 + PUSHBUTTON "&Choose Folder...",IDC_CHOOSE_FOLDER_NEWS,188,86,60,11 + GROUPBOX "Storage for Drafts and Templates",IDC_STATIC,4,137,248, + 48 + PUSHBUTTON "&Choose Folder...",IDC_CHOOSE_FOLDER_DRAFT,188,149,60, + 11 + PUSHBUTTON "&Choose Folder...",IDC_CHOOSE_FOLDER_TEMPLATE,188,165, + 60,11 + LTEXT "Keep Draft",IDC_STATIC_DRAFT,9,150,176,10 + LTEXT "Keep Template",IDC_STATIC_TEMPLATE,9,166,176,10 +END + +IDD_HTML_FORMATTING DIALOG DISCARDABLE 0, 0, 256, 200 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Message formatting",IDC_STATIC,7,7,242,41 + CONTROL "&Use the HTML editor to compose messages", + IDC_HTMLCOMPOSE,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,14,18,228,9 + CONTROL "Use &the plain text editor to compose messages", + IDC_PLAINCOMPOSE,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,14,31,228,9 + GROUPBOX "When sending HTML mail messages to recipients who are not ", + IDC_STATIC,7,51,242,146 + LTEXT "listed as being able to receive them:",IDC_STATIC,15,59, + 188,10 + CONTROL "&Ask me what to do if the message has HTML formatting,", + IDC_ASK,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,20,72,215,10 + CONTROL "&Convert the message into plain text",IDC_PLAIN, + "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,20,97,213,10 + CONTROL "&Send the message in HTML anyway",IDC_ANYWAY,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,20,122,219,10 + CONTROL "S&end the message in plain text and HTML",IDC_BOTH, + "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,20,147,182,10 + LTEXT "otherwise send plain text",IDC_STATIC,32,82,201,11 + LTEXT "(may lose some formatting)",IDC_STATIC,32,107,202,9 + LTEXT "(some recipients may not be able to read it)", + IDC_STATIC,32,132,205,9 + LTEXT "(uses more disk space)",IDC_STATIC,32,157,178,9 + LTEXT "You can override these settings in any message through the options panel of the message composition window", + IDC_STATIC,16,172,216,18 +END + +IDD_ADDRESSING DIALOG DISCARDABLE 0, 0, 256, 200 +STYLE WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "&First Name Last Name",IDC_FIRSTNAME_FIRST,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,17,163,114,11 + CONTROL "&Last Name, First Name",IDC_LASTNAME_FIRST,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,17,176,115,11 + LTEXT "(John Smith)",IDC_STATIC,139,164,66,8 + LTEXT "(Smith, John)",IDC_STATIC,139,177,68,8 + GROUPBOX "Sort full names by:",IDC_STATIC,7,152,242,41 + GROUPBOX "When addressing messages:",IDC_STATIC,7,6,242,142 + CONTROL "&Names in Address Book",IDC_CHECK_IN_PAB,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,24,28,197,12 + CONTROL "Names in this &directory",IDC_CHECK_IN_DIR,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,24,42,204,12 + COMBOBOX IDC_COMBO_DIRS,36,57,130,64,CBS_DROPDOWN | WS_VSCROLL | + WS_TABSTOP + CONTROL "Use the address and do not search in the directory", + IDC_CHECK_PAB_FIRST,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,24,130,200,13 + CONTROL "&Show me a list of choices when I press return", + IDC_RADIO_SHOW,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,24,89,211,12 + CONTROL "&Accept what I have typed and don't show me a list of choices", + IDC_RADIO_NO_SHOW,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,24,100,211,12 + LTEXT "Auto-complete names from:",IDC_STATIC,14,19,151,10 + LTEXT "If there are two or more matches:",IDC_STATIC,14,79,206, + 10 + LTEXT "If there is only one match in your personal address books:", + IDC_STATIC,14,119,227,10 +END + +IDD_MAILSERVER DIALOG DISCARDABLE 0, 0, 256, 200 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "&Incoming Mail Servers",IDC_STATIC,8,2,241,85,WS_GROUP + LISTBOX IDC_SERVERS_LIST,15,14,167,68,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&New...",IDC_NEW,187,16,56,13 + PUSHBUTTON "&Edit...",IDC_EDIT,187,33,56,13 + PUSHBUTTON "&Delete",IDC_DELETE,187,50,56,12 + GROUPBOX "Outgoing Mail Server",IDC_STATIC,7,88,242,64 + CONTROL "&Outgoing mail (SMTP) server:",IDC_STATIC,"Static", + SS_LEFTNOWORDWRAP | WS_GROUP,14,100,99,8 + EDITTEXT IDC_EDIT_SMTP_SERVER,116,98,128,12,ES_AUTOHSCROLL + CONTROL "&Mail server user name:",IDC_STATIC,"Static", + SS_LEFTNOWORDWRAP | WS_GROUP,14,113,101,8 + EDITTEXT IDC_EDIT_NAME,116,111,128,12,ES_AUTOHSCROLL + GROUPBOX "",IDC_STATIC,7,154,242,42 + LTEXT "&Local mail directory:",IDC_STATIC,15,164,72,8 + EDITTEXT IDC_EDIT_MAIL_DIR,15,178,187,12,ES_AUTOHSCROLL | + ES_READONLY + PUSHBUTTON "&Choose...",IDC_BUTTON_BROWSE,204,177,40,14 + LTEXT "Use Secure Socket Layer(SSL) or TLS for outgoing messages:", + IDC_STATIC,14,126,227,10 + CONTROL "Ne&ver",IDC_RADIO_NEVER,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,15,138,56,12 + CONTROL "If &Possible",IDC_RADIO_POSSIBLE,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,83,137,66,12 + CONTROL "Al&ways",IDC_RADIO_ALWAYS,"Button",BS_AUTORADIOBUTTON | + WS_TABSTOP,157,137,58,12 + PUSHBUTTON "&Set as Default",IDC_DEFAULT,187,68,56,12 +END + +IDD_DISK_SPACE DIALOG DISCARDABLE 0, 0, 256, 190 +STYLE WS_CHILD | WS_CLIPSIBLINGS +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "All Messages",IDC_STATIC,6,7,242,47 + CONTROL "&Do not download any message larger than ", + IDC_CHECK_MSG_SIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 20,17,149,14 + LTEXT "&kB",IDC_STATIC,202,19,25,8 + EDITTEXT IDC_EDIT_MSG_SIZE,171,18,28,12,ES_AUTOHSCROLL + CONTROL "Auto&matically compact folders when it will save over", + IDC_CHECK_COMPACT_SIZE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,20,33,179,14 + LTEXT "k&B",IDC_STATIC,232,35,11,8 + EDITTEXT IDC_EDIT_COMPACT_SIZE,201,34,28,12,ES_AUTOHSCROLL + GROUPBOX "Newsgroup Messages Only",IDC_STATIC,6,60,242,111 + LTEXT "When it's time to clean up messages:",IDC_STATIC,12,74, + 161,10,NOT WS_GROUP + CONTROL "Keep messages which have arrived within the &past", + IDC_KEEP_MSG_DAYS,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,20,86,175,10 + CONTROL "Keep &all messages",IDC_KEEP_ALL,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,20,99,123,10 + CONTROL "Keep the &newest",IDC_KEEP_COUNT,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,20,112,69,10 + LTEXT "&days",IDC_STATIC,223,86,19,8 + EDITTEXT IDC_EDIT_MSG_DAYS,196,85,24,12,ES_AUTOHSCROLL + LTEXT "&messages",IDC_STATIC,117,112,65,8 + EDITTEXT IDC_EDIT_MSG_COUNT,90,111,24,12,ES_AUTOHSCROLL + CONTROL "Keep only &unread messages",IDC_KEEP_UNREAD,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,21,128,150,12 + CONTROL "&Remove message bodies only older than ", + IDC_CHECK_MSG_DAYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 21,144,145,13 + LTEXT "&days",IDC_STATIC,203,145,24,8 + EDITTEXT IDC_EDIT_REMOVE_DAYS,167,144,32,12,ES_AUTOHSCROLL +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_READRECEIPT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 249 + TOPMARGIN, 7 + BOTTOMMARGIN, 193 + END + + IDD_RECEIPT_CUSTOMIZE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 233 + TOPMARGIN, 7 + BOTTOMMARGIN, 136 + END + + IDD_ADDRESSING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 249 + TOPMARGIN, 7 + BOTTOMMARGIN, 193 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog Info +// + +IDD_MESSAGES DLGINIT +BEGIN + IDC_COMBO_FORWARD, 0x403, 7, 0 +0x6e49, 0x696c, 0x656e, "\000" + IDC_COMBO_FORWARD, 0x403, 7, 0 +0x7551, 0x746f, 0x6465, "\000" + IDC_COMBO_FORWARD, 0x403, 14, 0 +0x7341, 0x4120, 0x7474, 0x6361, 0x6d68, 0x6e65, 0x0074, + 0 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDD_MAILNEWS "Mail & Newsgroups\nAppearance settings for Mail and Newsgroups" + IDD_IDENTITY "Identity\nSet your name, email address, and signature file" + IDD_MESSAGES "Messages\nChoose settings for messages" + IDD_MAILSERVER "Mail Servers\nSpecify servers for mail" + IDD_NEWSSERVER "Newsgroup Servers\nSpecify your servers for reading newsgroups" + IDD_READRECEIPT "Return Receipts\nSettings for requesting or returning receipts" + IDD_OFFLINE "Offline\nChoose the startup mode of the product" + IDD_OFFLINE_NEWS "Download\nChoose settings for reading messages offline" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_YESTERDAY "yesterday" + IDS_1_WEEK "1 week ago" + IDS_2_WEEK "2 weeks ago" + IDS_1_MONTH "1 month ago" + IDS_6_MONTH "6 months ago" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_1_YEAR "1 year ago" + IDS_SELECT_COUNT "( %d newsgroups selected)" + IDS_NUMERIC_ONLY "Please enter numeric digits only." + IDS_PLAIN "Regular" + IDS_BOLD "Bold" + IDS_ITALIC "Italic" + IDS_BOLD_ITALIC "Bold Italic" + IDS_FONT_SIZE_FIRST "Regular" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_FONT_SIZE_2 "Bigger" + IDS_FONT_SIZE_LAST "Smaller" + IDS_MESSAGES "Messages" + IDS_GROUPS_SERVER "Newsgroup Servers" + IDS_DOWNLOAD "Download" + IDS_NEVER "Never Send" + IDS_AUTOMATICALLY "Automatically" + IDS_ASK_ME "Ask me" + IDS_FOLDER_MAIL "&Place a copy in folder '%s' on '%s'" + IDS_FOLDER_NEWS "Pl&ace a copy in folder '%s' on '%s'" + IDS_FOLDER_DRAFT "Keep draft in '%s' on '%s'" + IDS_FOLDER_TEMPLATE "Keep templates in '%s' on '%s'" + IDS_DISK_SPACE "Disk Space" + IDS_MORE_DISK_SPACE "More disk space" + IDS_DEFAULT " (Default)" + IDS_NON_ZERO "Please enter a number that is greater than 0." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDD_OUTGOING_MSG "Copies and Folders\nCopies, drafts and templates" + IDD_HTML_FORMATTING "Formatting\nMessages formatting" + IDD_ADDRESSING "Addressing\nChoose settings for addressing messages" + IDD_DISK_SPACE "Disk Space\nManage the amount of disk space taken by messages" + IDS_FORWARDINLINE "Inline" + IDS_FORWARDQUOTE "Quoted" + IDS_FORWARDATTACHMENT "As Attachment" + IDS_REPLYABOVE "Above the quoted text" + IDS_REPLYBELOW "Below the quoted text" + IDS_REPLYSELECT "Select the quoted text" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/mnpref16.def b/mozilla/cmd/winfe/prefs/mnpref/src/mnpref16.def new file mode 100644 index 00000000000..35297785381 --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/mnpref16.def @@ -0,0 +1,29 @@ +; 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. + +LIBRARY mnpref16 +DESCRIPTION "Mail/News preferences" +EXETYPE WINDOWS +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE SINGLE +HEAPSIZE 4096 + +EXPORTS + WEP @1 RESIDENTNAME PRIVATE + DLLGETCLASSOBJECT PRIVATE + DLLCANUNLOADNOW PRIVATE + DLLREGISTERSERVER PRIVATE + DLLUNREGISTERSERVER PRIVATE + diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/mnpref32.def b/mozilla/cmd/winfe/prefs/mnpref/src/mnpref32.def new file mode 100644 index 00000000000..3dc060db0c6 --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/mnpref32.def @@ -0,0 +1,24 @@ +; 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. + +LIBRARY mnpref32 +DESCRIPTION "Mail/News preferences" + +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE + diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/offpages.cpp b/mozilla/cmd/winfe/prefs/mnpref/src/offpages.cpp new file mode 100644 index 00000000000..07d245ec3a0 --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/offpages.cpp @@ -0,0 +1,254 @@ +/* -*- 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. + */ + +#include "pch.h" +#include +#include "dllcom.h" +#include "pages.h" +#include "colorbtn.h" +#include "bitmpbtn.h" +#include "resource.h" +#include "structs.h" +#include "xp_core.h" +#include "xp_help.h" +#include "prefapi.h" +#include "mninterf.h" +#include "mnprefid.h" + +extern void ValidateNumeric +(HWND hParent, HINSTANCE hInst, int nCaptionID, int nID, int& data); + +///////////////////////////////////////////////////////////////////////////// +// COfflinePrefs implementation + +COfflinePrefs::COfflinePrefs() + : CMailNewsPropertyPage(IDD_OFFLINE, HELP_PREFS_OFFLINE) +{ + m_nModeRadioChoice = 0; // 0 = IDC_PREVIOUS_STATE + // 1 = IDC_ASK_ME + m_nOnlineRadioChoice = 0; // 0 = IDC_ONLINE_RADIO1 Ask me + // 1 = IDC_ONLINE_RADIO2 Automatically send + // 2 = IDC_ONLINE_RADIO3 Do not send + m_bPromptSynchronize = TRUE; +} + +BOOL COfflinePrefs::InitDialog() +{ + if (MNPREF_PrefIsLocked("offline.startup_state")) + { + EnableDlgItem(IDC_PREVIOUS_STATE, FALSE); + EnableDlgItem(IDC_ASK_ME, FALSE); + } + + if(MNPREF_PrefIsLocked("offline.send.unsent_messages")) + { + EnableDlgItem(IDC_ONLINE_RADIO1, FALSE); + EnableDlgItem(IDC_ONLINE_RADIO2, FALSE); + EnableDlgItem(IDC_ONLINE_RADIO3, FALSE); + } + + if(MNPREF_PrefIsLocked("offline.prompt_synch_on_exit")) + { + EnableDlgItem(IDC_PROMPT_SYNCHRONIZE, FALSE); + } + + return CMailNewsPropertyPage::InitDialog(); +} + +// Initialize member data using XP preferences +STDMETHODIMP COfflinePrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) { + int32 n; + + PREF_GetIntPref("offline.startup_state", &n); + m_nModeRadioChoice = (int)n; + + PREF_GetIntPref("offline.send.unsent_messages", &n); + m_nOnlineRadioChoice = (int)n; + + XP_Bool prompt; + PREF_GetBoolPref("offline.prompt_synch_on_exit", &prompt); + m_bPromptSynchronize = prompt; + } + + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL COfflinePrefs::DoTransfer(BOOL bSaveAndValidate) +{ + RadioButtonTransfer(IDC_PREVIOUS_STATE, m_nModeRadioChoice, bSaveAndValidate); + RadioButtonTransfer(IDC_ONLINE_RADIO1, m_nOnlineRadioChoice, bSaveAndValidate); + CheckBoxTransfer(IDC_PROMPT_SYNCHRONIZE, m_bPromptSynchronize, bSaveAndValidate); + + return TRUE; +} + +BOOL COfflinePrefs::ApplyChanges() +{ + PREF_SetIntPref("offline.startup_state", (int32)m_nModeRadioChoice); + PREF_SetIntPref("offline.send.unsent_messages", (int32)m_nOnlineRadioChoice); + PREF_SetBoolPref("offline.prompt_synch_on_exit", m_bPromptSynchronize); + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// COfflineNewsPrefs implementation + +COfflineNewsPrefs::COfflineNewsPrefs() + : CMailNewsPropertyPage(IDD_OFFLINE_NEWS, HELP_PREFS_OFFLINE_GROUPS) +{ + m_nDownloadRadioChoice = 0; +} + +BOOL COfflineNewsPrefs::InitDialog() +{ + char szBuf[256]; + + HWND hwndCombo = GetDlgItem(m_hwndDlg, IDC_COMBO_FROM); + for (int i = IDS_YESTERDAY; i <= IDS_1_YEAR; i++) + { + int nLen = LoadString(m_hInstance, i, szBuf, sizeof(szBuf)); + + assert(nLen > 0); + ComboBox_AddString(hwndCombo, szBuf); + } + EnableCheckByDate(m_bByDate); + + // Limit the length of the string the user can type + Edit_LimitText(GetDlgItem(m_hwndDlg, IDC_EDIT_DAYS), 5); + + CheckIfLockedPref("offline.news.download.unread_only", IDC_UNREAD_ONLY); + if (CheckIfLockedPref("offline.news.download.by_date", IDC_DOWNLOAD_BY_DATE) + || MNPREF_PrefIsLocked("offline.news.download.use_days")) + { + EnableDlgItem(IDC_RADIO_FROM, FALSE); + EnableDlgItem(IDC_RADIO_SINCE, FALSE); + EnableDlgItem(IDC_COMBO_FROM, FALSE); + EnableDlgItem(IDC_EDIT_DAYS, FALSE); + } + CheckIfLockedPref("offline.news.download.days", IDC_COMBO_FROM); + CheckIfLockedPref("offline.news.download.increments", IDC_EDIT_DAYS); + + return CMailNewsPropertyPage::InitDialog(); +} + +STDMETHODIMP COfflineNewsPrefs::Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal) +{ + if (!m_bHasBeenActivated) { + BOOL bMode; + int32 n = 0; + + PREF_GetBoolPref("offline.news.download.unread_only", &m_bUnreadOnly); + PREF_GetBoolPref("offline.news.download.by_date", &m_bByDate); + PREF_GetBoolPref("offline.news.download.use_days", &bMode); + if (bMode) + m_nDownloadRadioChoice = 1; + else + m_nDownloadRadioChoice = 0; + PREF_GetIntPref("offline.news.download.days", &n); + m_nDownLoadDays = (int)n; + PREF_GetIntPref("offline.news.download.increments", &n); + m_nDownLoadInterval = (int)n; + + PREF_GetIntPref("offline.news.discussions_count", &n); + m_nDiscussions = (int)n; + } + + return CMailNewsPropertyPage::Activate(hwndParent, lprc, bModal); +} + +BOOL COfflineNewsPrefs::DoTransfer(BOOL bSaveAndValidate) +{ + CheckBoxTransfer(IDC_UNREAD_ONLY, m_bUnreadOnly, bSaveAndValidate); + CheckBoxTransfer(IDC_DOWNLOAD_BY_MSG, m_bByMessage, bSaveAndValidate); + CheckBoxTransfer(IDC_DOWNLOAD_BY_DATE, m_bByDate, bSaveAndValidate); + RadioButtonTransfer(IDC_RADIO_FROM, m_nDownloadRadioChoice, bSaveAndValidate); + ComboBoxTransfer(IDC_COMBO_FROM , m_nDownLoadInterval, bSaveAndValidate); + EditFieldTransfer(IDC_EDIT_DAYS, m_nDownLoadDays, bSaveAndValidate); + return TRUE; +} + +BOOL COfflineNewsPrefs::ApplyChanges() +{ + PREF_SetBoolPref("offline.news.download.unread_only", m_bUnreadOnly); + + PREF_SetBoolPref("offline.news.download.by_date", m_bByDate); + if (m_nDownloadRadioChoice == 0) + PREF_SetBoolPref("offline.news.download.use_days", FALSE); + else + PREF_SetBoolPref("offline.news.download.use_days", TRUE); + + PREF_SetIntPref("offline.news.download.increments", (int32)m_nDownLoadInterval); + PREF_SetIntPref("offline.news.download.days", (int32)m_nDownLoadDays); + return TRUE; +} + +BOOL COfflineNewsPrefs::OnCommand(int id, HWND hwndCtl, UINT notifyCode) +{ + if (id == IDC_DOWNLOAD_BY_DATE && notifyCode == BN_CLICKED) + { + BOOL bBool = IsDlgButtonChecked(m_hwndDlg, IDC_DOWNLOAD_BY_DATE); + EnableCheckByDate(bBool); + } + else if (id == IDC_EDIT_DAYS && notifyCode == EN_UPDATE) + { + ValidateNumeric(m_hwndDlg, m_hInstance, IDS_DOWNLOAD, + id, m_nDownLoadDays); + return TRUE; + } + else if (id == IDC_SELECT_DOWNLOAD && notifyCode == BN_CLICKED) + { + assert(m_pObject); + if (m_pObject) + { + LPOFFLINEINTERFACE lpInterface; + + // Request the IMailNewsInterface interface from our data object + if (SUCCEEDED(m_pObject->QueryInterface(IID_OfflineInterface, + (void **)&lpInterface))) + { + // Get the number of encodings + lpInterface->DoSelectDiscussion(GetParent(m_hwndDlg)); + lpInterface->Release(); + } + } + return TRUE; + + } + + return CDialog::OnCommand(id, hwndCtl, notifyCode); +} + +void COfflineNewsPrefs::EnableCheckByDate(BOOL bEnable) +{ + EnableDlgItem(IDC_RADIO_FROM, bEnable); + EnableDlgItem(IDC_RADIO_SINCE, bEnable); + EnableDlgItem(IDC_COMBO_FROM, bEnable); + EnableDlgItem(IDC_EDIT_DAYS, bEnable); + EnableDlgItem(IDC_STATIC_DAYS_AGO, bEnable); +} + +void COfflineNewsPrefs::SetDiscussionCount(int nCount) +{ + char szFormat[256], szText[256]; + int nLen = LoadString(m_hInstance, IDS_SELECT_COUNT, szFormat, sizeof(szFormat)); + sprintf(szText, LPCSTR(szFormat), nCount); + Static_SetText(GetDlgItem(m_hwndDlg, IDC_STATIC_SELECT_NO), + szText); +} diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/pages.cpp b/mozilla/cmd/winfe/prefs/mnpref/src/pages.cpp new file mode 100644 index 00000000000..280902a6fcc --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/pages.cpp @@ -0,0 +1,82 @@ +/* -*- 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. + */ + +#include "pch.h" +#include +#include "dllcom.h" +#include "pages.h" +#include "xp_core.h" +#include "prefapi.h" + +///////////////////////////////////////////////////////////////////////////// +// Helper functions + +int +PREF_GetStringPref(LPCSTR lpszPref, CString &str) +{ + int nBufLength = 0; + + if (PREF_GetCharPref(lpszPref, NULL, &nBufLength) == PREF_ERROR) + return PREF_ERROR; + + if (nBufLength <= 1) { + str.Empty(); + return PREF_NOERROR; + + } else { + return PREF_GetCharPref(lpszPref, str.BufferSetLength(nBufLength - 1), &nBufLength); + } +} + +///////////////////////////////////////////////////////////////////////////// +// CMailNewsPropertyPage implementation + +CMailNewsPropertyPage::CMailNewsPropertyPage(UINT nTemplateID, LPCSTR lpszHelpTopic) + : CPropertyPageEx(CComDll::m_hInstance, nTemplateID, lpszHelpTopic) +{ +} + +SIZE CMailNewsPropertyPage::m_size = {0, 0}; + +HRESULT CMailNewsPropertyPage::GetPageSize(SIZE &size) +{ + // All of our pages are the same size. See if we already + // have the size + if (m_size.cx == 0) { + // Ask our base class to determine the size + HRESULT hres = CPropertyPageEx::GetPageSize(m_size); + + if (FAILED(hres)) + return hres; + } + + // Use the cached size + assert(m_size.cx > 0 && m_size.cy > 0); + size = m_size; + return NOERROR; +} + +BOOL CMailNewsPropertyPage::CheckIfLockedPref(LPCSTR lpszPref, UINT nCtlID) +{ + if (MNPREF_PrefIsLocked(lpszPref)) { + EnableDlgItem(nCtlID, FALSE); + return TRUE; + } + + return FALSE; +} diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/pages.h b/mozilla/cmd/winfe/prefs/mnpref/src/pages.h new file mode 100644 index 00000000000..a4525cb1473 --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/pages.h @@ -0,0 +1,391 @@ +/* -*- 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. + */ + +#ifndef __PAGES_H_ +#define __PAGES_H_ + +#include "cppageex.h" +#include "xp_list.h" + +//also in brpref\src\advpages.cpp, winfe\mnprefs.cpp +#define MNPREF_PrefIsLocked(pPrefName) PREF_PrefIsLocked(pPrefName) + +///////////////////////////////////////////////////////////////////////////// +// Helper functions + +// CString interface to PREF_GetCharPref routine +int +PREF_GetStringPref(LPCSTR lpszPref, CString &str); + +///////////////////////////////////////////////////////////////////////////// +// CMailNewsPrefs + +// Simple base class that handles reference counting of the DLL object and +// caching the size of the property page. Note: all property pages derived +// from this class MUST be the same size +class CMailNewsPropertyPage : public CPropertyPageEx { + public: + CMailNewsPropertyPage(UINT nTemplateID, LPCSTR lpszHelpTopic); + + protected: + HRESULT GetPageSize(SIZE &); + + // Disables the control (specified by ID) and return TRUE if the preference + // is locked; returns FALSE otherwise + BOOL CheckIfLockedPref(LPCSTR lpszPref, UINT nIDCtl); + + private: + CRefDll m_refDll; + + static SIZE m_size; // cached size +}; + +///////////////////////////////////////////////////////////////////////////// +// CMailNewsPrefs + +class CMailNewsPrefs : public CMailNewsPropertyPage { + public: + CMailNewsPrefs(); + + protected: + BOOL InitDialog(); + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + + // Event Processing + LRESULT WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam); + BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode); + + private: + CString m_strFontStyle; + int m_nFontStyle; + int m_nFontSize; + int m_nFontColor; + COLORREF m_rgbQuotedColor; + + int m_nWidthRadio; + BOOL m_bFixWidthFont; + BOOL m_bEnableSound; + BOOL m_bUseMapi; + BOOL m_bRemeberLastMsg; + BOOL m_bConfirmOnDelete; + + COLORREF GetColorButtonColor(UINT nCtlID); + void SetColorButtonColor(UINT nCtlID, COLORREF); +}; + +///////////////////////////////////////////////////////////////////////////// +// CIdentityPrefs + +class CIdentityPrefs : public CMailNewsPropertyPage { + public: + CIdentityPrefs(); + + protected: + BOOL InitDialog(); + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode); + + private: + CString m_strName; + CString m_strEmail; + CString m_strReply; + CString m_strOrganization; + CString m_strSigFile; + BOOL m_bAttchVCard; +}; + +///////////////////////////////////////////////////////////////////////////// +// CMessagesPrefs + +class CMessagesPrefs : public CMailNewsPropertyPage { + public: + CMessagesPrefs(); + + protected: + BOOL InitDialog(); + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode); + + private: + + void ValidateNonZero(); + + int m_nForwardChoice; + BOOL m_bAutoQuote; + int m_nRadioQuoteType; + BOOL m_bWarpIncoming; + int m_nWrapLen; + int m_nRadio8bits; +}; + +///////////////////////////////////////////////////////////////////////////// +// CMailServerPrefs + +class CMailServerPrefs : public CMailNewsPropertyPage { + public: + CMailServerPrefs(); + + protected: + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL InitDialog(); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode); + + private: + + int m_nServerType; + int m_nUseSSL; + CString m_strPopServer; + CString m_strUserName; + CString m_strOutServer; + CString m_strMailDir; + BOOL m_bSetDefault; + + void GetPopServerName(); + void GetMailServerType(); + void GetIMAPServers(HWND hwndList); + void CheckButtons(HWND hwndList); + void DoDefaultServer(HWND hwndList); +}; + +///////////////////////////////////////////////////////////////////////////// +// CNewsServerPrefs + +class CNewsServerPrefs : public CMailNewsPropertyPage { + public: + CNewsServerPrefs(); + + protected: + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL InitDialog(); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + void DoDefaultServer(HWND hwndList); + int GetDefaultServerIndex(HWND hwndList); + void SetServerName(HWND hwndList, int nIndex, CString& name); + void CheckButtons(HWND hwndList); + + BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode); + + private: + CString m_strNewsServer; + CString m_strNewsDir; + BOOL m_bNotify; + BOOL m_bSecure; + int m_nMaxMsgs; + int m_nPort; + LPVOID m_pDefaultServer; +}; + +///////////////////////////////////////////////////////////////////////////// +// CMailReceiptPrefs + +class CMailReceiptPrefs : public CMailNewsPropertyPage { + public: + CMailReceiptPrefs(); + + protected: + BOOL InitDialog(); + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + + // Event Processing + BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode); + + private: + int m_nRequestReceipt; + int m_nReceiptArrive; + int m_nEnableRespond; +}; + +///////////////////////////////////////////////////////////////////////////// +// CHTMLFormatPrefs + +class CHTMLFormatPrefs : public CMailNewsPropertyPage { + public: + CHTMLFormatPrefs(); + + protected: + BOOL InitDialog(); + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + + private: + BOOL m_nRadioCompose; + int m_nRadioHTML; +}; + +///////////////////////////////////////////////////////////////////////////// +// COutgoingMsgPrefs + +class COutgoingMsgPrefs : public CMailNewsPropertyPage { + public: + COutgoingMsgPrefs(); + + protected: + BOOL InitDialog(); + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + + BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode); + + private: + + BOOL m_bMailCcSelf; + CString m_strMailDefaultCc; + BOOL m_bNewsCcSelf; + CString m_strNewsDefaultCc; + BOOL m_bMailUseFcc; + CString m_strMailFccFolder; + BOOL m_bNewsUseFcc; + CString m_strNewsFccFolder; + BOOL m_bUseDrafts; + CString m_strDraftFolder; + BOOL m_bUseTemplates; + CString m_strTemplateFolder; + + BOOL m_bMailImapFcc; + BOOL m_bNewsImapFcc; + + void GetCheckText(CString& szFolderPath, int nType, int nCtlID, int nStrID); + void ChooseFolder(CString& szFolderPath, int nType, int nCtlID, int nStrID); + void SetCheckText(const char* pFolder, const char* pServer, int nCtlID, int nStrID); +}; + +///////////////////////////////////////////////////////////////////////////// +// CAddressingPrefs + +class CAddressingPrefs : public CMailNewsPropertyPage { + public: + CAddressingPrefs(); + + protected: + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + BOOL InitDialog(); + + // Event Processing + BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode); + + private: + + void FillDirComboBox(); + void SetDirAutoComplete(BOOL bOnOrOff); + + int m_nRadioSortChoice; + int m_nRadioListChoice; + BOOL m_bInAddressBook; + BOOL m_bInDirectory; + BOOL m_bMatchPabName; + CString m_strLdapDir; +}; + +///////////////////////////////////////////////////////////////////////////// +// CDiskSpacePrefs + +class CDiskSpacePrefs : public CMailNewsPropertyPage { + public: + CDiskSpacePrefs(); + + protected: + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL InitDialog(); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + + // Event Processing + BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode); + + private: + + BOOL m_bLimitSize; + int m_nLimitSize; + BOOL m_bPromptPurge; + int m_nPurgeSize; + int m_nKeepMethod; + int m_nKeepDays; + int m_nKeepCounts; + BOOL m_bKeepUnread; + int m_nRemoveDays; + BOOL m_bRemoveBody; +}; + +///////////////////////////////////////////////////////////////////////////// +// COfflinePrefs + +class COfflinePrefs : public CMailNewsPropertyPage { + public: + COfflinePrefs(); + + protected: + BOOL InitDialog(); + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + + private: + + int m_nModeRadioChoice; + int m_nOnlineRadioChoice; + BOOL m_bPromptSynchronize; +}; + +///////////////////////////////////////////////////////////////////////////// +// COfflineNewsPrefs + +class COfflineNewsPrefs : public CMailNewsPropertyPage { + public: + COfflineNewsPrefs(); + + protected: + BOOL InitDialog(); + STDMETHODIMP Activate(HWND hwndParent, LPCRECT lprc, BOOL bModal); + BOOL DoTransfer(BOOL bSaveAndValidate); + BOOL ApplyChanges(); + BOOL OnCommand(int id, HWND hwndCtl, UINT notifyCode); + + private: + + void EnableCheckByDate(BOOL bEnable); + void SetDiscussionCount(int nCount); + + int m_nDownLoadMsg; + int m_nDownloadRadioChoice; + int m_nDownLoadInterval; + int m_nDownLoadDays; + int m_nDiscussions; + + BOOL m_bByMessage; + BOOL m_bUnreadOnly; + BOOL m_bByDate; + +}; + +#endif /* __NSPROP_H_ */ + diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/pch.h b/mozilla/cmd/winfe/prefs/mnpref/src/pch.h new file mode 100644 index 00000000000..c58bb185551 --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/pch.h @@ -0,0 +1,37 @@ +/* -*- 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. + */ + +// Common header file + +#ifdef _WIN32 +#include +#else +#include +#include +#endif +#include +#include + +#ifndef _WIN32 +typedef DWORD LCID; + +#define GET_WM_COMMAND_ID(wp, lp) ((int)(wp)) +#define GET_WM_COMMAND_HWND(wp, lp) ((HWND)LOWORD(lp)) +#define GET_WM_COMMAND_CMD(wp, lp) ((UINT)HIWORD(lp)) +#endif + diff --git a/mozilla/cmd/winfe/prefs/mnpref/src/resource.h b/mozilla/cmd/winfe/prefs/mnpref/src/resource.h new file mode 100644 index 00000000000..7ae8af0a22d --- /dev/null +++ b/mozilla/cmd/winfe/prefs/mnpref/src/resource.h @@ -0,0 +1,258 @@ +/* -*- 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. + */ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by mnpref.rc +// +#define IDS_YESTERDAY 11 +#define IDS_1_WEEK 12 +#define IDS_2_WEEK 13 +#define IDS_1_MONTH 14 +#define IDS_6_MONTH 15 +#define IDS_1_YEAR 16 +#define IDS_SELECT_COUNT 17 +#define IDS_NUMERIC_ONLY 18 +#define IDS_PLAIN 21 +#define IDS_BOLD 22 +#define IDS_ITALIC 23 +#define IDS_BOLD_ITALIC 24 +#define IDS_FONT_SIZE_FIRST 31 +#define IDS_FONT_SIZE_2 32 +#define IDS_FONT_SIZE_LAST 33 +#define IDS_MESSAGES 34 +#define IDS_GROUPS_SERVER 35 +#define IDS_DOWNLOAD 36 +#define IDS_NEVER 37 +#define IDS_AUTOMATICALLY 38 +#define IDS_ASK_ME 39 +#define IDS_FOLDER_MAIL 40 +#define IDS_FOLDER_NEWS 41 +#define IDS_FOLDER_DRAFT 42 +#define IDS_FOLDER_TEMPLATE 43 +#define IDS_DISK_SPACE 44 +#define IDS_MORE_DISK_SPACE 45 +#define IDS_DEFAULT 46 +#define IDS_NON_ZERO 47 +#define IDD_MAILNEWS 101 +#define IDD_IDENTITY 102 +#define IDD_MESSAGES 103 +#define IDD_MAILSERVER 104 +#define IDD_NEWSSERVER 105 +#define IDD_DIRECTORY 106 +#define IDD_READRECEIPT 107 +#define IDD_CREATECARD 108 +#define IDD_OFFLINE 109 +#define IDD_OFFLINE_MAIL 110 +#define IDD_OFFLINE_NEWS 111 +#define IDD_OFFLINE_DISK_SPACE 112 +#define IDD_OFFLINE_MORE 113 +#define IDD_MORE_MESSAGES 114 +#define IDD_RECEIPT_CUSTOMIZE 115 +#define IDD_OUTGOING_MSG 116 +#define IDD_HTML_FORMATTING 117 +#define IDD_ADDRESSING 118 +#define IDD_DISK_SPACE 119 +#define IDS_FORWARDINLINE 120 +#define IDS_FORWARDQUOTE 121 +#define IDS_FORWARDATTACHMENT 122 +#define IDS_REPLYABOVE 123 +#define IDS_REPLYBELOW 124 +#define IDS_REPLYSELECT 125 +#define IDD_DISK_SPACE_MORE 127 +#define IDC_EDIT_MAIL_TOADDRESS 201 +#define IDC_EDIT_NEWS_TOADDRESS 202 +#define IDC_EDIT 203 +#define IDC_DELETE 204 +#define IDC_MOVEDOWN 205 +#define IDC_DEFAULT 205 +#define IDC_MISC_8BIT 206 +#define IDC_MORE_RECEIPT 206 +#define IDC_MISC_MIME 207 +#define IDC_CHECK_NEWS_SELF 208 +#define IDC_HTMLCOMPOSE 209 +#define IDC_CHECK_MAIL_FOLDER 210 +#define IDC_PLAINCOMPOSE 210 +#define IDC_CHECK_NEWS_FOLDER 211 +#define IDC_EDIT_NEWS_SERVER 212 +#define IDC_EDIT_SMTP_SERVER 213 +#define IDC_OPEN_WINDOW 214 +#define IDC_EDIT_NAME 215 +#define IDC_NEW 216 +#define IDC_RADIO_POP 217 +#define IDC_RADIO_IMAP 218 +#define IDC_REUSE_WINDOW 219 +#define IDC_EDIT_EMAIL 220 +#define IDC_EDIT_REPLYTO 221 +#define IDC_EDIT_SIGFILE 222 +#define IDC_BUTTON_BROWSE 223 +#define IDC_BUTTON_EDITCARD 224 +#define IDC_EDIT_NEWS_DIR 225 +#define IDC_CHECK_MAIL_SELF 226 +#define IDC_CHECK_AUTO_QUOTE 227 +#define IDC_EDIT_IN_SERVER 228 +#define IDC_EDIT_POP_SERVER 228 +#define IDC_EDIT_MAIL_DIR 229 +#define IDC_BUTTON_MORE 230 +#define IDC_RADIO_REMOVE 231 +#define IDC_RADIO_LEFT 232 +#define IDC_CHECK_MAIL 233 +#define IDC_CHECK_MESSAGE 234 +#define IDC_EDIT_CHECK_MAIL 235 +#define IDC_EDIT_MESSAGE_SIZE 236 +#define IDC_CHOOSE_COLOR 237 +#define IDC_CHOOSE_FOLDER_NEWS 237 +#define IDC_COLOR 238 +#define IDC_CHOOSE_FOLDER_DRAFT 238 +#define IDC_CHOOSE_FONT 239 +#define IDC_CHOOSE_FOLDER_TEMPLATE 239 +#define IDC_MOVEUP 240 +#define IDC_COMBO_MAIL_FOLDER 241 +#define IDC_COMBO_NEWS_FOLDER 242 +#define IDC_CHECK_ENCRYPTED 243 +#define IDC_FIRSTNAME_FIRST 244 +#define IDC_LASTNAME_FIRST 245 +#define IDC_SERVERS_LIST 246 +#define IDC_STATIC_FONT 247 +#define IDC_STATIC_STYLE 248 +#define IDC_STATIC_SIZE 249 +#define IDC_ATTACH_VCARD 250 +#define IDC_RADIO_FIXED 251 +#define IDC_RADIO_VARIABLE 252 +#define IDC_NOT_TOCC 1000 +#define IDC_PREVIOUS_STATE 1001 +#define IDC_ASK_ME 1002 +#define IDC_OUTSIDE_DOMAIN 1001 +#define IDC_AUTO_SELECT 1001 +#define IDC_DOWNLOAD_BY_MSG 1001 +#define IDC_GENERAL 1002 +#define IDC_DOWNLOAD_BY_DATE 1003 +#define IDC_RADIO_FROM 1004 +#define IDC_RADIO_SINCE 1005 +#define IDC_COMBO_FROM 1006 +#define IDC_EDIT1 1007 +#define IDC_EDIT_DAYS 1007 +#define IDC_EDIT_WRAP_LEN 1007 +#define IDC_EDIT_PORT 1007 +#define IDC_SELECT_DOWNLOAD 1008 +#define IDC_EDIT_MSG_DAYS 1008 +#define IDC_STATIC_SELECT_NO 1009 +#define IDC_EDIT_MSG_COOUNT 1009 +#define IDC_EDIT_REMOVE_DAYS 1009 +#define IDC_CHECK_MSG_SIZE 1010 +#define IDC_UNREAD_ONLY 1010 +#define IDC_CHECK_MSG_DAYS 1011 +#define IDC_CHECK_MSG_READ 1012 +#define IDC_EDIT_MSG_SIZE 1013 +#define IDC_CHECK_COMPACT_SIZE 1014 +#define IDC_EDIT_COMPACT_SIZE 1015 +#define IDC_KEEP_MSG_DAYS 1016 +#define IDC_KEEP_ALL 1017 +#define IDC_EXPAND_BOTH 1017 +#define IDC_KEEP_COUNT 1018 +#define IDC_SECURE 1018 +#define IDC_EXPAND_NICKNAME 1018 +#define IDC_SAVE_PASSWORD 1019 +#define IDC_RADIO_8BITS 1019 +#define IDC_RADIO_MIME 1020 +#define IDC_KEEP_UNREAD 1020 +#define IDC_ASK 1021 +#define IDC_CUSTOMIZE 1021 +#define IDC_PLAIN 1022 +#define IDC_STATIC_DAYS_AGO 1022 +#define IDC_FONT_SIZE 1023 +#define IDC_ANYWAY 1023 +#define IDC_CHECK_SECURE 1023 +#define IDC_BOTH 1024 +#define IDC_STATIC1 1024 +#define IDC_ENABLE_RESPOND 1025 +#define IDC_ALWAYS_REQUEST 1026 +#define IDC_STATIC2 1028 +#define IDC_STATIC3 1029 +#define IDC_RADIO_SERVER_ONLY 1031 +#define IDC_RADIO_CLIENT_ONLY 1032 +#define IDC_RADIO_BOTH 1033 +#define IDC_RADIO_IN_INBOX 1034 +#define IDC_RADIO_TO_SENT 1035 +#define IDC_RADIO_NO_RECEIPT 1036 +#define IDC_RADIO_CUSTOMIZE_RECEIPT 1037 +#define IDC_WRAP_INCOMING 1037 +#define IDC_ABOVE 1038 +#define IDC_BELOW 1039 +#define IDC_CHECK_MAIL_OTHER 1039 +#define IDC_SELECT 1040 +#define IDC_CHOOSE_FOLDER_MAIL 1040 +#define IDC_CHECK_NEWS_OTHER 1041 +#define IDC_CHECK_DRAFT 1042 +#define IDC_STATIC_DRAFT 1042 +#define IDC_CHECK1 1043 +#define IDC_CHECK_TEMPLATE 1043 +#define IDC_PROMPT_SYNCHRONIZE 1043 +#define IDC_STATIC_TEMPLATE 1043 +#define IDC_REMEMBER_LAST_MESSAGE 1043 +#define IDC_CHECK_IN_PAB 1044 +#define IDC_CONFIRM_ON_DELETE 1044 +#define IDC_CHECK_IN_DIR 1045 +#define IDC_COMBO_DIRS 1046 +#define IDC_CHECK_PAB_FIRST 1047 +#define IDC_RADIO_SHOW 1048 +#define IDC_RADIO_NO_SHOW 1049 +#define IDC_RADIO_NEVER 1050 +#define IDC_RADIO_POSSIBLE 1051 +#define IDC_RADIO_ALWAYS 1052 +#define IDC_COMBO_FORWARD 1052 +#define IDC_COMBO_REPLY 1053 +#define IDC_ONLINE_RADIO1 1054 +#define IDC_ONLINE_RADIO2 1055 +#define IDC_CHECK_DOWNLOAD 1055 +#define IDC_ONLINE_RADIO3 1056 +#define IDC_SHOW_IN_THREAD 1201 +#define IDC_REUSE_THREAD_WINDOW 1380 +#define IDC_EDIT_ORGANIZATION 1383 +#define IDC_EDIT_IMAP_DIR 1395 +#define IDC_STATIC_SERVER 1414 +#define IDC_EDIT_MAX_HITS 1415 +#define IDC_EDIT_PORT_NO 1416 +#define IDC_STATIC_ROOT 1417 +#define IDC_EDIT_ROOT 1418 +#define IDC_STATIC_PORT 1419 +#define IDC_STATIC_MAX_HITS 1420 +#define IDC_CHECK_PASSWORD 1421 +#define IDC_EDIT_SERVER 1423 +#define IDC_EDIT_DESCRIPTION 1424 +#define IDC_FONT_STYLE 1449 +#define IDC_EDIT_MSG_COUNT 1454 +#define IDC_EDIT_MSG_ONCE 1455 +#define IDC_REUSE_MESSAGE_WINDOW 1456 +#define IDC_CHECK_NOTIFY 1457 +#define IDC_ENABLE_SOUND 1457 +#define IDC_CHECK_POP_REMOTE 1458 +#define IDC_CHECK_IMAP_LOCAL 1459 +#define IDC_CHECK_IMAP_SSL 1460 +#define IDC_CHECK_IMAP_TRASH 1461 +#define IDC_USE_MAPI 1493 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 308 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1056 +#define _APS_NEXT_SYMED_VALUE 300 +#endif +#endif diff --git a/mozilla/cmd/winfe/res/editor.rc2 b/mozilla/cmd/winfe/res/editor.rc2 index b2bb4f85368..2dc9272b71a 100644 --- a/mozilla/cmd/winfe/res/editor.rc2 +++ b/mozilla/cmd/winfe/res/editor.rc2 @@ -45,10 +45,13 @@ BEGIN MENUITEM "Page From &Template...", ID_EDT_NEW_DOC_FROM_TEMPLATE MENUITEM "Page From &Wizard...", ID_COMMAND_PAGE_FROM_WIZARD END - MENUITEM SEPARATOR - MENUITEM "&Save Draft\tCtrl+S", IDM_SAVEASDRAFT - MENUITEM "Save Template\tCtrl+T", IDM_SAVEASTEMPLATE - MENUITEM "Save &As ...", IDM_SAVEAS + POPUP "Save &As" + BEGIN + MENUITEM "&File...", IDM_SAVEAS + MENUITEM SEPARATOR + MENUITEM "&Draft\tCtrl+S", IDM_SAVEASDRAFT + MENUITEM "&Template\tCtrl+T", IDM_SAVEASTEMPLATE + END MENUITEM SEPARATOR MENUITEM "Sen&d Now\tCtrl+Enter", IDM_SENDNOW MENUITEM "Send &Later", IDM_SENDLATER @@ -58,12 +61,14 @@ BEGIN BEGIN MENUITEM "&File...", IDM_ATTACHFILE MENUITEM "&Web Page...", IDM_ATTACHWEBPAGE - MENUITEM "&Address Book Card...", IDM_ATTACHVCARD - MENUITEM SEPARATOR + MENUITEM SEPARATOR MENUITEM "&My Address Book Card", IDM_ATTACHMYCARD END MENUITEM SEPARATOR - MENUITEM "Go Offl&ine...", ID_BIG_SWITCH + MENUITEM "Sen&d Now\tCtrl+Enter", IDM_SENDNOW + MENUITEM "Send &Later", IDM_SENDLATER + MENUITEM "&Quote Original Text", IDM_QUOTEORIGINAL + MENUITEM "Selec&t Addresses...", IDM_ADDRESSPICKER MENUITEM SEPARATOR MENUITEM "Pa&ge Setup...", ID_FILE_PAGE_SETUP MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW @@ -90,9 +95,11 @@ BEGIN MENUITEM SEPARATOR MENUITEM "&Find in Message\tCtrl+F", ID_EDIT_FINDINCURRENT MENUITEM "Find A&gain\tCtrl+G", ID_EDIT_FINDAGAIN - MENUITEM "Search Director&y", IDM_SEARCHADDRESSES - MENUITEM SEPARATOR - MENUITEM "Pr&eferences...", ID_OPTIONS_PREFERENCES + MENUITEM SEPARATOR + MENUITEM "Name Completion", ID_TOGGLENAMECOMPLETION + MENUITEM "Show Name Picker\tCtrl+J" ID_SHOW_NAME_PICKER + MENUITEM SEPARATOR + MENUITEM "Pr&eferences...", ID_OPTIONS_PREFERENCES END POPUP "&View" BEGIN @@ -292,6 +299,9 @@ BEGIN MENUITEM "&History\tCtrl+H", ID_GO_HISTORY MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY +#ifdef MOZ_MAIL_NEWS + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS +#endif MENUITEM SEPARATOR MENUITEM "{}", ID_WINDOW_WINDOW_0 END @@ -357,7 +367,6 @@ BEGIN MENUITEM SEPARATOR MENUITEM "&Find in Page...\tCtrl+F", ID_EDIT_FINDINCURRENT MENUITEM "Find A&gain\tF3", ID_EDIT_FINDAGAIN - MENUITEM "Search Director&y", IDM_SEARCHADDRESSES // Restore when implemented: // MENUITEM "&Replace...", ID_EDT_FINDREPLACE MENUITEM SEPARATOR @@ -571,6 +580,9 @@ BEGIN MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE #endif MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY +#ifdef MOZ_MAIL_NEWS + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS +#endif MENUITEM SEPARATOR #ifdef XP_WIN16 MENUITEM "New Window" ID_WINDOW_WINDOW_0 diff --git a/mozilla/cmd/winfe/res/mozilla.rc2 b/mozilla/cmd/winfe/res/mozilla.rc2 index a6b17efc551..3f32343f8f8 100644 --- a/mozilla/cmd/winfe/res/mozilla.rc2 +++ b/mozilla/cmd/winfe/res/mozilla.rc2 @@ -85,7 +85,7 @@ BEGIN #ifdef MOZ_MAIL_NEWS IDR_MAILFRAME "Mozilla Message Center\nMozilla\nMozilla Document" IDR_MAILTHREAD "Mozilla Folder\nMozilla\nMozilla Document" - IDR_NEWSTHREAD "Mozilla Discussion\nMozilla\nMozilla Document" + IDR_NEWSTHREAD "Mozilla Newsgroup\nMozilla\nMozilla Document" IDR_MESSAGEFRAME "Mozilla Message\nMozilla\nMozilla Document" IDR_NEWSMSGFRAME "Mozilla Message\nMozilla\nMozilla Document" IDR_CATEGORYFRAME "Mozilla Category\nMozilla\nMozilla Document" @@ -444,8 +444,7 @@ BEGIN BEGIN MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB #ifdef MOZ_MAIL_NEWS - MENUITEM "&Messenger Mailbox\tCtrl+2", ID_TOOLS_INBOX - MENUITEM "Collabra &Discussion Groups\tCtrl+3", ID_TOOLS_NEWS + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX #endif /* MOZ_MAIL_NEWS */ #ifdef EDITOR MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR @@ -476,6 +475,9 @@ BEGIN END MENUITEM "&History\tCtrl+H", ID_GO_HISTORY MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY +#ifdef MOZ_MAIL_NEWS + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS +#endif MENUITEM SEPARATOR END POPUP "&Help" @@ -630,8 +632,7 @@ BEGIN BEGIN MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB #ifdef MOZ_MAIL_NEWS - MENUITEM "&Messenger Mailbox\tCtrl+2", ID_TOOLS_INBOX - MENUITEM "Collabra &Discussion Groups\tCtrl+3", ID_TOOLS_NEWS + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX #endif /* MOZ_MAIL_NEWS */ #ifdef EDITOR MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR @@ -667,6 +668,9 @@ BEGIN MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE #endif MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY +#ifdef MOZ_MAIL_NEWS + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS +#endif //MOZ_MAIL_NEWS MENUITEM SEPARATOR #ifdef XP_WIN16 MENUITEM "New Window" ID_WINDOW_WINDOW_0 @@ -727,6 +731,7 @@ BEGIN MENUITEM "&Upload File...", ID_FILE_UPLOADFILE #ifdef MOZ_OFFLINE MENUITEM SEPARATOR + MENUITEM "Synchronize..." ID_SYNCHRONIZE MENUITEM "Go Offl&ine...", ID_BIG_SWITCH #endif /* MOZ_OFFLINE */ MENUITEM SEPARATOR @@ -861,6 +866,7 @@ BEGIN MENUITEM "&Upload File...", ID_FILE_UPLOADFILE MENUITEM SEPARATOR #ifdef MOZ_OFFLINE + MENUITEM "Synchronize..." ID_SYNCHRONIZE MENUITEM "Go Offl&ine...", ID_BIG_SWITCH MENUITEM SEPARATOR #endif /* MOZ_OFFLINE */ @@ -960,8 +966,7 @@ BEGIN BEGIN MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB #ifdef MOZ_MAIL_NEWS - MENUITEM "&Messenger Mailbox\tCtrl+2", ID_TOOLS_INBOX - MENUITEM "Collabra &Discussion Groups\tCtrl+3", ID_TOOLS_NEWS + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX #endif // MOZ_MAIL_NEWS #ifdef EDITOR MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR @@ -1057,7 +1062,7 @@ END IDD_WIZARD_COVERPAGE DIALOG DISCARDABLE 0, 0, 240, 160 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION | WS_SYSMENU -CAPTION "Mail and Discussion Groups Setup" +CAPTION "Mail and Newsgroups Setup" FONT 8, "MS Sans Serif" BEGIN LTEXT "title",IDC_STATIC_TITLE,0,0,216,39 @@ -1068,7 +1073,7 @@ END #ifdef MOZ_MAIL_NEWS IDD_WIZARD_READNEWS DIALOG DISCARDABLE 0, 0, 240, 159 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION | WS_SYSMENU -CAPTION "Mail and Discussion Groups Setup" +CAPTION "Mail and Newsgroups Setup" FONT 8, "MS Sans Serif" BEGIN LTEXT "title",IDC_STATIC_TITLE,0,0,229,25 @@ -1084,7 +1089,7 @@ END IDD_WIZARD_RECEIVEMAIL DIALOG DISCARDABLE 0, 0, 240, 160 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION | WS_SYSMENU -CAPTION "Mail and Discussion Groups Setup" +CAPTION "Mail and Newsgroups Setup" FONT 8, "MS Sans Serif" BEGIN LTEXT "title",IDC_STATIC_TITLE,0,0,229,25 @@ -1104,7 +1109,7 @@ END IDD_WIZARD_SENDMAIL DIALOG DISCARDABLE 0, 0, 240, 160 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION | WS_SYSMENU -CAPTION "Mail and Discussion Groups Setup" +CAPTION "Mail and Newsgroups Setup" FONT 8, "MS Sans Serif" BEGIN LTEXT "title",IDC_STATIC_TITLE,0,0,229,25 @@ -1128,7 +1133,7 @@ END IDD_WIZARD_MAILNEWS_WIN16 DIALOG DISCARDABLE 0, 0, 279, 207 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Mail and Discussion Groups Setup" +CAPTION "Mail and Newsgroups Setup" FONT 8, "MS Sans Serif" BEGIN LTEXT "title",IDC_STATIC_TITLE,10,6,215,34 @@ -1773,7 +1778,7 @@ BEGIN END MENUITEM "Ne&w Folder...", ID_FILE_NEWFOLDER - MENUITEM "New Discussion &Group Server...", ID_FILE_NEWNEWSHOST + MENUITEM "New News&group Server...", ID_FILE_NEWNEWSHOST MENUITEM "&Open Folder\tCtrl+O", ID_FILE_OPENFOLDER MENUITEM SEPARATOR MENUITEM "&Rename Folder...", ID_FOLDER_RENAME @@ -1787,9 +1792,12 @@ BEGIN END MENUITEM "Send Unsent &Messages", ID_FILE_DELIVERMAILNOW MENUITEM "&Update Message Count", ID_FILE_UPDATECOUNTS - MENUITEM "Su&bscribe to Discussion Groups...", ID_FILE_SUBSCRIBE - MENUITEM SEPARATOR + MENUITEM "Su&bscribe to Newsgroups...", ID_FILE_SUBSCRIBE +#ifdef MOZ_OFFLINE + MENUITEM SEPARATOR + MENUITEM "Synchronize..." ID_SYNCHRONIZE MENUITEM "Go Offl&ine...", ID_BIG_SWITCH +#endif //MOZ_OFFLINE MENUITEM SEPARATOR MENUITEM "&Close\tCtrl+W", ID_FILE_CLOSE MENUITEM "E&xit\tCtrl+Q", ID_APP_EXIT @@ -1808,9 +1816,6 @@ BEGIN MENUITEM "Search &Messages", ID_EDIT_SEARCH MENUITEM "Search Director&y", ID_EDIT_LDAPSEARCH MENUITEM SEPARATOR - MENUITEM "Ma&nage Mail Account", ID_EDIT_MANAGEMAILACCOUNT - MENUITEM "Manage Discussion Gr&oup", ID_EDIT_SERVER - MENUITEM SEPARATOR MENUITEM "Mai&l Filters...", ID_EDIT_FILTER MENUITEM "Propertie&s\tAlt+Enter", ID_VIEW_PROPERTIES MENUITEM "Pr&eferences...", ID_OPTIONS_MAILANDNEWS @@ -1830,8 +1835,7 @@ BEGIN POPUP "&Communicator" BEGIN MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB - MENUITEM "&Messenger Mailbox\tCtrl+2", ID_TOOLS_INBOX - MENUITEM "Collabra &Discussion Groups\tCtrl+3", ID_TOOLS_NEWS + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR MENUITEM "&Conference\tCtrl+5", ID_WINDOW_LIVECALL MENUITEM SEPARATOR @@ -1861,6 +1865,12 @@ BEGIN MENUITEM "&History\tCtrl+H", ID_GO_HISTORY MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS + POPUP "Server Tools" + BEGIN + MENUITEM "Ma&nage Mail Account", ID_EDIT_MANAGEMAILACCOUNT + MENUITEM "&Manage Newsgroups", ID_EDIT_SERVER + END MENUITEM SEPARATOR MENUITEM "Replace Me!", ID_WINDOW_WINDOW_0 END @@ -1870,6 +1880,117 @@ BEGIN END END +#define MOZ_NEWADDR 1 +#ifdef MOZ_NEWADDR +IDR_ADDRESS_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + POPUP "&New" + BEGIN + MENUITEM "&Navigator Window\tCtrl+N", ID_NEW_FRAME + MENUITEM "&Message\tCtrl+M", ID_FILE_NEWMESSAGE + MENUITEM SEPARATOR + MENUITEM "Blank &Page\tCtrl+Shift+N", ID_EDT_NEW_DOC_BLANK + MENUITEM "Page From &Template", ID_EDT_NEW_DOC_FROM_TEMPLATE + + MENUITEM "Page From &Wizard...", ID_COMMAND_PAGE_FROM_WIZARD + MENUITEM SEPARATOR + MENUITEM "&Card...\tCtrl+N", ID_ITEM_ADDUSER + MENUITEM "&List...", ID_ITEM_ADDLIST + MENUITEM "&Address &Book..." ID_FILE_NEWAB + MENUITEM "&Directory..." ID_FILE_NEWDIR + END + MENUITEM SEPARATOR + MENUITEM "&Import...", ID_FILE_IMPORT + MENUITEM "&Export...\tCtrl+S", ID_FILE_SAVEAS + MENUITEM SEPARATOR + MENUITEM "C&all", ID_LIVE_CALL + MENUITEM SEPARATOR + MENUITEM "&Close\tCtrl+W", ID_FILE_CLOSE + MENUITEM "E&xit\tCtrl+Q", ID_APP_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO + MENUITEM "&Redo\tCtrl+E", ID_EDIT_REDO + MENUITEM SEPARATOR + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + MENUITEM "&Delete\tDel", ID_EDIT_DELETE + MENUITEM "Delete &From All Lists", ID_EDIT_DELETEALL + MENUITEM "&Select All\tCtrl+A", ID_EDIT_SELECT_ALL + MENUITEM SEPARATOR + MENUITEM "&HTML Domains...", ID_EDIT_DOMAINS + MENUITEM "Card &Properties", ID_ITEM_PROPERTIES + MENUITEM "P&references...", ID_OPTIONS_MAILANDNEWS + END + POPUP "&View" + BEGIN + MENUITEM "Address &Book Toolbar ", ID_VIEW_ABTOOLBAR + MENUITEM "&Directory Pane", ID_VIEW_DIRPANE + MENUITEM SEPARATOR + POPUP "S&ort" + BEGIN + MENUITEM "By &Type", ID_SORT_COL0 + MENUITEM "By &Name", ID_SORT_COL1 + MENUITEM "By &Email Address", ID_SORT_COL2 + MENUITEM "By &Company", ID_SORT_COL3 + MENUITEM "By C&ity", ID_SORT_COL4 + MENUITEM "By &Phone", ID_SORT_COL5 + MENUITEM "By Nic&kname", ID_SORT_COL6 + MENUITEM SEPARATOR + MENUITEM "Sort &Ascending", ID_ASCENDING + MENUITEM "Sort &Descending", ID_DECENDING + END + MENUITEM SEPARATOR + MENUITEM "S&earch...", ID_DIRSEARCH + MENUITEM "S&top\tESC", ID_NAVIGATE_INTERRUPT + MENUITEM SEPARATOR + MENUITEM "My Address B&ook Card", ID_CREATE_CARD + END + POPUP "&Communicator" + BEGIN + MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX + MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR + MENUITEM "&Conference\tCtrl+5", ID_WINDOW_LIVECALL + MENUITEM SEPARATOR + MENUITEM "Show Componen&t Bar", ID_WINDOW_TASKBAR + MENUITEM "Messa&ge Center\tCtrl+Shift+1", ID_TOOLS_MAIL + MENUITEM "&Address Book\tCtrl+Shift+2", ID_TOOLS_ADDRESSBOOK + POPUP "&Bookmarks" + BEGIN + MENUITEM "Add Bookmar&k\tCtrl+D", ID_HOTLIST_ADDCURRENTTOHOTLIST + + POPUP "&File Bookmark" + BEGIN + MENUITEM "Root", ID_BOOKMARKS_FILEROOT + + END + MENUITEM "Edit &Bookmarks...\tCtrl+B", ID_HOTLIST_VIEW + MENUITEM SEPARATOR + POPUP "&Guide" + BEGIN + MENUITEM "PLACEHOLDER", IDC_FIRST_PLACES_MENU_ID + + END + MENUITEM SEPARATOR + END + MENUITEM "&History\tCtrl+H", ID_GO_HISTORY + MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE + MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS + MENUITEM SEPARATOR + MENUITEM "Replace Me!", ID_WINDOW_WINDOW_0 + END + POPUP "&Help" + BEGIN + MENUITEM "PLACEHOLDER", IDC_FIRST_HELP_MENU_ID + END +END +#else IDR_ADDRESS_MENU MENU DISCARDABLE BEGIN POPUP "&File" @@ -1910,8 +2031,9 @@ BEGIN POPUP "&View" BEGIN MENUITEM "Address &Book Toolbar ", ID_VIEW_ABTOOLBAR - MENUITEM SEPARATOR - MENUITEM "By &Type", ID_SORT_TYPE + MENUITEM "&Directory Pane", ID_VIEW_DIRPANE + MENUITEM SEPARATOR + MENUITEM "By &Type", ID_SORT_TYPE MENUITEM "By &Name", ID_SORT_NAME MENUITEM "By &Email Address", ID_SORT_EMAILADDRESS MENUITEM "By &Company", ID_SORT_COMPANY @@ -1928,8 +2050,7 @@ BEGIN POPUP "&Communicator" BEGIN MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB - MENUITEM "&Messenger Mailbox\tCtrl+2", ID_TOOLS_INBOX - MENUITEM "Collabra &Discussion Groups\tCtrl+3", ID_TOOLS_NEWS + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR MENUITEM "&Conference\tCtrl+5", ID_WINDOW_LIVECALL MENUITEM SEPARATOR @@ -1957,6 +2078,7 @@ BEGIN MENUITEM "&History\tCtrl+H", ID_GO_HISTORY MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS MENUITEM SEPARATOR MENUITEM "Replace Me!", ID_WINDOW_WINDOW_0 END @@ -1965,6 +2087,7 @@ BEGIN MENUITEM "PLACEHOLDER", IDC_FIRST_HELP_MENU_ID END END +#endif IDR_MESSAGEFRAME MENU DISCARDABLE BEGIN @@ -1979,37 +2102,46 @@ BEGIN MENUITEM "Page From &Template", ID_EDT_NEW_DOC_FROM_TEMPLATE MENUITEM "Page From &Wizard...", ID_COMMAND_PAGE_FROM_WIZARD - + MENUITEM SEPARATOR + MENUITEM "Ne&w Folder...", ID_FILE_NEWFOLDER END - MENUITEM "Ne&w Folder...", ID_FILE_NEWFOLDER POPUP "Open &Attachments" BEGIN MENUITEM "&Replace Me", FIRST_ATTACH_MENU_ID END + POPUP "&Save As" + BEGIN + MENUITEM "&File...\tCtrl+S", ID_FILE_SAVEMESSAGES + END MENUITEM SEPARATOR - MENUITEM "&Save As...\tCtrl+S", ID_FILE_SAVEMESSAGES - MENUITEM "&Edit Message", ID_FILE_EDITMESSAGE + MENUITEM "Get New Messages\tCtrl+T", ID_FILE_GETNEWMAIL + MENUITEM "Send Unsent &Messages", ID_FILE_DELIVERMAILNOW + MENUITEM "Su&bscribe...", ID_FILE_SUBSCRIBE + MENUITEM SEPARATOR + MENUITEM "Empt&y Trash Folder", ID_FILE_EMPTYTRASHFOLDER + MENUITEM "Compact Fol&ders", ID_FILE_COMPRESSALLFOLDERS MENUITEM SEPARATOR - MENUITEM "&Rename Folder...", ID_FOLDER_RENAME - MENUITEM "Empt&y Trash Folder", ID_FILE_EMPTYTRASHFOLDER - MENUITEM "Compress Fol&ders", ID_FILE_COMPRESSALLFOLDERS + MENUITEM "Import...", ID_FILE_IMPORT_MAIL +#ifdef MOZ_OFFLINE MENUITEM SEPARATOR - POPUP "Ge&t Messages" - BEGIN - MENUITEM "&New\tCtrl+T", ID_FILE_GETNEWMAIL - MENUITEM "Ne&xt ###", ID_FILE_GETNEXT - END - MENUITEM "Send Unsent &Messages", ID_FILE_DELIVERMAILNOW - MENUITEM "Su&bscribe to Discussion Groups...", ID_FILE_SUBSCRIBE + POPUP "Synchronize" + BEGIN + MENUITEM "Synchronize Now..." ID_SYNCHRONIZE + MENUITEM SEPARATOR + MENUITEM "Download Flagged Messages", + ID_MESSAGE_RETRIEVEOFFLINE + MENUITEM "Download Selected Messages", + ID_MESSAGE_RETRIEVESELECTED + END + MENUITEM "Work Offl&ine...", ID_BIG_SWITCH +#endif //MOZ_OFFLINE MENUITEM SEPARATOR - MENUITEM "Go Offl&ine...", ID_BIG_SWITCH + MENUITEM "Pa&ge Setup...", ID_FILE_PAGE_SETUP + MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW + MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT MENUITEM SEPARATOR - MENUITEM "Pa&ge Setup...", ID_FILE_PAGE_SETUP - MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW - MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT - MENUITEM SEPARATOR - MENUITEM "&Close\tCtrl+W", ID_FILE_CLOSE - MENUITEM "E&xit\tCtrl+Q", ID_APP_EXIT + MENUITEM "&Close\tCtrl+W", ID_FILE_CLOSE + MENUITEM "E&xit\tCtrl+Q", ID_APP_EXIT END POPUP "&Edit" BEGIN @@ -2025,12 +2157,12 @@ BEGIN MENUITEM "&Find in Message...\tCtrl+F", ID_EDIT_FINDINCURRENT MENUITEM "Find A&gain\tCtrl+G", ID_EDIT_FINDAGAIN MENUITEM "Search &Messages", ID_EDIT_SEARCH - MENUITEM "Search Director&y", ID_EDIT_LDAPSEARCH + MENUITEM SEPARATOR + MENUITEM "Search &Messages", ID_EDIT_SEARCH + MENUITEM "Search Directories", ID_EDIT_LDAPSEARCH MENUITEM SEPARATOR - MENUITEM "Ma&nage Mail Account", ID_EDIT_MANAGEMAILACCOUNT - MENUITEM "Manage Discussion Gr&oup", ID_NEWS_MODERATE - MENUITEM SEPARATOR - MENUITEM "Mai&l Filters...", ID_EDIT_FILTER + MENUITEM "Message F&ilters...", ID_EDIT_FILTER + MENUITEM SEPARATOR MENUITEM "Pr&eferences...", ID_OPTIONS_MAILANDNEWS END POPUP "&View" @@ -2044,11 +2176,11 @@ BEGIN MENUITEM "&Normal", ID_VIEW_HEADERS_SHORT MENUITEM "&Brief", ID_VIEW_HEADERS_MICRO END - POPUP "&Attachments" - BEGIN - MENUITEM "&Inline", ID_VIEW_ATTACHINLINE - MENUITEM "As &Links", ID_VIEW_ATTACHLINKS - END + MENUITEM SEPARATOR + MENUITEM "View &Attachments Inline", ID_VIEW_ATTACHINLINE + MENUITEM "View Attachments As &Links", ID_VIEW_ATTACHLINKS + MENUITEM SEPARATOR + MENUITEM "Wrap Lon&g Lines", ID_MAIL_WRAPLONGLINES MENUITEM SEPARATOR MENUITEM "Increase &Font\tCtrl+]", ID_VIEW_INCREASEFONT MENUITEM "Decrease Fon&t\tCtrl+[", ID_VIEW_DECREASEFONT @@ -2059,7 +2191,6 @@ BEGIN MENUITEM "&Stop Loading\tESC", ID_NAVIGATE_INTERRUPT MENUITEM SEPARATOR MENUITEM "Unscram&ble (ROT13)", ID_VIEW_ROT13 - MENUITEM "Wrap Lon&g Lines", ID_MAIL_WRAPLONGLINES MENUITEM SEPARATOR MENUITEM "Page So&urce\tCtrl+U", ID_FILE_VIEWSOURCE MENUITEM "Page &Info", ID_FILE_DOCINFO @@ -2103,20 +2234,26 @@ BEGIN END POPUP "&Go" BEGIN - MENUITEM "&Next Message\tShift+N", ID_MESSAGE_NEXT - MENUITEM "Next &Unread Message\tN", ID_MESSAGE_NEXTUNREAD - MENUITEM "Next F&lagged Message", ID_MESSAGE_NEXTFLAGGED - MENUITEM "Next Unread &Thread\tT", ID_MESSAGE_NEXTUNREADTHREAD - - MENUITEM "Ne&xt Folder", ID_MESSAGE_NEXTNEWSGROUP - MENUITEM "Next Unrea&d Folder\tG", ID_MESSAGE_NEXTUNREADNEWSGROUP - - MENUITEM SEPARATOR - MENUITEM "&Previous Message\tShift+P", ID_MESSAGE_PREVIOUS - MENUITEM "Previou&s Unread Message\tP", ID_MESSAGE_PREVIOUSUNREAD - MENUITEM "Previous Fla&gged Message", ID_MESSAGE_PREVIOUSFLAGGED - MENUITEM SEPARATOR - MENUITEM "&First Flagged Message", ID_MESSAGE_FIRSTFLAGGED + MENUITEM "First Unread Message", ID_MESSAGE_FIRSTUNREAD + MENUITEM "&First Flagged Message", ID_MESSAGE_FIRSTFLAGGED + MENUITEM SEPARATOR + POPUP "Next" + BEGIN + MENUITEM "Message\tShift+N", ID_MESSAGE_NEXT + MENUITEM "&Unread Message\tN", ID_MESSAGE_NEXTUNREAD + MENUITEM "F&lagged Message", ID_MESSAGE_NEXTFLAGGED + MENUITEM SEPARATOR + MENUITEM "Unread &Thread\tT", ID_MESSAGE_NEXTUNREADTHREAD + MENUITEM SEPARATOR + MENUITEM "Folder" , ID_MESSAGE_NEXTNEWSGROUP + MENUITEM "Unrea&d Folder\tG", ID_MESSAGE_NEXTUNREADNEWSGROUP + END + POPUP "Previous" + BEGIN + MENUITEM "Message\tShift+P", ID_MESSAGE_PREVIOUS + MENUITEM "Unread Message\tP", ID_MESSAGE_PREVIOUSUNREAD + MENUITEM "Fla&gged Message", ID_MESSAGE_PREVIOUSFLAGGED + END MENUITEM SEPARATOR MENUITEM "&Back\tAlt+<-", ID_NAVIGATE_MSG_BACK MENUITEM "For&ward\tAlt+->", ID_NAVIGATE_MSG_FORWARD @@ -2126,30 +2263,30 @@ BEGIN MENUITEM "&New Message\tCtrl+M", ID_FILE_NEWMESSAGE POPUP "&Reply" BEGIN - MENUITEM "to &Sender\tCtrl+R", ID_MESSAGE_REPLY + MENUITEM "to &Sender Only\tCtrl+R", ID_MESSAGE_REPLY MENUITEM "to Sender and &All Recipients\tCtrl+Shift+R", - ID_MESSAGE_REPLYALL - MENUITEM "to &Group", ID_MESSAGE_POSTREPLY + ID_MESSAGE_REPLYALL + MENUITEM "to &Group", ID_MESSAGE_POSTREPLY MENUITEM "to Sender and Gro&up", - ID_MESSAGE_POSTANDREPLY + ID_MESSAGE_POSTANDREPLY END - MENUITEM "Forwar&d\tCtrl+L", ID_MESSAGE_FORWARD - MENUITEM "Forward &Quoted\tCtrl+Shift+L", ID_MESSAGE_FORWARDQUOTED - MENUITEM SEPARATOR - POPUP "&Add to Address Book" + MENUITEM "&Forward as attachment\tCtrl+L", ID_MESSAGE_FORWARD + MENUITEM "Forward &Quoted\tCtrl+Shift+L", ID_MESSAGE_FORWARDQUOTED + MENUITEM "Forward In&line", ID_MESSAGE_FORWARDINLINE + MENUITEM "&Edit to Resend", ID_FILE_EDITMESSAGE + MENUITEM SEPARATOR + POPUP "Move Message" BEGIN - MENUITEM "&Sender", ID_MESSAGE_ADDSENDER - MENUITEM "&All", ID_MESSAGE_ADDALL - END - POPUP "Fi&le Message" - BEGIN - MENUITEM "&Replace Me", FIRST_MOVE_MENU_ID + MENUITEM "&Replace Me", FIRST_MOVE_MENU_ID END POPUP "&Copy Message" BEGIN - MENUITEM "&Replace Me", FIRST_MOVE_MENU_ID + MENUITEM "&Replace Me", FIRST_MOVE_MENU_ID END MENUITEM SEPARATOR + MENUITEM "&Add Sender to Address Book", ID_MESSAGE_ADDSENDER + MENUITEM "Add All to Address Book", ID_MESSAGE_ADDALL + MENUITEM SEPARATOR POPUP "&Mark" BEGIN MENUITEM "as &Unread\tU", ID_MESSAGE_MARKASUNREAD @@ -2159,9 +2296,10 @@ BEGIN MENUITEM "&All Read\tShift+C", ID_MESSAGE_MARKALLREAD MENUITEM "by &Date...\tC", ID_MESSAGE_CATCHUP MENUITEM "for &Later\tL", ID_MESSAGE_MARKASLATER + MENUITEM SEPARATOR + MENUITEM "&Flag", ID_MESSAGE_MARK + MENUITEM "&Unflag", ID_MESSAGE_UNMARK END - MENUITEM "&Flag", ID_MESSAGE_MARK - MENUITEM "&Unflag", ID_MESSAGE_UNMARK MENUITEM SEPARATOR MENUITEM "Ignor&e Thread\tK", ID_MESSAGE_KILL MENUITEM "&Watch Thread\tW", ID_MESSAGE_WATCH @@ -2169,8 +2307,7 @@ BEGIN POPUP "&Communicator" BEGIN MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB - MENUITEM "&Messenger Mailbox\tCtrl+2", ID_TOOLS_INBOX - MENUITEM "Collabra &Discussion Groups\tCtrl+3", ID_TOOLS_NEWS + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR MENUITEM "&Conference\tCtrl+5", ID_WINDOW_LIVECALL MENUITEM SEPARATOR @@ -2198,6 +2335,13 @@ BEGIN MENUITEM "&History\tCtrl+H", ID_GO_HISTORY MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS + POPUP "Server Tools" + BEGIN + MENUITEM "Ma&nage Mail Account", ID_EDIT_MANAGEMAILACCOUNT + MENUITEM "Manage Newsgr&oup", ID_NEWS_MODERATE + END + MENUITEM SEPARATOR MENUITEM "Replace Me!", ID_WINDOW_WINDOW_0 END @@ -2456,8 +2600,7 @@ BEGIN POPUP "&Communicator" BEGIN MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB - MENUITEM "&Messenger Mailbox\tCtrl+2", ID_TOOLS_INBOX - MENUITEM "Collabra &Discussion Groups\tCtrl+3", ID_TOOLS_NEWS + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR MENUITEM "&Conference\tCtrl+5", ID_WINDOW_LIVECALL MENUITEM SEPARATOR @@ -2485,6 +2628,12 @@ BEGIN MENUITEM "&History\tCtrl+H", ID_GO_HISTORY MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS + POPUP "Server Tools" + BEGIN + MENUITEM "Ma&nage Mail Account", ID_EDIT_MANAGEMAILACCOUNT + MENUITEM "Manage Newsgroups", ID_EDIT_SERVER + END MENUITEM SEPARATOR MENUITEM "Replace Me!", ID_WINDOW_WINDOW_0 END @@ -2505,33 +2654,38 @@ IDM_MAILTHREADFILEMENU MENU DISCARDABLE MENUITEM "Page From &Template", ID_EDT_NEW_DOC_FROM_TEMPLATE MENUITEM "Page From &Wizard...", ID_COMMAND_PAGE_FROM_WIZARD - + MENUITEM SEPARATOR + MENUITEM "Ne&w Folder...", ID_FILE_NEWFOLDER END - MENUITEM "Ne&w Folder...", ID_FILE_NEWFOLDER - MENUITEM "&Open Message", ID_FILE_OPENMESSAGE POPUP "Open &Attachments" BEGIN MENUITEM "&Replace Me", FIRST_ATTACH_MENU_ID END - MENUITEM SEPARATOR - MENUITEM "&Save As...\tCtrl+S", ID_FILE_SAVEMESSAGES - MENUITEM "&Edit Message", ID_FILE_EDITMESSAGE - MENUITEM SEPARATOR - MENUITEM "&Rename Folder...", ID_FOLDER_RENAME + POPUP "&Save As" + BEGIN + MENUITEM "&File...\tCtrl+S", ID_FILE_SAVEMESSAGES + END + MENUITEM SEPARATOR + MENUITEM "Get New Messages" ID_FILE_GETNEWMAIL + MENUITEM "Get Ne&xt ###", ID_FILE_GETNEXT + MENUITEM "Send Unsent &Messages", ID_FILE_DELIVERMAILNOW + MENUITEM "Su&bscribe...", ID_FILE_SUBSCRIBE + MENUITEM SEPARATOR + MENUITEM "&Rename Folder...", ID_FOLDER_RENAME MENUITEM "Empt&y Trash Folder", ID_FILE_EMPTYTRASHFOLDER - MENUITEM "Compress Fol&ders", ID_FILE_COMPRESSALLFOLDERS + MENUITEM "Compact Fol&ders", ID_FILE_COMPRESSALLFOLDERS +// MENUITEM "&Open Message", ID_FILE_OPENMESSAGE MENUITEM SEPARATOR - POPUP "Ge&t Messages" + MENUITEM "Import..." ID_FILE_IMPORT_MAIL + MENUITEM SEPARATOR + POPUP "Synchronize" BEGIN - MENUITEM "&New\tCtrl+T", ID_FILE_GETNEWMAIL - MENUITEM "Ne&xt ###", ID_FILE_GETNEXT + MENUITEM "Synchronize Now..." ID_SYNCHRONIZE MENUITEM SEPARATOR - MENUITEM "Se&lected For Offline Reading", - ID_MESSAGE_RETRIEVESELECTED - - MENUITEM "&Flagged For Offline Reading", + MENUITEM "Download Flagged Messages", ID_MESSAGE_RETRIEVEOFFLINE - + MENUITEM "Download Selected Messages", + ID_MESSAGE_RETRIEVESELECTED END MENUITEM "Send Unsent &Messages", ID_FILE_DELIVERMAILNOW MENUITEM "Su&bscribe to Discussion Groups...", ID_FILE_SUBSCRIBE @@ -2554,25 +2708,22 @@ BEGIN MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE - MENUITEM "&Delete Message\tDel", ID_EDIT_DELETEMESSAGE - POPUP "Select Mess&age" + MENUITEM "&Delete Message\tDel", ID_EDIT_DELETE_3PANE + POPUP "Selec&t" BEGIN - MENUITEM "&Thread\tCtrl+Shift+A", ID_EDIT_SELECTTHREAD - MENUITEM "&Flagged", ID_EDIT_SELECTMARKEDMESSAGES - MENUITEM "&All\tCtrl+A", ID_EDIT_SELECTALL + MENUITEM "&Thread\tCtrl+Shift+A", ID_EDIT_SELECTTHREAD + MENUITEM "&Flagged Messages", ID_EDIT_SELECTMARKEDMESSAGES END MENUITEM SEPARATOR - MENUITEM "&Find in Message...\tCtrl+F", ID_EDIT_FINDINCURRENT + MENUITEM "&Find\tCtrl+F", ID_EDIT_FINDINCURRENT MENUITEM "Find A&gain\tCtrl+G", ID_EDIT_FINDAGAIN - MENUITEM "Search &Messages", ID_EDIT_SEARCH - MENUITEM "Search Director&y", ID_EDIT_LDAPSEARCH + MENUITEM SEPARATOR + MENUITEM "&Search Messages", ID_EDIT_SEARCH MENUITEM SEPARATOR - MENUITEM "Ma&nage Mail Account", ID_EDIT_MANAGEMAILACCOUNT - MENUITEM "Manage Discussion Gr&oup", ID_EDIT_SERVER - MENUITEM SEPARATOR - MENUITEM "Mai&l Filters...", ID_EDIT_FILTER - MENUITEM "Propertie&s", ID_VIEW_PROPERTIES + MENUITEM "Message F&ilters...", ID_EDIT_FILTER + MENUITEM "Pr&operties", ID_VIEW_PROPERTIES + MENUITEM SEPARATOR MENUITEM "Pr&eferences...", ID_OPTIONS_MAILANDNEWS END @@ -2582,6 +2733,7 @@ BEGIN MENUITEM "&Location Toolbar", ID_VIEW_LOCATIONTOOLBAR MENUITEM "&Categories", ID_VIEW_CATEGORIES MENUITEM "Messa&ge", ID_VIEW_MESSAGE + MENUITEM "&Folders", ID_VIEW_FOLDER MENUITEM SEPARATOR POPUP "S&ort" BEGIN @@ -2594,18 +2746,19 @@ BEGIN MENUITEM "by &Subject", ID_SORT_BYSUBJECT MENUITEM "by &Thread", ID_SORT_BYTHREAD MENUITEM "by U&nread", ID_SORT_BYUNREAD + MENUITEM "by &Order received", ID_SORT_BYMESSAGENUMBER MENUITEM SEPARATOR MENUITEM "&Ascending", ID_SORT_ASCENDING MENUITEM "&Descending", ID_SORT_DESCENDING END POPUP "&Messages" BEGIN - MENUITEM "&New", ID_VIEW_NEWONLY - MENUITEM "&Threads with New", ID_VIEW_NEWTHREADS - MENUITEM "&Watched Threads with New", ID_VIEW_WATCHEDTHREADS - MENUITEM "&All", ID_VIEW_ALLTHREADS + MENUITEM "&All", ID_VIEW_ALLTHREADS + MENUITEM "&Unread", ID_VIEW_NEWONLY + MENUITEM "&Threads with Unread", ID_VIEW_NEWTHREADS + MENUITEM "&Watched Threads with Unread", ID_VIEW_WATCHEDTHREADS MENUITEM SEPARATOR - MENUITEM "&Ignored", ID_VIEW_KILLEDTHREADS + MENUITEM "&Ignored Threads", ID_VIEW_KILLEDTHREADS END POPUP "Hea&ders" BEGIN @@ -2613,14 +2766,14 @@ BEGIN MENUITEM "&Normal", ID_VIEW_HEADERS_SHORT MENUITEM "&Brief", ID_VIEW_HEADERS_MICRO END - POPUP "&Attachments" - BEGIN - MENUITEM "&Inline", ID_VIEW_ATTACHINLINE - MENUITEM "As &Links", ID_VIEW_ATTACHLINKS - END + MENUITEM SEPARATOR + MENUITEM "View &Attachments Inline", ID_VIEW_ATTACHINLINE + MENUITEM "View Attachments As &Links", ID_VIEW_ATTACHLINKS + MENUITEM SEPARATOR + MENUITEM "Wra&p Long Lines", ID_MAIL_WRAPLONGLINES MENUITEM SEPARATOR MENUITEM "Increase &Font\tCtrl+]", ID_VIEW_INCREASEFONT - MENUITEM "Decrease Fon&t\tCtrl+[", ID_VIEW_DECREASEFONT + MENUITEM "Decrease Fo&nt\tCtrl+[", ID_VIEW_DECREASEFONT MENUITEM SEPARATOR MENUITEM "&Reload", ID_NAVIGATE_RELOAD MENUITEM "Sho&w Images", ID_VIEW_LOADIMAGES @@ -2674,23 +2827,29 @@ END IDM_MAILTHREADGOMENU MENU DISCARDABLE BEGIN - MENUITEM "&Next Message\tShift+N", ID_MESSAGE_NEXT - MENUITEM "Next &Unread Message\tN", ID_MESSAGE_NEXTUNREAD - MENUITEM "Next F&lagged Message", ID_MESSAGE_NEXTFLAGGED - MENUITEM "Next Unread &Thread\tT", ID_MESSAGE_NEXTUNREADTHREAD - - MENUITEM "Ne&xt Folder", ID_MESSAGE_NEXTNEWSGROUP - MENUITEM "Next Unrea&d Folder\tG", ID_MESSAGE_NEXTUNREADNEWSGROUP - - MENUITEM SEPARATOR - MENUITEM "&Previous Message\tShift+P", ID_MESSAGE_PREVIOUS - MENUITEM "Previou&s Unread Message\tP", ID_MESSAGE_PREVIOUSUNREAD - MENUITEM "Previous Fla&gged Message", ID_MESSAGE_PREVIOUSFLAGGED - MENUITEM SEPARATOR + MENUITEM "First Unread Message" ID_MESSAGE_FIRSTUNREAD MENUITEM "&First Flagged Message", ID_MESSAGE_FIRSTFLAGGED + MENUITEM SEPARATOR + POPUP "Next" + BEGIN + MENUITEM "Message\tShift+N", ID_MESSAGE_NEXT + MENUITEM "&Unread Message\tN", ID_MESSAGE_NEXTUNREAD + MENUITEM "F&lagged Message", ID_MESSAGE_NEXTFLAGGED + MENUITEM SEPARATOR + MENUITEM "Unread &Thread\tT", ID_MESSAGE_NEXTUNREADTHREAD + MENUITEM SEPARATOR + MENUITEM "Folder", ID_MESSAGE_NEXTNEWSGROUP + MENUITEM "Unrea&d Folder\tG", ID_MESSAGE_NEXTUNREADNEWSGROUP + END + POPUP "Previous" + BEGIN + MENUITEM "&Message\tShift+P", ID_MESSAGE_PREVIOUS + MENUITEM "&Unread Message\tP", ID_MESSAGE_PREVIOUSUNREAD + MENUITEM "Fla&gged Message", ID_MESSAGE_PREVIOUSFLAGGED + END MENUITEM SEPARATOR MENUITEM "&Back\tAlt+<-", ID_NAVIGATE_MSG_BACK - MENUITEM "For&ward\tAlt+->", ID_NAVIGATE_MSG_FORWARD*/ + MENUITEM "For&ward\tAlt+->", ID_NAVIGATE_MSG_FORWARD END IDM_MAILTHREADMESSAGEMENU MENU DISCARDABLE @@ -2698,21 +2857,18 @@ IDM_MAILTHREADMESSAGEMENU MENU DISCARDABLE MENUITEM "&New Message\tCtrl+M", ID_FILE_NEWMESSAGE POPUP "&Reply" BEGIN - MENUITEM "to &Sender\tCtrl+R", ID_MESSAGE_REPLY + MENUITEM "to &Sender Only\tCtrl+R", ID_MESSAGE_REPLY MENUITEM "to Sender and &All Recipients\tCtrl+Shift+R", ID_MESSAGE_REPLYALL - MENUITEM "to &Group", ID_MESSAGE_POSTREPLY + MENUITEM "to &Group", ID_MESSAGE_POSTREPLY MENUITEM "to Sender and Gro&up", ID_MESSAGE_POSTANDREPLY END - MENUITEM "Forwar&d\tCtrl+L", ID_MESSAGE_FORWARD - MENUITEM "Forward &Quoted\tCtrl+Shift+L", ID_MESSAGE_FORWARDQUOTED - MENUITEM SEPARATOR - POPUP "&Add to Address Book" - BEGIN - MENUITEM "&Sender", ID_MESSAGE_ADDSENDER - MENUITEM "&All", ID_MESSAGE_ADDALL - END + MENUITEM "&Forward as attachment\tCtrl+L", ID_MESSAGE_FORWARD + MENUITEM "Forward &Quoted\tCtrl+Shift+L", ID_MESSAGE_FORWARDQUOTED + MENUITEM "Forward In&line", ID_MESSAGE_FORWARDINLINE + MENUITEM "&Edit to Resend", ID_FILE_EDITMESSAGE + MENUITEM SEPARATOR POPUP "Fi&le Message" BEGIN MENUITEM "&Replace Me", FIRST_MOVE_MENU_ID @@ -2721,19 +2877,22 @@ IDM_MAILTHREADMESSAGEMENU MENU DISCARDABLE BEGIN MENUITEM "&Replace Me", FIRST_MOVE_MENU_ID END + MENUITEM SEPARATOR + MENUITEM "&Add Sender to Address Book", ID_MESSAGE_ADDSENDER + MENUITEM "Add All to Address Book", ID_MESSAGE_ADDALL MENUITEM SEPARATOR POPUP "&Mark" BEGIN MENUITEM "as &Unread\tU", ID_MESSAGE_MARKASUNREAD MENUITEM "as &Read\tM", ID_MESSAGE_MARKASREAD MENUITEM "&Thread Read", ID_MESSAGE_MARKTHREADREAD - - MENUITEM "&All Read\tShift+C", ID_MESSAGE_MARKALLREAD MENUITEM "by &Date...\tC", ID_MESSAGE_CATCHUP - MENUITEM "for &Later\tL", ID_MESSAGE_MARKASLATER - END - MENUITEM "&Flag", ID_MESSAGE_MARK - MENUITEM "&Unflag", ID_MESSAGE_UNMARK + MENUITEM "&All Read\tShift+C", ID_MESSAGE_MARKALLREAD + //MENUITEM "for &Later\tL", ID_MESSAGE_MARKASLATER + MENUITEM SEPARATOR + MENUITEM "&Flag", ID_MESSAGE_MARK + MENUITEM "&Unflag", ID_MESSAGE_UNMARK + END MENUITEM SEPARATOR MENUITEM "Ignor&e Thread\tK", ID_MESSAGE_KILL MENUITEM "&Watch Thread\tW", ID_MESSAGE_WATCH @@ -2762,29 +2921,30 @@ BEGIN MENUITEM "Page From &Template", ID_EDT_NEW_DOC_FROM_TEMPLATE MENUITEM "Page From &Wizard...", ID_COMMAND_PAGE_FROM_WIZARD - END MENUITEM SEPARATOR - MENUITEM "&Save Draft\tCtrl+S", IDM_SAVEASDRAFT - MENUITEM "Save Template\tCtrl+T", IDM_SAVEASTEMPLATE - MENUITEM "Save &As ...", IDM_SAVEAS - MENUITEM SEPARATOR - MENUITEM "Sen&d Now\tCtrl+Enter", IDM_SENDNOW - MENUITEM "Send &Later", IDM_SENDLATER - MENUITEM "&Quote Original Text", IDM_QUOTEORIGINAL - MENUITEM "Selec&t Addresses...", IDM_ADDRESSPICKER + POPUP "Save &As" + BEGIN + MENUITEM "&File...", IDM_SAVEAS + MENUITEM SEPARATOR + MENUITEM "&Draft\tCtrl+S", IDM_SAVEASDRAFT + MENUITEM "&Template\tCtrl+T", IDM_SAVEASTEMPLATE + END POPUP "A&ttach" BEGIN MENUITEM "&File...", IDM_ATTACHFILE MENUITEM "&Web Page...", IDM_ATTACHWEBPAGE - MENUITEM "&Address Book Card...", IDM_ATTACHVCARD MENUITEM SEPARATOR MENUITEM "&My Address Book Card", IDM_ATTACHMYCARD END MENUITEM SEPARATOR - MENUITEM "Go Offl&ine...", ID_BIG_SWITCH + MENUITEM "Sen&d Now\tCtrl+Enter", IDM_SENDNOW + MENUITEM "Send &Later", IDM_SENDLATER + MENUITEM "&Quote Original Text", IDM_QUOTEORIGINAL + MENUITEM "Selec&t Addresses...", IDM_ADDRESSPICKER MENUITEM SEPARATOR MENUITEM "&Close\tCtrl+W", ID_FILE_CLOSE + MENUITEM "E&xit\tCtrl+Q", ID_APP_EXIT END POPUP "&Edit" BEGIN @@ -2800,7 +2960,9 @@ BEGIN MENUITEM SEPARATOR MENUITEM "&Find in Message\tCtrl+F", IDM_FINDINMESSAGE MENUITEM "Find Again\tCtrl+G", IDM_FINDAGAIN - MENUITEM "Search Director&y", IDM_SEARCHADDRESSES + MENUITEM SEPARATOR + MENUITEM "Name Completion", ID_TOGGLENAMECOMPLETION + MENUITEM "Show Name Picker\tCtrl+J" ID_SHOW_NAME_PICKER MENUITEM SEPARATOR MENUITEM "&Preferences...", ID_OPTIONS_PREFERENCES END @@ -2860,8 +3022,7 @@ BEGIN POPUP "&Communicator" BEGIN MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB - MENUITEM "&Messenger Mailbox\tCtrl+2", ID_TOOLS_INBOX - MENUITEM "Collabra &Discussion Groups\tCtrl+3", ID_TOOLS_NEWS + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR MENUITEM "&Conference\tCtrl+5", ID_WINDOW_LIVECALL MENUITEM SEPARATOR @@ -2889,6 +3050,7 @@ BEGIN MENUITEM "&History\tCtrl+H", ID_GO_HISTORY MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS MENUITEM SEPARATOR MENUITEM "Replace Me!", ID_WINDOW_WINDOW_0 END @@ -3040,6 +3202,33 @@ BEGIN LTEXT "Click Finish to continue.",IDC_STATIC,1,135,203,8 END +#ifdef MOZ_MAIL_NEWS +#define MOZ_NEWADDR 1 +#ifdef MOZ_NEWADDR +IDD_ADDRESSBOOK DIALOG DISCARDABLE 0, 0, 332, 34 +STYLE WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Search for names in:",IDC_STATIC,0,5,66,8 + PUSHBUTTON "Search...",IDC_DIRSEARCH,0,16,50,13 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDVERT,54,16,1,12 + EDITTEXT IDC_ADDRNAME,60,16,267,13,ES_AUTOHSCROLL + LTEXT "a directory name",IDC_STATIC1,69,5,195,8 +END +#else +IDD_ADDRESSBOOK DIALOG DISCARDABLE 0, 0, 332, 34 +STYLE WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Select a directory and type in the name you are looking for:", + IDC_STATIC,0,5,203,8 + COMBOBOX IDC_DIRECTORIES,0,0,0,0,CBS_DROPDOWNLIST | + WS_VSCROLL + EDITTEXT IDC_ADDRNAME,0,16,267,13,ES_AUTOHSCROLL + PUSHBUTTON "Search...",IDC_DIRSEARCH,277,16,50,13 +END +#endif +#endif //MOZ_MAIL_NEWS IDD_LOGIN_DIALOG DIALOG DISCARDABLE 0, 0, 244, 274 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU @@ -3171,8 +3360,7 @@ BEGIN BEGIN MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB #ifdef MOZ_MAIL_NEWS - MENUITEM "&Messenger Mailbox\tCtrl+2", ID_TOOLS_INBOX - MENUITEM "&Collabra Discussions\tCtrl+3", ID_TOOLS_NEWS + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX #endif /* MOZ_MAIL_NEWS */ #ifdef EDITOR MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR @@ -3209,6 +3397,9 @@ BEGIN MENUITEM "&History\tCtrl+H", ID_GO_HISTORY MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY +#ifdef MOZ_MAIL_NEWS + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS +#endif //MOZ_MAIL_NEWS MENUITEM SEPARATOR MENUITEM "Replace Me!", ID_WINDOW_WINDOW_0 END @@ -3295,8 +3486,7 @@ BEGIN BEGIN MENUITEM "&Navigator\tCtrl+1", ID_TOOLS_WEB #ifdef MOZ_MAIL_NEWS - MENUITEM "&Messenger Mailbox\tCtrl+2", ID_TOOLS_INBOX - MENUITEM "Collabra &Discussion Groups\tCtrl+3", ID_TOOLS_NEWS + MENUITEM "&Messenger\tCtrl+2", ID_TOOLS_INBOX #endif // MOZ_MAIL_NEWS #ifdef EDITOR MENUITEM "&Page Composer\tCtrl+4", ID_TOOLS_EDITOR @@ -3333,6 +3523,9 @@ BEGIN MENUITEM "&History\tCtrl+H", ID_GO_HISTORY MENUITEM "&Java Console", ID_OPTIONS_SHOWJAVACONSOLE MENUITEM "&Security Info\tCtrl+Shift+I", ID_SECURITY +#ifdef MOZ_MAIL_NEWS + MENUITEM "Migration Tools", ID_MIGRATION_TOOLS +#endif MENUITEM SEPARATOR MENUITEM "Replace Me!", ID_WINDOW_WINDOW_0 END diff --git a/mozilla/cmd/winfe/resource.h b/mozilla/cmd/winfe/resource.h index 587afcbf23a..649f8f3dd4f 100755 --- a/mozilla/cmd/winfe/resource.h +++ b/mozilla/cmd/winfe/resource.h @@ -1323,14 +1323,11 @@ #define IDB_ADDRESSBOOKSELECT 1425 #define IDC_STATIC_STYLE 1425 #define IDC_CUSTPREVIEW 1425 -#define IDC_COOKIES 1425 #define IDC_STATIC_SIZE 1426 #define IDC_INSERT 1426 #define IDC_HANDOPEN 1426 -#define IDC_ADDBOOK 1426 #define IDB_LARGE_HTAB 1427 #define IDC_HANDCLOSED 1427 -#define IDC_FILTERS 1427 #define IDB_LARGE_HFTAB 1428 #define IDC_MOVEBUTTON 1428 #define IDB_SMALL_HTAB 1429 @@ -1518,25 +1515,18 @@ #define IDS_INSUFFICIENT_DISKSPACE_MOVE 1498 #define IDC_DIALER_TEXT 1498 #define IDS_INSUFFICIENT_DISKSPACE_COPY 1499 -#define IDC_LOGINNAME 1499 #define IDD_SPELLING_LANGUAGE 1500 #define IDC_ADVANCED_SEARCH 1500 -#define IDC_PASSWORD 1500 #define IDS_PROFDIR_EXISTS 1501 -#define IDC_LDAP_SEARCHBASE 1501 #define IDS_PROFILE_SELECTOR_TITLE 1502 -#define IDC_LDAP_ADDRESS 1502 #define IDS_PE_INTROPAGE_TEXT 1503 #define IDC_COMBO_AND_OR 1503 -#define IDC_LDAP_SERVER 1503 #define IDD_PP_NEWS_GENERAL 1504 #define IDB_SAENCRYPTEDBAD 1504 #define IDS_PEMUC_NEWSPAGE 1504 -#define IDC_HTTP_SERVER 1504 #define IDD_PP_NEWSHOST_GENERAL 1505 #define IDB_SAENCRYPTED 1505 #define IDC_CHECK_SUBFOLDERS 1505 -#define IDC_HTTP_ADDRESS 1505 #define IDB_SAUNENCRYPTED 1506 #define IDC_RADIO_SERVER 1506 #define IDB_SASIGNED 1507 @@ -1618,7 +1608,6 @@ #define IDD_MAILSERVER_GENERAL 1559 #define IDB_NAV_BAR1 1560 #define IDD_MAILSERVER_POP 1560 -#define IDC_STATIC_TYPE 1560 #define IDD_MAILSERVER_IMAP 1561 #define IDC_RADIO_POP3 1561 #define IDD_MAILSERVER_ADVANCED 1562 @@ -1668,6 +1657,50 @@ #define IDS_COPY_STYLE 1685 #define ID_COPY_STYLE 1686 #define IDD_EDIT_HEADER 1700 +#define IDB_OFFLINE_STATUS 1720 +#define IDD_DOWNLOAD_CONTROL_PANEL 1735 +#define IDD_SYNCHRONIZE_ONOFF 1736 +#define IDD_SYNCHRONIZE_EXIT 1737 +#define IDD_PP_SHARING 1738 +#define IDD_OFFLINE_PICKER 1739 +#define IDD_COMPLETION_PICKER 1740 +#define IDC_DWNLD_HELP_GO_OFFLINE 1750 +#define IDC_DWNLD_CHECK_GO_OFFLINE 1751 +#define IDC_DWNLD_CHECK_MAIL 1752 +#define IDC_DWNLD_CHECK_DISCUSSIONS 1753 +#define IDC_DWNLD_CHECK_DIRECTORIES 1754 +#define IDC_DWNLD_BUTTON_SELECT 1755 +#define IDC_DWNLD_STATIC_MGD 1756 +#define IDC_DWNLD_CHECK_SENDMAIL 1757 +#define IDC_DOWNLOADFLAGGED 1758 +#define IDC_HELP_DOWNLOAD 1759 +#define IDC_STATIC_SYNC_QUESTION 1760 +#define IDC_BUTTON_NO 1761 +#define IDC_STATUSSEPARATOR 1762 +#define IDC_REPLACE_HEADER 1763 +#define IDC_DISPLAYNAME 1764 +#define IDC_DEPARTMENT 1765 +#define IDC_FILTERSFORSTATIC 1766 +#define IDC_ADVANCED_OPTIONS 1767 +#define IDC_RADIO_MOVE_TO_TRASH 1768 +#define IDC_RADIO_REAL_DELETE 1769 +#define IDC_SET_DEFAULT 1770 +#define IDC_CHECK_EMPTY_TRASH 1771 +#define IDC_CHECK_EMPTY_INBOX 1772 +#define IDC_RADIO_IMAP_DELETE 1773 +#define IDC_CELLULAR 1774 +#define IDC_PAGER 1775 +#define IDC_BUTTON_SERVER_FILTERS 1776 +#define IDC_COMBO_SERVER_SCOPE 1777 +#define IDC_BUTTON_DELETE_MESSAGE 1778 +#define IDC_RADIO_ANY 1779 +#define IDC_STATIC_TYPE 1780 +#define IDC_RADIO_ALL 1781 +#define IDC_STATIC_ACLRIGHTS 1782 +#define IDC_PRIVILEGES 1783 +#define IDC_EDIT_NEW_HEADER 1784 +#define IDC_CHECK_SEARCH_LOCALLY 1785 +#define IDC_SEARCH 1786 #define IDC_SHORTCUT_BASE 1800 #define IDC_EMAIL_ADDR 1996 #define IDC_PROFILE_NAME 1997 @@ -1978,10 +2011,26 @@ #define IDC_COMBO_AND_OR3 2301 #define IDC_COMBO_AND_OR4 2302 #define IDC_COMBO_AND_OR5 2303 +#define IDD_UNAME_EMAIL_CONFIRM 2304 +#define IDD_NETINST_MULTIINST_WARN 2305 +#define IDD_UNAME_EMAIL_NO_WIZARD 2306 #define IDC_PROFILENAME_TEXT 2400 -#define IDC_HEADER_HELP 2500 #define IDC_PASTE_TEXT 2401 #define IDC_PASTE_IMAGE 2402 +#define IDC_HEADER_HELP 2500 +#define IDC_OFFLINE_SELECT_HELP 2655 +#define IDC_TEMP_OUTLINER_BOX 2656 +#define IDC_LDAP_SERVER 2659 +#define IDC_HTTP_SERVER 2660 +#define IDC_LDAP_ADDRESS 2661 +#define IDC_LDAP_SEARCHBASE 2662 +#define IDC_HTTP_ADDRESS 2663 +#define IDC_COOKIES 2665 +#define IDC_FILTERS 2666 +#define IDC_ADDBOOK 2667 +#define IDC_LOGINNAME 2668 +#define IDC_PASSWORD 2669 +/*Mail and News has reserved resource ID's 10,0000 to 15,000. */ #define FIRST_HISTORY_MENU_ID 16384 #define LAST_HISTORY_MENU_ID 16600 #define FIRST_HT_MENU_ID 16601 @@ -2001,6 +2050,7 @@ #define FIRST_ATTACHPROP_MENU_ID 22912 #define LAST_ATTACHPROP_MENU_ID 22975 #define FIRST_ADDSENDER_MENU_ID 22976 +#define IDD_UPGRADE_SUBSCRIBE 22977 #define LAST_ADDSENDER_MENU_ID 24000 #define FIRST_ADDALL_MENU_ID 24001 #define LAST_ADDALL_MENU_ID 25025 @@ -2119,7 +2169,6 @@ #define ID_DOCUMENT_BOTTOM 32876 #define IDD_JAVACONSOLE 32877 #define ID_OPTIONS_SHOWJAVACONSOLE 32878 -#define IDD_COMPLETION_PICKER 32878 #define ID_FILE_MAILNEW 32879 #define ID_EDIT_FINDAGAIN 32880 #define ID_NAVIGATE_RELOADCELL 32881 @@ -2976,6 +3025,31 @@ #define ID_POPUP_SETTOTOOLBAR 42546 #define ID_DONEGETTINGMAIL 42547 #define ID_DONEGOINGOFFLINE 42548 +#define ID_SHOW_NAME_PICKER 42550 +#define ID_TOGGLENAMECOMPLETION 42551 +#define ID_SYNCHRONIZE 42552 +#define ID_SORT_COL0 42553 +#define ID_SORT_COL1 42554 +#define ID_SORT_COL2 42555 +#define ID_SORT_COL3 42556 +#define ID_SORT_COL4 42557 +#define ID_SORT_COL5 42558 +#define ID_SORT_COL6 42559 +#define ID_MESSAGE_FORWARDBUTTON 42560 +#define ID_MESSAGE_FORWARDINLINE 42561 +#define ID_FILE_IMPORT_MAIL 42562 +#define ID_VIEW_DIRPANE 42563 +#define ID_VIEW_COMPONENTBAR 42564 +#define ID_VIEW_COL0 42565 +#define ID_EDIT_DELETEALL 42566 +#define ID_VIEW_COL1 42567 +#define ID_VIEW_COL2 42568 +#define ID_VIEW_COL3 42569 +#define ID_VIEW_COL4 42570 +#define ID_VIEW_COL5 42571 +#define ID_VIEW_COL6 42572 +#define ID_DIRSEARCH 42573 +#define ID_EDIT_DELETE_3PANE 42574 #define IDS_CONVERT_TEXT_TO_TABLE 42700 #define IDS_CONVERT_TABLE_TO_TEXT 42701 #define IDS_ALIGN 42702 @@ -3853,6 +3927,42 @@ #define IDS_NOATTACHMENTS 62655 #define IDS_MENU_COMPRESSFOLDERS 62656 #define IDS_MENU_COMPRESSFOLDER 62657 +#define IDS_SEARCHRESULTS 62658 +#define IDS_GETINFO 62659 +#define IDS_DOWNLOAD 62660 +#define IDS_DOWNLOAD_LIST 62661 +#define IDS_ADDSENDER 62662 +#define IDS_ADDALL 62663 +#define IDS_CONFERENCE_MENU 62664 +#define IDS_WINDOW_MENU 62665 +#define IDS_NAMECOMPLETIONON 62666 +#define IDS_NAMECOMPLETIONOFF 62667 +#define ID_MIGRATION_TOOLS 62668 +#define IDS_SENDONLINE 62669 +#define IDS_GOONLINE 62670 +#define IDS_ADVSEARCH_PROPERTY_SHEET 62671 +#define IDS_ADVFILTER_PROPERTY_SHEET 62672 +#define IDS_ITEMSMATCHING 62673 +#define IDS_MULTIPLE_MATCHES 62674 +#define IDS_MENU_FORWARDINLINE 62675 +#define IDS_ONLINE_STATUS 62676 +#define IDS_DELETEMESSAGE_STATUS 62677 +#define IDS_DELETEFOLDER_STATUS 62678 +#define IDS_DELETEMESSAGE_TOOLTIP 62679 +#define IDS_DELETEFOLDER_TOOLTIP 62680 +#define IDS_NEWDIRECTORY 62681 +#define IDS_STATBAR_ONLINE 62682 +#define IDS_CREATING_FOLDER 62683 +#define IDS_DEFAULT_STRING 62684 +#define IDS_COPY_NEWS_MSG 62685 +#define IDS_COPY_DRAFTS 62686 +#define IDS_COPY_TEMPLATES 62687 +#define IDS_NO_ACLSHARING 62689 +#define IDS_SYNCHRONIZING 62690 +#define IDS_NEWADDRESSBOOK 62691 +#define IDS_DELETEFROMALL 62692 +#define IDS_POPUP_PROPERTIES 62693 +#define ID_MESSAGE_FIRSTUNREAD 62694 #define IDC_FIRST_PLACES_MENU_ID 65000 #define ID_COMMAND_PAGE_FROM_WIZARD 65197 #define ID_COMMAND_HELPINDEX 65198 diff --git a/mozilla/cmd/winfe/setupwiz.cpp b/mozilla/cmd/winfe/setupwiz.cpp index 6b9af9926c1..ca36fbce634 100644 --- a/mozilla/cmd/winfe/setupwiz.cpp +++ b/mozilla/cmd/winfe/setupwiz.cpp @@ -730,6 +730,34 @@ void CNewProfileWizard::InitPrefStrings() PREF_GetIntPref("mail.server_type", &prefInt); m_bUseIMAP = prefInt == MSG_Imap4; +#ifdef MOZ_MAIL_NEWS + if (m_bUseIMAP) + { + char serverName[128]; + GetImapServerName(serverName); + m_szPopName = serverName; + if (strlen(serverName) > 0) + { + char userName[128]; + GetImapUserName(serverName, userName); + if (strlen(userName) > 0) + m_szInMailServer = userName; + } + } + else + { //POP server + pPrefStr = NULL; + PREF_CopyCharPref("mail.pop_name", &pPrefStr); + m_szPopName = pPrefStr; + if (pPrefStr) XP_FREE(pPrefStr); + + pPrefStr = NULL; + PREF_CopyCharPref("network.hosts.pop_server", &pPrefStr); + m_szInMailServer = pPrefStr; + if (pPrefStr) XP_FREE(pPrefStr); + } +#endif /* MOZ_MAIL_NEWS */ + prefStr = NULL; PREF_CopyCharPref("network.hosts.nntp_server", &prefStr); if (prefStr) @@ -1554,17 +1582,17 @@ BOOL CNewProfileWizard::DoFinish() PREF_SetCharPref("mail.identity.useremail", m_szEmail); PREF_SetCharPref("network.hosts.smtp_server", m_szMailServer); - PREF_SetCharPref("network.hosts.pop_server", m_szInMailServer); - - PREF_SetCharPref("mail.pop_name", m_szPopName); - if (m_bUseIMAP) { PREF_SetBoolPref("mail.leave_on_server", m_bUseIMAP); + SetImapServerName(LPCTSTR(m_szInMailServer)); + IMAP_SetCharPref(LPCTSTR(m_szInMailServer), CHAR_USERNAME, LPCTSTR(m_szPopName)); } else { PREF_SetBoolPref("mail.leave_on_server", m_bLeftOnServer); + PREF_SetCharPref("network.hosts.pop_server", m_szInMailServer); + PREF_SetCharPref("mail.pop_name", m_szPopName); } long imapPref = m_bUseIMAP ? MSG_Imap4 : MSG_Pop3; PREF_SetIntPref("mail.server_type", imapPref); diff --git a/mozilla/cmd/winfe/srchdlg.cpp b/mozilla/cmd/winfe/srchdlg.cpp index ca3ccdb94e4..397f86343e0 100644 --- a/mozilla/cmd/winfe/srchdlg.cpp +++ b/mozilla/cmd/winfe/srchdlg.cpp @@ -33,109 +33,234 @@ #include "dateedit.h" #include "intl_csi.h" +#define BOTTOM_BORDER 15 //////////////////////////////////////////////////////////////////////////// // CAddrEditProperities -CSearchDialog::CSearchDialog (LPCTSTR lpszCaption, MSG_Pane* pSearchPane, DIR_Server* pServer, CWnd * parent, - UINT numButtons, ButtonPosition buttonPosition, CPtrArray* buttonLabels) -#ifdef FEATURE_BUTTONPROPERTYPAGE - :CButtonPropertySheet ( lpszCaption, parent, numButtons, buttonPosition, buttonLabels ) -#endif +CSearchDialog::CSearchDialog (LPCTSTR lpszCaption, MSG_Pane* pSearchPane, DIR_Server* pServer, CWnd * parent) +:CDialog ( CSearchDialog::IDD, parent) { + m_pTitle = XP_STRDUP(lpszCaption); m_pServer = pServer; m_pSearchPane = pSearchPane; -#ifdef FEATURE_BUTTONPROPERTYPAGE - m_pBasicSearch = new CBasicSearch (this); - AddPage( m_pBasicSearch ); - m_pAdvancedSearch = new CAdvancedSearch (this); - AddPage( m_pAdvancedSearch ); -#endif + m_iMoreCount = 0; + m_bLogicType = 1; + m_bChanged = FALSE; } -CSearchDialog::CSearchDialog (UINT nIDCaption, MSG_Pane* pSearchPane, DIR_Server* pServer, CWnd * parent, - UINT numButtons, ButtonPosition buttonPosition, CUIntArray* buttonLabels) -#ifdef FEATURE_BUTTONPROPERTYPAGE - :CButtonPropertySheet ( nIDCaption, parent, numButtons, buttonPosition, buttonLabels ) -#endif +CSearchDialog::CSearchDialog (UINT nIDCaption, MSG_Pane* pSearchPane, DIR_Server* pServer, CWnd * parent) +:CDialog ( CSearchDialog::IDD, parent) { + m_pTitle = XP_STRDUP(::szLoadString(nIDCaption)); m_pServer = pServer; m_pSearchPane = pSearchPane; -#ifdef FEATURE_BUTTONPROPERTYPAGE - m_pBasicSearch = new CBasicSearch (this); - AddPage( m_pBasicSearch ); - m_pAdvancedSearch = new CAdvancedSearch (this); - AddPage( m_pAdvancedSearch ); -#endif + m_iMoreCount = 0; + m_bLogicType = 1; + m_bChanged = FALSE; + } CSearchDialog::~CSearchDialog ( ) { + if(m_pTitle) + { + XP_FREE(m_pTitle); + } } void CSearchDialog::PostNcDestroy( ) { - if ( m_pAdvancedSearch ) - delete m_pAdvancedSearch; - if ( m_pBasicSearch ) - delete m_pBasicSearch; } -void CSearchDialog::OnHelp() +void CSearchDialog::DoDataExchange(CDataExchange* pDX) { -#ifdef FEATURE_BUTTONPROPERTYPAGE - if (GetActivePage() == m_pAdvancedSearch) - NetHelp(HELP_ADD_USER_PROPS); - if (GetActivePage() == m_pBasicSearch) - NetHelp(HELP_ADD_USER_PROPS); -#endif + CDialog::DoDataExchange(pDX); + + //{{AFX_DATA_MAP(CSearchDialog) + //}}AFX_DATA_MAP } -#ifdef FEATURE_BUTTONPROPERTYPAGE -BEGIN_MESSAGE_MAP(CSearchDialog, CButtonPropertySheet) -#else -BEGIN_MESSAGE_MAP(CSearchDialog, CWnd) -#endif + +BEGIN_MESSAGE_MAP(CSearchDialog, CDialog) //{{AFX_MSG_MAP(CSearchDialog) // NOTE: the ClassWizard will add message map macros here ON_WM_CREATE() - ON_MESSAGE(LDS_GETSERVER,OnGetServer) - ON_MESSAGE(LDS_GETSEARCHPANE,OnGetSearchPane) - ON_MESSAGE(LDS_RECALC_LAYOUT,OnRecalcLayout) + ON_BN_CLICKED(IDC_MORE, OnMore) + ON_BN_CLICKED(IDC_FEWER, OnFewer) + ON_BN_CLICKED(IDC_CLEAR_SEARCH, OnClearSearch) + ON_BN_CLICKED(IDC_SEARCH, OnSearch) + ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB1, OnAttrib1) + ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB2, OnAttrib2) + ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB3, OnAttrib3) + ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB4, OnAttrib4) + ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB5, OnAttrib5) + ON_CBN_SELCHANGE(IDC_COMBO_OP1, OnOperatorValueChanged) + ON_CBN_SELCHANGE(IDC_COMBO_OP2, OnOperatorValueChanged) + ON_CBN_SELCHANGE(IDC_COMBO_OP3, OnOperatorValueChanged) + ON_CBN_SELCHANGE(IDC_COMBO_OP4, OnOperatorValueChanged) + ON_CBN_SELCHANGE(IDC_COMBO_OP5, OnOperatorValueChanged) + ON_BN_CLICKED(IDC_RADIO_ALL, OnAndOr) + ON_BN_CLICKED(IDC_RADIO_ANY, OnAndOr) + ON_EN_CHANGE( IDC_EDIT_VALUE1, OnEditValueChanged ) + ON_EN_CHANGE( IDC_EDIT_VALUE2, OnEditValueChanged ) + ON_EN_CHANGE( IDC_EDIT_VALUE3, OnEditValueChanged ) + ON_EN_CHANGE( IDC_EDIT_VALUE4, OnEditValueChanged ) +#ifdef ON_UPDATE_COMMAND_UI_RANGE + ON_UPDATE_COMMAND_UI_RANGE( IDC_COMBO_ATTRIB1, IDC_EDIT_VALUE5, OnUpdateQuery ) +#endif + //}}AFX_MSG_MAP END_MESSAGE_MAP() +#ifndef ON_UPDATE_COMMAND_UI_RANGE -LRESULT CSearchDialog::OnGetServer(WPARAM wParam, LPARAM lParam) +BOOL CAdvancedSearch::OnCmdMsg( UINT nID, int nCode, void* pExtra, + AFX_CMDHANDLERINFO* pHandlerInfo ) { - DIR_Server ** server = (DIR_Server **) lParam; - (*server) = m_pServer; - return 1; + if ((nID >= IDC_COMBO_ATTRIB1) && (nID <= IDC_EDIT_VALUE5) && + ( nCode == CN_UPDATE_COMMAND_UI) ) { + OnUpdateQuery( (CCmdUI *) pExtra ); + return TRUE; + } + return CDialog::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ); } -LRESULT CSearchDialog::OnGetSearchPane(WPARAM wParam, LPARAM lParam) -{ - MSG_Pane ** pane = (MSG_Pane **) lParam; - (*pane) = m_pSearchPane; - return 1; -} - -LRESULT CSearchDialog::OnRecalcLayout(WPARAM wParam, LPARAM lParam) -{ -#ifdef FEATURE_BUTTONPROPERTYPAGE - RecalcLayout(); #endif - return 1; + +void CSearchDialog::OnUpdateQuery( CCmdUI *pCmdUI ) +{ + pCmdUI->Enable( TRUE ); +} + +void CSearchDialog::AdjustHeight(int dy) +{ + CRect rect; + GetWindowRect(&rect); + + CSize size = rect.Size(); + size.cy += dy; + + SetWindowPos( NULL, 0, 0, size.cx, size.cy, SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW|SWP_NOMOVE); + GetWindowRect(&rect); +} + +void CSearchDialog::OnSearch() +{ + MSG_SearchFree (m_pSearchPane); + MSG_SearchAlloc (m_pSearchPane); + MSG_AddLdapScope(m_pSearchPane, m_pServer); + m_searchObj.BuildQuery(m_pSearchPane, m_iMoreCount, m_bLogicType); + + CDialog::OnOK(); +} + +void CSearchDialog::OnAndOr() +{ + m_searchObj.OnAndOr(m_iMoreCount, &m_bLogicType); + m_bChanged = TRUE; +} + +void CSearchDialog::OnMore() +{ + int dy = 0; + + dy = m_searchObj.More(&m_iMoreCount, m_bLogicType); + + if (m_iMoreCount < 4) + GetDlgItem(IDC_MORE)->EnableWindow (TRUE); + else + GetDlgItem(IDC_MORE)->EnableWindow (FALSE); + if (m_iMoreCount > 0) + GetDlgItem(IDC_FEWER)->EnableWindow (TRUE); + else + GetDlgItem(IDC_FEWER)->EnableWindow (FALSE); + + AdjustHeight (dy); + +} + +void CSearchDialog::OnFewer() +{ + int dy = 0; + + dy = m_searchObj.Fewer(&m_iMoreCount, m_bLogicType); + + if (m_iMoreCount < 4) + GetDlgItem(IDC_MORE)->EnableWindow (TRUE); + else + GetDlgItem(IDC_MORE)->EnableWindow (FALSE); + if (m_iMoreCount > 0) + GetDlgItem(IDC_FEWER)->EnableWindow (TRUE); + else + GetDlgItem(IDC_FEWER)->EnableWindow (FALSE); + + AdjustHeight (dy); + +} + +void CSearchDialog::OnClearSearch() +{ + int dy = 0; + + MSG_SearchFree (m_pSearchPane); + + dy = m_searchObj.ClearSearch(&m_iMoreCount, TRUE); + + AdjustHeight (dy); + m_bChanged = TRUE; +} + +void CSearchDialog::OnEditValueChanged () +{ + m_bChanged = TRUE; +} + +void CSearchDialog::OnOperatorValueChanged () +{ + m_bChanged = TRUE; +} + +void CSearchDialog::OnAttrib1() +{ + + m_searchObj.UpdateOpList(0, scopeLdapDirectory, m_pServer); + m_bChanged = TRUE; +} + +void CSearchDialog::OnAttrib2() +{ + + m_searchObj.UpdateOpList(1, scopeLdapDirectory, m_pServer); + m_bChanged = TRUE; +} + +void CSearchDialog::OnAttrib3() +{ + + m_searchObj.UpdateOpList(2, scopeLdapDirectory, m_pServer); + m_bChanged = TRUE; +} + +void CSearchDialog::OnAttrib4() +{ + m_searchObj.UpdateOpList(3, scopeLdapDirectory, m_pServer); + m_bChanged = TRUE; +} + +void CSearchDialog::OnAttrib5() +{ + DIR_Server * server = NULL; + + m_searchObj.UpdateOpList(4, scopeLdapDirectory, m_pServer); + m_bChanged = TRUE; } int CSearchDialog::OnCreate( LPCREATESTRUCT lpCreateStruct ) { -#ifdef FEATURE_BUTTONPROPERTYPAGE - if (CButtonPropertySheet::OnCreate(lpCreateStruct) == -1) -#else - if (CWnd::OnCreate(lpCreateStruct) == -1) -#endif + + if (CDialog::OnCreate(lpCreateStruct) == -1) return -1; int16 guicsid = 0; @@ -159,664 +284,38 @@ int CSearchDialog::OnCreate( LPCREATESTRUCT lpCreateStruct ) ::ReleaseDC(m_hWnd,hDC); - XP_Bool prefBool= FALSE; - - PREF_GetBoolPref("mail.addr_book.useAdvancedSearch", &prefBool); - if (prefBool) { -#ifdef FEATURE_BUTTONPROPERTYPAGE - SetActivePage (1); -#endif - cs.LoadString (IDS_BASICSEARCH); - GetDlgItem(IDC_BUTTON4)->SetWindowText(cs); - cs.LoadString (IDS_ADVSEARCH_TITLE); - SetWindowText (cs); - ((CAdvancedSearch*)m_pAdvancedSearch)->InitializePrevSearch (); - } - else { -#ifdef FEATURE_BUTTONPROPERTYPAGE - SetActivePage (0); -#endif - cs.LoadString (IDS_BASICSEARCH_TITLE); - SetWindowText (cs); - ((CBasicSearch*)m_pBasicSearch)->InitializeSearchValues (); - } - return 0; } -void CSearchDialog::OnButton2() + +BOOL CSearchDialog::OnInitDialog() { -#ifdef FEATURE_BUTTONPROPERTYPAGE - if (GetActiveIndex() == 0) { - // save basic search - ((CBasicSearch*)m_pBasicSearch)->SavePreviousSearch(); - } - else { - // save advanced search - ((CAdvancedSearch*)m_pAdvancedSearch)->SavePreviousSearch(); - } + CDialog::OnInitDialog(); - - CButtonPropertySheet::OnButton2(); -#endif - -} // END OF FUNCTION CSearchDialog::OnButton2() - -void CSearchDialog::OnButton3() -{ - OnHelp(); - -} // END OF FUNCTION CSearchDialog::OnButton3() - -void CSearchDialog::OnButton4() -{ -#ifdef FEATURE_BUTTONPROPERTYPAGE - CString cs; - if (GetActiveIndex() == 0) { - // switch to advanced - cs.LoadString (IDS_BASICSEARCH); - GetDlgItem(IDC_BUTTON4)->SetWindowText(cs); - ((CBasicSearch*)m_pBasicSearch)->SavePreviousSearch(); - SetActivePage(1); - cs.LoadString (IDS_ADVSEARCH_TITLE); - SetWindowText (cs); - ((CAdvancedSearch*)m_pAdvancedSearch)->InitializePrevSearch (); - } - else { - // switch to basic - cs.LoadString (IDS_ADVSEARCH); - GetDlgItem(IDC_BUTTON4)->SetWindowText(cs); - ((CAdvancedSearch*)m_pAdvancedSearch)->SavePreviousSearch(); - SetActivePage(0); - cs.LoadString (IDS_BASICSEARCH_TITLE); - SetWindowText (cs); - ((CBasicSearch*)m_pBasicSearch)->InitializeSearchValues (); - } - PREF_SetBoolPref("mail.addr_book.useAdvancedSearch", GetActiveIndex()); -#endif -} // END OF FUNCTION CSearchDialog::OnButton4() - - -///////////////////////////////////////////////////////////////////////////// -// CAdvancedSearch property page - -CAdvancedSearch::CAdvancedSearch(CWnd *pParent) -#ifdef FEATURE_BUTTONPROPERTYPAGE - : CButtonPropertyPage(CAdvancedSearch::IDD) -#endif -{ - //{{AFX_DATA_INIT(CAddressUser) - //}}AFX_DATA_INIT - m_iMoreCount = 0; - m_bLogicType = 0; - m_bChanged = FALSE; -} - -CAdvancedSearch::~CAdvancedSearch() -{ -} - -void CAdvancedSearch::DoDataExchange(CDataExchange* pDX) -{ -#ifdef FEATURE_BUTTONPROPERTYPAGE - CButtonPropertyPage::DoDataExchange(pDX); -#else - CDialog::DoDataExchange(pDX); -#endif - - //{{AFX_DATA_MAP(CAdvancedSearch) - //}}AFX_DATA_MAP -} - -#ifdef FEATURE_BUTTONPROPERTYPAGE -BEGIN_MESSAGE_MAP(CAdvancedSearch, CButtonPropertyPage) -#else -BEGIN_MESSAGE_MAP(CAdvancedSearch, CDialog) -#endif - //{{AFX_MSG_MAP(CAdvancedSearch) - // NOTE: the ClassWizard will add message map macros here - ON_BN_CLICKED(IDC_MORE, OnMore) - ON_BN_CLICKED(IDC_FEWER, OnFewer) - ON_BN_CLICKED(IDC_CLEAR_SEARCH, OnClearSearch) - ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB1, OnAttrib1) - ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB2, OnAttrib2) - ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB3, OnAttrib3) - ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB4, OnAttrib4) - ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB5, OnAttrib5) - ON_CBN_SELCHANGE(IDC_COMBO_OP1, OnOperatorValueChanged) - ON_CBN_SELCHANGE(IDC_COMBO_OP2, OnOperatorValueChanged) - ON_CBN_SELCHANGE(IDC_COMBO_OP3, OnOperatorValueChanged) - ON_CBN_SELCHANGE(IDC_COMBO_OP4, OnOperatorValueChanged) - ON_CBN_SELCHANGE(IDC_COMBO_OP5, OnOperatorValueChanged) - ON_CBN_SELCHANGE(IDC_COMBO_AND_OR, OnAndOr) - ON_EN_CHANGE( IDC_EDIT_VALUE1, OnEditValueChanged ) - ON_EN_CHANGE( IDC_EDIT_VALUE2, OnEditValueChanged ) - ON_EN_CHANGE( IDC_EDIT_VALUE3, OnEditValueChanged ) - ON_EN_CHANGE( IDC_EDIT_VALUE4, OnEditValueChanged ) -#ifdef ON_UPDATE_COMMAND_UI_RANGE - ON_UPDATE_COMMAND_UI_RANGE( IDC_COMBO_ATTRIB1, IDC_EDIT_VALUE5, OnUpdateQuery ) -#endif - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - - -#ifndef ON_UPDATE_COMMAND_UI_RANGE - -BOOL CAdvancedSearch::OnCmdMsg( UINT nID, int nCode, void* pExtra, - AFX_CMDHANDLERINFO* pHandlerInfo ) -{ - if ((nID >= IDC_COMBO_ATTRIB1) && (nID <= IDC_EDIT_VALUE5) && - ( nCode == CN_UPDATE_COMMAND_UI) ) { - OnUpdateQuery( (CCmdUI *) pExtra ); - return TRUE; - } - return CDialog::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ); -} - -#endif - -void CAdvancedSearch::OnUpdateQuery( CCmdUI *pCmdUI ) -{ - pCmdUI->Enable( TRUE ); -} - -void CAdvancedSearch::AdjustHeight(int dy) -{ - CRect rect; - GetWindowRect(&rect); - - CSize size = rect.Size(); - size.cy += dy; - - SetWindowPos( NULL, 0, 0, size.cx, size.cy, SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW); - GetWindowRect(&rect); -} - - -///////////////////////////////////////////////////////////////////////////// -// CAddressUser message handlers - -BOOL CAdvancedSearch::OnInitDialog() -{ -#ifdef FEATURE_BUTTONPROPERTYPAGE - // TODO: Add your specialized code here and/or call the base class - CButtonPropertyPage::OnInitDialog(); -#endif m_searchObj.InitializeAttributes (widgetText, attribCommonName); - DIR_Server * pServer = NULL; - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &pServer); - m_searchObj.New (this); - m_searchObj.UpdateAttribList(scopeLdapDirectory, pServer); - m_searchObj.UpdateOpList(scopeLdapDirectory, pServer); + m_searchObj.UpdateAttribList(scopeLdapDirectory, m_pServer); + m_searchObj.UpdateOpList(scopeLdapDirectory, m_pServer); - GetDlgItem(IDC_STATIC1)->SetWindowText(pServer->description); + SetWindowText(m_pTitle); + GetDlgItem(IDC_STATIC1)->SetWindowText(m_pServer->description); + + CWnd* pWidget = GetDlgItem(IDC_STATIC_DESC); + if(pWidget) + { + CRect widgetRect, windowRect; + pWidget->GetWindowRect(widgetRect); + + GetWindowRect(windowRect); + int dy = windowRect.BottomRight().y - widgetRect.BottomRight().y; + + SetWindowPos(NULL, 0, 0, windowRect.Width(), + windowRect.Height() - dy + BOTTOM_BORDER, SWP_NOMOVE); + } return TRUE; } -void CAdvancedSearch::InitializePrevSearch() -{ - int dy = 0; - MSG_Pane * pane = NULL; - DIR_Server * pServer = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &pServer); - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSEARCHPANE, 0, (LPARAM) &pane); - - dy += m_searchObj.InitializeLDAPSearchWindow (pane, pServer, &m_iMoreCount, m_bLogicType); - - if (m_iMoreCount < 4) - GetDlgItem(IDC_MORE)->EnableWindow (TRUE); - else - GetDlgItem(IDC_MORE)->EnableWindow (FALSE); - if (m_iMoreCount > 0) - GetDlgItem(IDC_FEWER)->EnableWindow (TRUE); - else - GetDlgItem(IDC_FEWER)->EnableWindow (FALSE); - - AdjustHeight (dy); - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_RECALC_LAYOUT, 0, 0); -} - - -BOOL CAdvancedSearch::SavePreviousSearch( ) -{ - // save the query - if (m_bChanged) - { - MSG_Pane * pane = NULL; - DIR_Server * server = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &server); - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSEARCHPANE, 0, (LPARAM) &pane); - MSG_SearchFree (pane); - MSG_SearchAlloc (pane); - MSG_AddLdapScope(pane, server); - m_searchObj.BuildQuery(pane, m_iMoreCount, m_bLogicType); - } - - return (TRUE); -} - - -BOOL CAdvancedSearch::OnSetActive() -{ -#ifdef FEATURE_BUTTONPROPERTYPAGE - // TODO: Add your specialized code here and/or call the base class - if(!CButtonPropertyPage::OnSetActive()) - return(FALSE); - - m_bChanged = FALSE; -#endif - return(TRUE); -} - - -void CAdvancedSearch::OnOK() -{ - MSG_Pane * pane = NULL; - DIR_Server * server = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &server); - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSEARCHPANE, 0, (LPARAM) &pane); - MSG_SearchFree (pane); - MSG_SearchAlloc (pane); - MSG_AddLdapScope(pane, server); - m_searchObj.BuildQuery(pane, m_iMoreCount, m_bLogicType); -} - -void CAdvancedSearch::OnAndOr() -{ - m_searchObj.OnAndOr(m_iMoreCount, &m_bLogicType); - m_bChanged = TRUE; -} - -void CAdvancedSearch::OnMore() -{ - int dy = 0; - - dy = m_searchObj.More(&m_iMoreCount, m_bLogicType); - - if (m_iMoreCount < 4) - GetDlgItem(IDC_MORE)->EnableWindow (TRUE); - else - GetDlgItem(IDC_MORE)->EnableWindow (FALSE); - if (m_iMoreCount > 0) - GetDlgItem(IDC_FEWER)->EnableWindow (TRUE); - else - GetDlgItem(IDC_FEWER)->EnableWindow (FALSE); - - AdjustHeight (dy); - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_RECALC_LAYOUT, 0, 0); -} - -void CAdvancedSearch::OnFewer() -{ - int dy = 0; - - dy = m_searchObj.Fewer(&m_iMoreCount, m_bLogicType); - - if (m_iMoreCount < 4) - GetDlgItem(IDC_MORE)->EnableWindow (TRUE); - else - GetDlgItem(IDC_MORE)->EnableWindow (FALSE); - if (m_iMoreCount > 0) - GetDlgItem(IDC_FEWER)->EnableWindow (TRUE); - else - GetDlgItem(IDC_FEWER)->EnableWindow (FALSE); - - AdjustHeight (dy); - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_RECALC_LAYOUT, 0, 0); -} - -void CAdvancedSearch::OnClearSearch() -{ - int dy = 0; - - MSG_Pane * pane = NULL; - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSEARCHPANE, 0, (LPARAM) &pane); - - MSG_SearchFree (pane); - - dy = m_searchObj.ClearSearch(&m_iMoreCount, TRUE); - - AdjustHeight (dy); - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_RECALC_LAYOUT, 0, 0); - m_bChanged = TRUE; -} - -void CAdvancedSearch::OnEditValueChanged () -{ - m_bChanged = TRUE; -} - -void CAdvancedSearch::OnOperatorValueChanged () -{ - m_bChanged = TRUE; -} - -void CAdvancedSearch::OnAttrib1() -{ - DIR_Server * server = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &server); - - m_searchObj.UpdateOpList(0, scopeLdapDirectory, server); - m_bChanged = TRUE; -} - -void CAdvancedSearch::OnAttrib2() -{ - DIR_Server * server = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &server); - m_searchObj.UpdateOpList(1, scopeLdapDirectory, server); - m_bChanged = TRUE; -} - -void CAdvancedSearch::OnAttrib3() -{ - DIR_Server * server = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &server); - m_searchObj.UpdateOpList(2, scopeLdapDirectory, server); - m_bChanged = TRUE; -} - -void CAdvancedSearch::OnAttrib4() -{ - DIR_Server * server = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &server); - m_searchObj.UpdateOpList(3, scopeLdapDirectory, server); - m_bChanged = TRUE; -} - -void CAdvancedSearch::OnAttrib5() -{ - DIR_Server * server = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &server); - m_searchObj.UpdateOpList(4, scopeLdapDirectory, server); - m_bChanged = TRUE; -} - - - -///////////////////////////////////////////////////////////////////////////// -// CBasicSearch property page - -static int BasicChoicesTable[][2] = - {{IDC_STATIC1, IDC_EDIT_VALUE1}, - {IDC_STATIC2, IDC_EDIT_VALUE2}, - {IDC_STATIC3, IDC_EDIT_VALUE3}, - {IDC_STATIC4, IDC_EDIT_VALUE4}}; - -#define BASIC_COL_LABEL 0 -#define BASIC_COL_VALUE 1 -#define BASIC_COL_COUNT 2 - -static _TCHAR szResultText[64]; - -CBasicSearch::CBasicSearch(CWnd *pParent) -#ifdef FEATURE_BUTTONPROPERTYPAGE - : CButtonPropertyPage(CBasicSearch::IDD) -#endif -{ - //{{AFX_DATA_INIT(CBasicSearch) - //}}AFX_DATA_INIT - m_bChanged = FALSE; -} - -CBasicSearch::~CBasicSearch() -{ - m_bLogicType = 1; -} - -void CBasicSearch::DoDataExchange(CDataExchange* pDX) -{ -#ifdef FEATURE_BUTTONPROPERTYPAGE - CButtonPropertyPage::DoDataExchange(pDX); -#else - CDialog::DoDataExchange(pDX); -#endif - //{{AFX_DATA_MAP(CBasicSearch) - //}}AFX_DATA_MAP -} - -#ifdef FEATURE_BUTTONPROPERTYPAGE -BEGIN_MESSAGE_MAP(CBasicSearch, CButtonPropertyPage) -#else -BEGIN_MESSAGE_MAP(CBasicSearch, CDialog) -#endif - - //{{AFX_MSG_MAP(CBasicSearch) - // NOTE: the ClassWizard will add message map macros here - ON_EN_CHANGE( IDC_EDIT_VALUE1, OnEditValueChanged ) - ON_EN_CHANGE( IDC_EDIT_VALUE2, OnEditValueChanged ) - ON_EN_CHANGE( IDC_EDIT_VALUE3, OnEditValueChanged ) - ON_EN_CHANGE( IDC_EDIT_VALUE4, OnEditValueChanged ) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CAddressUser message handlers - -BOOL CBasicSearch::OnInitDialog() -{ - MSG_SearchMenuItem items[4]; - int maxItems = 4; - -#ifdef FEATURE_BUTTONPROPERTYPAGE - CButtonPropertyPage::OnInitDialog(); -#endif - - DIR_Server * pServer = NULL; - int j = 0; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &pServer); - GetDlgItem(IDC_STATIC5)->SetWindowText(pServer->description); - - MSG_GetBasicLdapSearchAttributes (pServer, items, &maxItems); - - for (j = 0; j < maxItems; j++) { - (GetDlgItem (BasicChoicesTable[j][BASIC_COL_LABEL]))->SetWindowText (items[j].name); - } - - return TRUE; -} - -void CBasicSearch::InitializeSearchValues () -{ - MSG_Pane * pane = NULL; - int numTerms = 0; - MSG_SearchAttribute attrib; - MSG_SearchOperator op; - MSG_SearchValue value; - MSG_SearchMenuItem items[4]; - int maxItems = 4; - int j = 0; - DIR_Server * pServer = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &pServer); - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSEARCHPANE, 0, (LPARAM) &pane); - - MSG_GetBasicLdapSearchAttributes (pServer, items, &maxItems); - MSG_CountSearchTerms (pane, &numTerms); - - // set all the terms back to empty strings - for (j = 0; j < maxItems; j++) { - (GetDlgItem (BasicChoicesTable[j][BASIC_COL_VALUE]))->SetWindowText(""); - } - - // get the attributes for the directory used in the last search - // and make sure that - // it hasn't been remaped from customization - int numScopes = 0; - DIR_Server * server = NULL; - uint16 maxItems2 = 16; - MSG_SearchMenuItem items2[16]; - MSG_ScopeAttribute scope = scopeLdapDirectory; - MSG_CountSearchScopes (pane, &numScopes); - BOOL bCompareAttrib = FALSE; - - // find the attributes - if (numScopes) { - ASSERT (numScopes == 1); - MSG_GetNthSearchScope (pane, 0, &scope, (void**) &server); - if (server && !DIR_AreServersSame (pServer, server)) { - MSG_GetAttributesForSearchScopes (WFE_MSGGetMaster(), scopeLdapDirectory, - (void**) &server, 1, items2, &maxItems2); - bCompareAttrib = TRUE; - } - } - - // set them to the values in the search pane - for (int i = 0; i < maxItems && i < numTerms; i++) - { - BOOL found = FALSE; - int k = 0; - MSG_GetNthSearchTerm (pane, i, &attrib, &op, &value); - if (bCompareAttrib) - { - while (k < maxItems2 && !found) { - if (items2 [k].attrib != attrib) - k++; - else - found = TRUE; - } - } - - for (j = 0; j < maxItems; j++) { - if ((items[j].attrib == attrib) && (!(GetDlgItem (BasicChoicesTable[j][BASIC_COL_VALUE]))->GetWindowTextLength())) { - if (bCompareAttrib) { - if (found && (strcmp (items2 [k].name, items[j].name ) == 0)) - (GetDlgItem (BasicChoicesTable[j][BASIC_COL_VALUE]))->SetWindowText(value.u.string); - } - else - (GetDlgItem (BasicChoicesTable[j][BASIC_COL_VALUE]))->SetWindowText(value.u.string); - } - } - } -} - -void CBasicSearch::OnEditValueChanged () -{ - m_bChanged = TRUE; -} - - -BOOL CBasicSearch::SavePreviousSearch( ) -{ - // save the query - if (m_bChanged) - { - MSG_Pane * pane = NULL; - DIR_Server * server = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &server); - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSEARCHPANE, 0, (LPARAM) &pane); - MSG_SearchFree (pane); - MSG_SearchAlloc (pane); - MSG_AddLdapScope(pane, server); - BuildQuery(pane, m_bLogicType); - } - - return (TRUE); -} - - -BOOL CBasicSearch::OnSetActive() -{ -#ifdef FEATURE_BUTTONPROPERTYPAGE - if(!CButtonPropertyPage::OnSetActive()) - return(FALSE); - - m_bChanged = FALSE; -#endif - - return(TRUE); -} - - -void CBasicSearch::OnOK() -{ - MSG_Pane * pane = NULL; - DIR_Server * server = NULL; - - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &server); - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSEARCHPANE, 0, (LPARAM) &pane); - MSG_SearchFree (pane); - MSG_SearchAlloc (pane); - MSG_AddLdapScope(pane, server); - BuildQuery(pane, m_bLogicType); -} - -void CBasicSearch::BuildQuery (MSG_Pane* searchPane, BOOL bLogicType) -{ - MSG_SearchAttribute attrib; - MSG_SearchOperator op; - MSG_SearchValue value; - CNSDateEdit *date = NULL; - CComboBox * combo = NULL; - int iCurSel = 0; - CWnd * widget = NULL; - MSG_SearchMenuItem items[4]; - int maxItems = 4; - - DIR_Server * pServer = NULL; - ::SendMessage (GetParent()->GetSafeHwnd(), LDS_GETSERVER, 0, (LPARAM) &pServer); - - MSG_GetBasicLdapSearchAttributes (pServer, items, &maxItems); - - for (int i = 0; i <= 3; i++) { - attrib = (MSG_SearchAttribute) items[i].attrib; - - op = (MSG_SearchOperator) opContains; - - widget = GetDlgItem(BasicChoicesTable[i][BASIC_COL_VALUE]); - widget->GetWindowText(szResultText, sizeof(szResultText)); - - value.attribute = attrib; - switch (attrib) { - case attribDate: - { - CTime ctime; - date = (CNSDateEdit *) GetDlgItem(BasicChoicesTable[i][BASIC_COL_VALUE]); - date->GetDate(ctime); - value.u.date = ctime.GetTime(); - } - break; - case attribPriority: - combo = (CComboBox *) GetDlgItem(BasicChoicesTable[i][BASIC_COL_VALUE]); - iCurSel = combo->GetCurSel(); - value.u.priority = (MSG_PRIORITY) combo->GetItemData(iCurSel); - break; - case attribMsgStatus: - combo = (CComboBox *) GetDlgItem(BasicChoicesTable[i][BASIC_COL_VALUE]); - iCurSel = combo->GetCurSel(); - value.u.msgStatus = combo->GetItemData(iCurSel); - break; - default: - if (XP_STRLEN (szResultText)) - value.u.string = XP_STRDUP (szResultText); - else - value.u.string = NULL; - } - if (value.u.string) - { - MSG_AddSearchTerm(searchPane, attrib, op, &value, !bLogicType, NULL); - XP_FREE(value.u.string); - } - } - -} - - diff --git a/mozilla/cmd/winfe/srchdlg.h b/mozilla/cmd/winfe/srchdlg.h index f8de4e2b773..af0002fc858 100644 --- a/mozilla/cmd/winfe/srchdlg.h +++ b/mozilla/cmd/winfe/srchdlg.h @@ -25,54 +25,26 @@ // ldap search dialog // -#ifdef FEATURE_BUTTONPROPERTYPAGE -#include "butprop.h" -#endif - #include "srchobj.h" #include "mnrccln.h" -#ifndef LDS_GETSEARCHPANE -#define LDS_GETSEARCHPANE (WM_USER + 225) -#define LDS_GETSERVER (WM_USER + 226) -#define LDS_RECALC_LAYOUT (WM_USER + 227) -#endif - /**************************************************************************** * * Class: CSearchDialog * * DESCRIPTION: -* This class is the property sheet window for editing all the attributes +* This class is the dialog for editing all the attributes * of the people types in the address book * ****************************************************************************/ -typedef enum _ButtonPosition // Normally in butprop.h. -{ - BUTTON_RIGHT, - BUTTON_BOTTOM, - BUTTON_NONE -} ButtonPosition; -#ifdef FEATURE_BUTTONPROPERTYPAGE -class CSearchDialog : public CButtonPropertySheet -#else -class CSearchDialog : public CWnd -#endif +class CSearchDialog : public CDialog { protected: -#ifdef FEATURE_BUTTONPROPERTYPAGE - CButtonPropertyPage * m_pAdvancedSearch; - CButtonPropertyPage * m_pBasicSearch; -#else - CDialog* m_pAdvancedSearch; - CDialog* m_pBasicSearch; public: - int DoModal() { return 0; } protected: -#endif MSG_Pane* m_pSearchPane; DIR_Server* m_pServer; @@ -80,101 +52,46 @@ protected: public: HFONT m_pFont; + char * m_pTitle; + enum { IDD = IDD_ADVANCED_LDAP_SEARCH }; public: CSearchDialog (UINT nIDCaption, MSG_Pane* pSearchPane, DIR_Server* pServer, - CWnd* pParentWnd = NULL, - UINT numButtons = 0, - ButtonPosition buttonPosition = BUTTON_NONE, - CUIntArray* buttonLabels = NULL); + CWnd* pParentWnd = NULL); CSearchDialog ( LPCTSTR lpszCaption, MSG_Pane* pSearchPane, DIR_Server* pServer, - CWnd * parent = NULL, - UINT numButtons = 0, - ButtonPosition buttonPosition = BUTTON_NONE, - CPtrArray* buttonLabels = NULL); + CWnd * parent = NULL); virtual ~CSearchDialog ( ); - virtual void OnHelp(); - virtual void OnButton2(); - virtual void OnButton3(); - virtual void OnButton4(); protected: + CSearchObject m_searchObj; + int m_iMoreCount; + BOOL m_bLogicType; + BOOL m_bChanged; + // Overrides // ClassWizard generate virtual function overrides //{{AFX_VIRTUAL(CSearchDialog) public: + virtual BOOL OnInitDialog(); virtual void PostNcDestroy(); + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: + #ifndef ON_UPDATE_COMMAND_UI_RANGE + virtual BOOL OnCmdMsg( UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo ); +#endif + // Generated message map functions //{{AFX_MSG(CSearchDialog) // NOTE: the ClassWizard will add member functions here afx_msg int OnCreate( LPCREATESTRUCT ); - afx_msg LRESULT OnGetServer(WPARAM, LPARAM); - afx_msg LRESULT OnGetSearchPane(WPARAM, LPARAM); - afx_msg LRESULT OnRecalcLayout(WPARAM, LPARAM); - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() -}; - - -/**************************************************************************** -* -* Class: CAdvancedSearch -* -* DESCRIPTION: -* -****************************************************************************/ - -#ifdef FEATURE_BUTTONPROPERTYPAGE -class CAdvancedSearch : public CButtonPropertyPage -#else -class CAdvancedSearch : public CDialog -#endif -{ - -// Construction -public: - CAdvancedSearch(CWnd *pParent); - virtual ~CAdvancedSearch(); - -// Dialog Data - //{{AFX_DATA(CAddressUser) - enum { IDD = IDD_ADVANCED_LDAP_SEARCH }; - - //}}AFX_DATA - -// Overrides - // ClassWizard generate virtual function overrides - //{{AFX_VIRTUAL(CAdvancedSearch) - public: - virtual BOOL OnInitDialog(); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - - // Overridables - public: - void InitializePrevSearch(); - - -// Implementation -protected: - -#ifndef ON_UPDATE_COMMAND_UI_RANGE - virtual BOOL OnCmdMsg( UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo ); -#endif - // Generated message map functions - //{{AFX_MSG(CAdvancedSearch) - // NOTE: the ClassWizard will add member functions here afx_msg void OnMore(); afx_msg void OnFewer(); afx_msg void OnSearch(); @@ -185,85 +102,17 @@ protected: afx_msg void OnAttrib4(); afx_msg void OnAttrib5(); afx_msg void OnAndOr(); - afx_msg void OnOK(); afx_msg void OnUpdateQuery( CCmdUI *pCmdUI ); afx_msg void OnEditValueChanged (); afx_msg void OnOperatorValueChanged (); - virtual BOOL OnSetActive(); + //}}AFX_MSG DECLARE_MESSAGE_MAP() void AdjustHeight (int dy); -public: - BOOL SavePreviousSearch (); - -// Data members -protected: - CSearchObject m_searchObj; - int m_iMoreCount; - BOOL m_bLogicType; - BOOL m_bChanged; }; -/**************************************************************************** -* -* Class: CBasicSearch -* -* DESCRIPTION: -* -****************************************************************************/ -#ifdef FEATURE_BUTTONPROPERTYPAGE -class CBasicSearch : public CButtonPropertyPage -#else -class CBasicSearch : public CDialog -#endif -{ - -// Construction -public: - CBasicSearch(CWnd *pParent); - virtual ~CBasicSearch(); - -protected: - void BuildQuery (MSG_Pane* searchPane, BOOL bLogicType); - -// Dialog Data - //{{AFX_DATA(CAddressUser) - enum { IDD = IDD_BASIC_SEARCH }; - - //}}AFX_DATA - -// Overrides - // ClassWizard generate virtual function overrides - //{{AFX_VIRTUAL(CBasicSearch) - public: - virtual BOOL OnInitDialog(); - virtual BOOL OnSetActive(); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - // Generated message map functions - //{{AFX_MSG(CBasicSearch) - // NOTE: the ClassWizard will add member functions here - afx_msg void OnOK(); - afx_msg void OnEditValueChanged (); - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() - -public: - BOOL SavePreviousSearch (); - void InitializeSearchValues (); - -protected: - BOOL m_bLogicType; - BOOL m_bChanged; -}; - -#endif +#endif \ No newline at end of file diff --git a/mozilla/cmd/winfe/srchfrm.cpp b/mozilla/cmd/winfe/srchfrm.cpp index 5df17d88681..ece26f70c01 100755 --- a/mozilla/cmd/winfe/srchfrm.cpp +++ b/mozilla/cmd/winfe/srchfrm.cpp @@ -1,25 +1,25 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- 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 + * Version 1.0 (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 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. + * 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 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. + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1996 + * Netscape Communications Corporation. All Rights Reserved. */ // srchfrm.cpp : implementation file // #include "stdafx.h" -#include "srchfrm.h" #include "fldrfrm.h" #include "thrdfrm.h" #include "msgfrm.h" @@ -37,19 +37,19 @@ #include "fegui.h" #include "intl_csi.h" #include "msg_srch.h" -#include "advopdlg.h" -#include "edhdrdlg.h" #include "srchobj.h" #include "shcut.h" #include "msgcom.h" #include "mailqf.h" -#include "rdfglobal.h" +#include "srchfrm.h" + +#include "advprosh.h" #define SEARCH_GROW_HEIGHT 200 #define SCOPE_SELECTED 0 #define SCOPE_ALL_MAIL 1 -#define SCOPE_SUBSCRIBED_NEWS 2 +#define SCOPE_SUBSCRIBED_NEWS 2 #define SCOPE_ALL_NEWS 3 #define DEF_VISIBLE_COLUMNS 4 @@ -57,13 +57,17 @@ #define NETSCAPE_SEARCH_FORMAT "Netscape Search" CSearchFrame *g_pSearchWindow = NULL; +#if 0 // MW fix CLDAPSearchFrame *g_pLDAPSearchWindow = NULL; +#endif #ifndef _AFXDLL #undef new #endif IMPLEMENT_DYNCREATE(CSearchView, COutlinerView) +#if 0 // MW fix IMPLEMENT_DYNCREATE(CLDAPSearchView, COutlinerView) +#endif #ifndef _AFXDLL #define new DEBUG_NEW #endif @@ -131,7 +135,7 @@ int CSearchBar::GetHeightNeeded() if(m_bLDAP) { - widget2 = GetDlgItem(IDC_ADVANCED_SEARCH); + widget2 = GetDlgItem(IDC_ADVANCED_OPTIONS); } else { @@ -353,15 +357,18 @@ void CSearchBar::OnSize( UINT nType, int cx, int cy ) widget = GetDlgItem(IDC_FIND); SlideWindow(widget, dx, 0); - widget = GetDlgItem(IDC_SAVE); - if (widget) - SlideWindow(widget, dx, 0); - widget = GetDlgItem(IDC_SEARCHHELP); + + widget = GetDlgItem(IDC_NEW); SlideWindow(widget, dx, 0); - widget = GetDlgItem(IDC_ADVANCED_SEARCH); + widget = GetDlgItem(IDC_SAVE); SlideWindow(widget, dx, 0); + widget = GetDlgItem(IDC_SEARCHHELP); + SlideWindow(widget, dx, 0); + + widget = GetDlgItem(IDC_ADVANCED_OPTIONS); + SlideWindow(widget, dx, 0); m_searchObj.OnSize (nType, cx, cy, dx); m_iWidth = cx; @@ -527,10 +534,8 @@ CSearchFrame::CSearchFrame() m_listSearch = XP_ListNew(); m_listResult = NULL; m_pOutliner = NULL; - m_pAdvancedOptionsDlg = NULL; - m_pCustomHeadersDlg = NULL; - CSearchResultsList *pInstance = new CSearchResultsList (this); + CSearchResultsList *pInstance = new CSearchResultsList (this); pInstance->QueryInterface (IID_IMsgList, (LPVOID *) &m_pIMsgList); m_pSearchPane = MSG_CreateSearchPane (GetContext(), WFE_MSGGetMaster()); @@ -600,11 +605,11 @@ void CSearchFrame::ShowResults( BOOL bShow ) SetWindowPos( NULL, 0, 0, size.cx, m_iHeight, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); - m_barStatus.ShowWindow(SW_SHOW); + m_barStatus.ShowWindow(SW_SHOW); RecalcLayout(); - } else { + } else { CRect rect; GetWindowRect(&rect); @@ -754,7 +759,8 @@ BOOL CSearchFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext // CSearchFrame message handlers BEGIN_MESSAGE_MAP(CSearchFrame, CFrameWnd) - ON_WM_CREATE() + ON_WM_SETFOCUS() + ON_WM_CREATE() ON_WM_CLOSE() ON_WM_DESTROY() ON_WM_GETMINMAXINFO() @@ -768,23 +774,27 @@ BEGIN_MESSAGE_MAP(CSearchFrame, CFrameWnd) ON_UPDATE_COMMAND_UI( IDC_TO, OnUpdateTo ) ON_BN_CLICKED(IDC_BUTTON_FILE_MESSAGE, OnFileButton) ON_UPDATE_COMMAND_UI( IDC_BUTTON_FILE_MESSAGE, OnUpdateFileButton ) + ON_BN_CLICKED(IDC_BUTTON_DELETE_MESSAGE, OnDeleteMessage) + ON_UPDATE_COMMAND_UI( IDC_BUTTON_DELETE_MESSAGE, OnUpdateDeleteButton ) ON_BN_CLICKED(IDC_NEW, OnNew) - ON_UPDATE_COMMAND_UI(IDC_NEW, OnUpdateQuery) + ON_UPDATE_COMMAND_UI(IDC_NEW, OnUpdateClearSearch) ON_BN_CLICKED(IDC_SAVE, OnSave) ON_UPDATE_COMMAND_UI( IDC_SAVE, OnUpdateSave ) ON_BN_CLICKED(IDC_SEARCHHELP, OnHelp) ON_UPDATE_COMMAND_UI( IDC_SEARCHHELP, OnUpdateHelp ) - ON_BN_CLICKED(IDC_ADVANCED_SEARCH, OnAdvanced) - ON_UPDATE_COMMAND_UI( IDC_ADVANCED_SEARCH, OnUpdateAdvanced ) + ON_BN_CLICKED(IDC_ADVANCED_OPTIONS, OnAdvanced) + ON_UPDATE_COMMAND_UI( IDC_ADVANCED_OPTIONS, OnUpdateAdvanced ) ON_CBN_SELCHANGE(IDC_COMBO_SCOPE, OnScope) ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB1, OnAttrib1) ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB2, OnAttrib2) ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB3, OnAttrib3) ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB4, OnAttrib4) ON_CBN_SELCHANGE(IDC_COMBO_ATTRIB5, OnAttrib5) - ON_CBN_SELCHANGE(IDC_COMBO_AND_OR, OnAndOr) - ON_UPDATE_COMMAND_UI(IDC_COMBO_AND_OR, OnUpdateAndOr) + ON_BN_CLICKED(IDC_RADIO_ALL, OnAndOr) + ON_BN_CLICKED(IDC_RADIO_ANY, OnAndOr) + ON_UPDATE_COMMAND_UI(IDC_RADIO_ALL, OnUpdateAndOr) + ON_UPDATE_COMMAND_UI(IDC_RADIO_ANY, OnUpdateAndOr) ON_MESSAGE(WM_ADVANCED_OPTIONS_DONE, OnFinishedAdvanced) ON_MESSAGE(WM_EDIT_CUSTOM_DONE, OnFinishedHeaders) @@ -806,6 +816,8 @@ BEGIN_MESSAGE_MAP(CSearchFrame, CFrameWnd) ON_UPDATE_COMMAND_UI( ID_MESSAGE_FILE, OnUpdateFile ) ON_UPDATE_COMMAND_UI( IDC_COMBO_SCOPE, OnUpdateQuery ) + ON_UPDATE_COMMAND_UI(IDS_ONLINE_STATUS, OnUpdateOnlineStatus) + END_MESSAGE_MAP() #ifndef ON_COMMAND_RANGE @@ -862,38 +874,31 @@ void CSearchFrame::OnFileButton() if (!hFileMenu) return; //Bail!!! - if ( iSel < nTotalLines ) + if(iSel <= nTotalLines) { UINT nID = FIRST_MOVE_MENU_ID; - CMailNewsFrame::UpdateMenu( NULL, hFileMenu, nID ); - } - + CMailNewsFrame::UpdateMenu(NULL, hFileMenu, nID); + } CRect rect; - CWnd *pWidget = (CWnd*) m_barAction.GetDlgItem(IDC_BUTTON_FILE_MESSAGE); - if (pWidget) + CWnd * pWidget = (CWnd *)m_barAction.GetDlgItem(IDC_BUTTON_FILE_MESSAGE); + if(pWidget) { //convert this bad boy to Screen units pWidget->GetWindowRect(&rect); ::MapDialogRect(pWidget->GetSafeHwnd(), &rect); pWidget->EnableWindow(FALSE); } else - { return;//Bail!! - } - - // Track the popup now. - DWORD dwError = ::TrackPopupMenu( hFileMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, rect.left, rect.bottom, 0, - GetSafeHwnd(), NULL); + // Track the popup now. + DWORD dwError = ::TrackPopupMenu(hFileMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, + rect.left, rect.bottom, 0, GetSafeHwnd(), NULL); pWidget->EnableWindow(TRUE); - - // Cleanup handled in CMailNewsFrame - //VERIFY(::DestroyMenu( hFileMenu )); + // Cleanup handled in CMailNewsFrame } - void CSearchFrame::OnUpdateFileButton(CCmdUI *pCmdUI) { MSG_ViewIndex *indices; @@ -901,7 +906,17 @@ void CSearchFrame::OnUpdateFileButton(CCmdUI *pCmdUI) m_pOutliner->GetSelection(indices, count); int nLines = m_pOutliner->GetTotalLines(); - pCmdUI->Enable( ((nLines > 0) && count)); + pCmdUI->Enable(((nLines > 0) && count)); +} + +void CSearchFrame::OnUpdateDeleteButton(CCmdUI *pCmdUI) +{ + MSG_ViewIndex *indices; + int count; + m_pOutliner->GetSelection(indices, count); + int nLines = m_pOutliner->GetTotalLines(); + + pCmdUI->Enable(((nLines > 0) && count)); } void CSearchFrame::OnFileMessage(UINT nID) @@ -1096,10 +1111,37 @@ BOOL CSearchFrame::PreTranslateMessage( MSG* pMsg ) HWND hwndFocus = ::GetFocus(); HWND hwndSearchFirst = ::GetNextDlgTabItem( m_barSearch.m_hWnd, NULL, FALSE ); - HWND hwndActionFirst = ::GetNextDlgTabItem( m_barAction.m_hWnd, NULL, FALSE ); - HWND hwndSearchLast = ::GetNextDlgTabItem( m_barSearch.m_hWnd, hwndSearchFirst, TRUE ); + +#ifdef _WIN32 + HWND hwndActionFirst = ::GetNextDlgTabItem( m_barAction.m_hWnd, NULL, FALSE ); HWND hwndActionLast = ::GetNextDlgTabItem( m_barAction.m_hWnd, hwndActionFirst, TRUE ); +#else + HWND hwndActionFirst = NULL; + HWND hwndActionLast = NULL; + if (m_bIsLDAPSearch) + { + HWND hAdd = ::GetDlgItem( m_barAction.m_hWnd, IDC_ADD ); + HWND hTo = ::GetDlgItem( m_barAction.m_hWnd, IDC_TO ); + if (::IsWindow(hAdd) && ::IsWindowVisible(hAdd) && ::IsWindowEnabled(hAdd)) + { + hwndActionFirst = hAdd; + if (::IsWindow(hTo) && ::IsWindowVisible(hTo) && ::IsWindowEnabled(hTo)) + hwndActionLast = hTo; + } + else + { + if (::IsWindow(hTo) && ::IsWindowVisible(hTo) && ::IsWindowEnabled(hTo)) + hwndActionFirst = hTo; + } + } + else + { + HWND hTo = ::GetDlgItem( m_barAction.m_hWnd, IDC_TO ); + if (::IsWindow(hTo) && ::IsWindowVisible(hTo) && ::IsWindowEnabled(hTo)) + hwndActionFirst = hTo; + } +#endif if ( GetKeyState(VK_SHIFT) & 0x8000 ) { @@ -1126,7 +1168,6 @@ BOOL CSearchFrame::PreTranslateMessage( MSG* pMsg ) } else { // Tab forward - if (hwndFocus == m_pOutliner->m_hWnd) { // Handle tabbing out of outliner hwndNext = hwndActionFirst; @@ -1171,7 +1212,22 @@ int CSearchFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) #else m_barSearch.Create( this, IDD_SEARCH, WS_CHILD|CBRS_TOP, 1 ); #endif - m_barStatus.Create( this, FALSE, FALSE ); + m_barStatus.Create( this, FALSE, FALSE, TRUE ); + + //set initial online status + int idx = m_barStatus.CommandToIndex(IDS_ONLINE_STATUS); + if (idx > -1) + { + UINT nID = IDS_ONLINE_STATUS; + UINT nStyle; + int nWidth; + m_barStatus.GetPaneInfo( idx, nID, nStyle, nWidth ); + if (!NET_IsOffline()) + m_barStatus.SetPaneInfo(idx, IDS_ONLINE_STATUS, SBPS_NORMAL, nWidth); + else + m_barStatus.SetPaneInfo(idx, IDS_ONLINE_STATUS, SBPS_DISABLED, nWidth); + } + m_barAction.Create( this, IDD_MSGSRCHACTION, WS_CHILD|CBRS_BOTTOM, 2); RecalcLayout( ); @@ -1202,14 +1258,13 @@ int CSearchFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) m_barSearch.m_iOrigFrameHeight = m_iOrigFrameHeight = m_iHeight; m_barSearch.m_searchObj.SetOrigFrameHeight(m_barSearch.m_iOrigFrameHeight); - OnNew(); - + OnNew(); #ifndef _WIN32 SendMessageToDescendants(WM_IDLEUPDATECMDUI, (WPARAM)TRUE, (LPARAM)0); #endif - return res; + return res; } void CSearchFrame::OnSize( UINT nType, int cx, int cy ) @@ -1232,6 +1287,11 @@ void CSearchFrame::OnDestroy() } } +void CSearchFrame::OnSetFocus(CWnd *pOldWnd) +{ + m_barSearch.m_searchObj.RestoreDefaultFocus(); +} + void CSearchFrame::OnUpdateDeleteMessage(CCmdUI* pCmdUI) { pCmdUI->Enable(TRUE); @@ -1245,7 +1305,7 @@ void CSearchFrame::OnDeleteMessage() int count = 0; m_pOutliner->GetSelection(indices, count); - MSG_Command(m_pSearchPane, MSG_DeleteMessage, indices, count); + MSG_Command(m_pSearchPane, MSG_DeleteMessage, indices, count); ModalStatusEnd(); } @@ -1258,34 +1318,26 @@ void CSearchFrame::ModalStatusBegin( int iModalDelay ) void CSearchFrame::ModalStatusEnd() { - } - LONG CSearchFrame::OnFinishedHeaders(WPARAM wParam, LPARAM lParam ) { MSG_Master *master = WFE_MSGGetMaster(); - CComboBox *pCombo = (CComboBox *) m_barSearch.m_searchObj.GetColumnOneAttributeWidget(m_iRowSelected); - if (lParam == IDOK ) - { + if(lParam == IDOK) m_barSearch.m_searchObj.UpdateColumn1Attributes(); - } - else - { - pCombo->SetCurSel(0); - } MSG_ReleaseEditHeadersSemaphore(master, this); - m_pCustomHeadersDlg = NULL; return 0; } - LONG CSearchFrame::OnFinishedAdvanced(WPARAM wParam, LPARAM lParam ) { - m_barSearch.UpdateAttribList(); - m_barSearch.UpdateOpList(); - m_barSearch.m_searchObj.ReInitializeWidgets(); - m_pAdvancedOptionsDlg = NULL; + if(lParam == IDOK) + { + m_barSearch.UpdateAttribList(); + m_barSearch.UpdateOpList(); + //m_barSearch.m_searchObj.ReInitializeWidgets(); + } + return 0; } @@ -1312,10 +1364,33 @@ void CSearchFrame::OnAndOr() void CSearchFrame::OnAdvanced() { - m_pAdvancedOptionsDlg = new CAdvSearchOptionsDlg(this); - if(m_pAdvancedOptionsDlg) - m_pAdvancedOptionsDlg->ShowWindow(SW_SHOW); + MSG_Master *master = WFE_MSGGetMaster(); + //find out if we are the only ones trying to edit headers. + if (master) + { + if (!MSG_AcquireEditHeadersSemaphore(master, this)) + { + ::MessageBox(FEU_GetLastActiveFrame()->GetSafeHwnd(), + szLoadString(IDS_EDIT_HEADER_IN_USE), + szLoadString(IDS_CUSTOM_HEADER_ERROR), + MB_OK|MB_ICONSTOP); + return; + //We can't edit anything since another window already has the semaphore. + } + } + else + { //Something is hosed! + return; + } + CString title; + title.LoadString(IDS_ADVSEARCH_PROPERTY_SHEET); + + // it will delete itself in OnNcDestroy. This is a way to have two "modal" dialogs + CAdvancedOptionsPropertySheet * paops = new CAdvancedOptionsPropertySheet(this, title, AOP_SEARCH_OPTIONS | AOP_CUSTOM_HEADERS); + assert(paops != NULL); + if(paops != NULL) + paops->Create(this); } void CSearchFrame::OnUpdateAdvanced( CCmdUI *pCmdUI) @@ -1364,7 +1439,12 @@ void CSearchFrame::OnNew() m_pOutliner->SelectItem(0); int dy = m_barSearch.ClearSearch(m_bIsLDAPSearch); - + CComboBox * pCombo = (CComboBox *)m_barSearch.GetDlgItem(IDC_COMBO_ATTRIB1); + if(pCombo != NULL) + { + pCombo->SetCurSel(0); + OnAttrib1(); + } AdjustHeight(dy); @@ -1443,26 +1523,26 @@ void CSearchFrame::OnFind() } } -void CSearchFrame::OnUpdateFind( CCmdUI *pCmdUI ) +void CSearchFrame::OnUpdateFind(CCmdUI *pCmdUI) { CString cs; - if ( m_bSearching || CanAllInterrupt()) { - cs.LoadString( IDS_STOP ); - } else { - cs.LoadString( IDS_SEARCH ); - } + BOOL bStopButton = FALSE; - pCmdUI->SetText( cs ); + if(m_bSearching || CanAllInterrupt()) + { + cs.LoadString( IDS_STOP ); + bStopButton = TRUE; + } + else + cs.LoadString( IDS_SEARCH ); + + pCmdUI->SetText(cs); + pCmdUI->Enable(bStopButton ? TRUE : readyToSearch()); } void CSearchFrame::OnUpdateAndOr(CCmdUI *pCmdUI) { - - if ( m_bSearching || CanAllInterrupt()) { - pCmdUI->Enable(FALSE); - }else { - pCmdUI->Enable(TRUE); - } + //pCmdUI->Enable(!(m_bSearching || CanAllInterrupt()) && m_barSearch.GetDlgItem(IDC_COMBO_ATTRIB2)->IsWindowVisible()); } void CSearchFrame::OnTo() @@ -1504,7 +1584,16 @@ void CSearchFrame::OnUpdateTo( CCmdUI *pCmdUI ) void CSearchFrame::OnUpdateQuery( CCmdUI *pCmdUI ) { - pCmdUI->Enable( !m_bSearching ); + pCmdUI->Enable(!m_bSearching); +} + +void CSearchFrame::OnUpdateClearSearch(CCmdUI *pCmdUI) +{ + BOOL b = FALSE; + CComboBox * pCombo = (CComboBox *)m_barSearch.GetDlgItem(IDC_COMBO_ATTRIB2); + if(pCombo != NULL) + b = pCombo->IsWindowVisible(); + pCmdUI->Enable(!m_bSearching && (b || readyToSearch() || m_bResultsShowing)); } void CSearchFrame::OnScope() @@ -1513,77 +1602,136 @@ void CSearchFrame::OnScope() m_barSearch.UpdateOpList(); } +BOOL CSearchFrame::readyToSearch() +{ + BOOL bRet = FALSE; + BOOL b1 = FALSE; + BOOL b2 = FALSE; + BOOL b3 = FALSE; + BOOL b4 = FALSE; + BOOL b5 = FALSE; + char szString[256]; + CEdit * pEdit = NULL; + CComboBox * pCombo = NULL; + DWORD dwAttrib; + + pCombo = (CComboBox *)m_barSearch.GetDlgItem(IDC_COMBO_ATTRIB1); + if(pCombo != NULL) + { + dwAttrib = pCombo->GetItemData(pCombo->GetCurSel()); + if(pCombo->IsWindowVisible() && ((dwAttrib == attribDate)||(dwAttrib == attribPriority)||(dwAttrib == attribMsgStatus))) + b1 = TRUE; + else + { + pEdit = (CEdit *)m_barSearch.GetDlgItem(IDC_EDIT_VALUE1); + if(pEdit != NULL) + { + pEdit->GetWindowText(szString, sizeof(szString)); + b1 = ((strlen(szString) > 0) && pEdit->IsWindowVisible()); + } + } + } + + pCombo = (CComboBox *)m_barSearch.GetDlgItem(IDC_COMBO_ATTRIB2); + if(pCombo != NULL) + { + dwAttrib = pCombo->GetItemData(pCombo->GetCurSel()); + if(pCombo->IsWindowVisible() && ((dwAttrib == attribDate)||(dwAttrib == attribPriority)||(dwAttrib == attribMsgStatus))) + b2 = TRUE; + else + { + pEdit = (CEdit *)m_barSearch.GetDlgItem(IDC_EDIT_VALUE2); + if(pEdit != NULL) + { + pEdit->GetWindowText(szString, sizeof(szString)); + b2 = ((strlen(szString) > 0) && pEdit->IsWindowVisible()); + } + } + } + + pCombo = (CComboBox *)m_barSearch.GetDlgItem(IDC_COMBO_ATTRIB3); + if(pCombo != NULL) + { + dwAttrib = pCombo->GetItemData(pCombo->GetCurSel()); + if(pCombo->IsWindowVisible() && ((dwAttrib == attribDate)||(dwAttrib == attribPriority)||(dwAttrib == attribMsgStatus))) + b3 = TRUE; + else + { + pEdit = (CEdit *)m_barSearch.GetDlgItem(IDC_EDIT_VALUE3); + if(pEdit != NULL) + { + pEdit->GetWindowText(szString, sizeof(szString)); + b3 = ((strlen(szString) > 0) && pEdit->IsWindowVisible()); + } + } + } + + pCombo = (CComboBox *)m_barSearch.GetDlgItem(IDC_COMBO_ATTRIB4); + if(pCombo != NULL) + { + dwAttrib = pCombo->GetItemData(pCombo->GetCurSel()); + if(pCombo->IsWindowVisible() && ((dwAttrib == attribDate)||(dwAttrib == attribPriority)||(dwAttrib == attribMsgStatus))) + b4 = TRUE; + else + { + pEdit = (CEdit *)m_barSearch.GetDlgItem(IDC_EDIT_VALUE4); + if(pEdit != NULL) + { + pEdit->GetWindowText(szString, sizeof(szString)); + b4 = ((strlen(szString) > 0) && pEdit->IsWindowVisible()); + } + } + } + + pCombo = (CComboBox *)m_barSearch.GetDlgItem(IDC_COMBO_ATTRIB5); + if(pCombo != NULL) + { + dwAttrib = pCombo->GetItemData(pCombo->GetCurSel()); + if(pCombo->IsWindowVisible() && ((dwAttrib == attribDate)||(dwAttrib == attribPriority)||(dwAttrib == attribMsgStatus))) + b5 = TRUE; + else + { + pEdit = (CEdit *)m_barSearch.GetDlgItem(IDC_EDIT_VALUE5); + if(pEdit != NULL) + { + pEdit->GetWindowText(szString, sizeof(szString)); + b5 = ((strlen(szString) > 0) && pEdit->IsWindowVisible()); + } + } + } + + bRet = b1 || b2 || b3 || b4 || b5; + return bRet; +} + void CSearchFrame::OnAttrib1() { - EditHeader(0); m_barSearch.UpdateOpList(); - } void CSearchFrame::OnAttrib2() { - EditHeader(1); m_barSearch.UpdateOpList(); } void CSearchFrame::OnAttrib3() { - EditHeader(2); m_barSearch.UpdateOpList(); } void CSearchFrame::OnAttrib4() { - EditHeader(3); m_barSearch.UpdateOpList(); } void CSearchFrame::OnAttrib5() { - EditHeader(4); m_barSearch.UpdateOpList(); } - -void CSearchFrame::EditHeader(int iRow) +void CSearchFrame::OnUpdateOnlineStatus(CCmdUI *pCmdUI) { - //We are being asked to modify custom headers - CComboBox *combo; - int iCurSel; - MSG_SearchAttribute attrib; - m_iRowSelected = iRow; - combo = (CComboBox *) m_barSearch.m_searchObj.GetColumnOneAttributeWidget(iRow); - iCurSel = combo->GetCurSel(); - attrib = (MSG_SearchAttribute) combo->GetItemData(iCurSel); - - if (attrib == -1) - { - MSG_Master *master = WFE_MSGGetMaster(); - //find out if we are the only ones trying to edit headers. - if (master) - { - if (!MSG_AcquireEditHeadersSemaphore(master, this)) - { - ::MessageBox(FEU_GetLastActiveFrame()->GetSafeHwnd(), - szLoadString(IDS_EDIT_HEADER_IN_USE), - szLoadString(IDS_CUSTOM_HEADER_ERROR), - MB_OK|MB_ICONSTOP); - combo->SetCurSel(0); - return; - //We can't edit anything since another window already has the semaphore. - } - } - else - { //Something is hosed! - return; - } - - m_pCustomHeadersDlg = new CCustomHeadersDlg(this); - if (m_pCustomHeadersDlg) - { - m_pCustomHeadersDlg->ShowWindow(SW_SHOW); - } - } + pCmdUI->Enable(!NET_IsOffline()); } ////////////////////////////////////////////////////////////////////////////// @@ -1619,9 +1767,55 @@ CSearchOutliner::~CSearchOutliner ( ) BEGIN_MESSAGE_MAP(CSearchOutliner, CMSelectOutliner ) //{{AFX_MSG_MAP(CSearchOutliner) ON_WM_CREATE() + ON_WM_KEYDOWN() + ON_WM_CHAR() + ON_WM_SETFOCUS() //}}AFX_MSG_MAP END_MESSAGE_MAP() +void CSearchOutliner::OnSetFocus(CWnd* pOldWnd) +{ + CMSelectOutliner::OnSetFocus(pOldWnd); + int iTotal = GetTotalLines(); + MSG_ViewIndex * indices = NULL; + int iSelected = 0; + GetSelection(indices, iSelected); + if((iSelected == 0) && (iTotal > 0)) + SelectItem(0); +} + +void CSearchOutliner::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +{ + if(nChar == VK_DELETE) + { + BOOL bShiftPressed = (GetKeyState(VK_SHIFT) < 0); + deleteMessages(bShiftPressed); + return; + } + + CMSelectOutliner::OnKeyDown(nChar, nRepCnt, nFlags); +} + +void CSearchOutliner::deleteMessages(BOOL bNoTrash) +{ + MSG_ViewIndex *indices = NULL; + int count = 0; + GetSelection(indices, count); + MSG_Command(m_pSearchPane, bNoTrash ? MSG_DeleteMessageNoTrash : MSG_DeleteMessage, indices, count); +} + +void CSearchOutliner::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +{ + if(nChar == 1) // CTRL/A -- select all + { + int iTotalLines = GetTotalLines(); + if(iTotalLines > 0) + SelectRange(0, iTotalLines - 1, TRUE); + } + + CMSelectOutliner::OnChar(nChar, nRepCnt, nFlags); +} + int CSearchOutliner::OnCreate ( LPCREATESTRUCT lpCreateStruct ) { int iRetVal = COutliner::OnCreate ( lpCreateStruct ); @@ -1708,7 +1902,6 @@ COleDataSource * CSearchOutliner::GetDataSource(void) URL_Struct *url = MSG_ConstructUrlForMessage( m_pSearchPane, key ); if ( url ) { - RDFGLOBAL_DragTitleAndURL( pDataSource, value->u.string, url->address ); NET_FreeURLStruct( url ); } } @@ -1716,7 +1909,6 @@ COleDataSource * CSearchOutliner::GetDataSource(void) return pDataSource; } - BOOL CSearchOutliner::DeleteItem ( int iLine ) { #ifndef DEBUG_phil @@ -1929,7 +2121,6 @@ void CSearchOutliner::MysticStuffFinishing( XP_Bool asynchronous, } } - ///////////////////////////////////////////////////////////////////////////// // CSearchOutlinerParent @@ -2028,6 +2219,8 @@ void CSearchFrame::Close() } } +#if 0 // MW fix + ///////////////////////////////////////////////////////////////////////////// // CLDAPSearchFrame @@ -2481,6 +2674,8 @@ void CLDAPSearchFrame::Close() } } +#endif + void WFE_MSGOpenSearch() { CSearchFrame::Open(); @@ -2491,6 +2686,7 @@ void WFE_MSGSearchClose() CSearchFrame::Close(); } +#if 0 //MW fix void WFE_MSGOpenLDAPSearch() { CLDAPSearchFrame::Open(); @@ -2500,3 +2696,5 @@ void WFE_MSGLDAPSearchClose() { CLDAPSearchFrame::Close(); } +#endif + diff --git a/mozilla/cmd/winfe/srchfrm.h b/mozilla/cmd/winfe/srchfrm.h index 15b2b7879b3..1b33d8208c1 100755 --- a/mozilla/cmd/winfe/srchfrm.h +++ b/mozilla/cmd/winfe/srchfrm.h @@ -95,8 +95,6 @@ public: class CSearchOutliner; class IMsgList; -class CAdvSearchOptionsDlg; -class CCustomHeadersDlg; class CMailQFButton; class CSearchFrame : public CFrameWnd, public CStubsCX @@ -109,9 +107,6 @@ public: protected: CSearchBar m_barSearch; CDialogBar m_barAction; - CAdvSearchOptionsDlg *m_pAdvancedOptionsDlg; - CCustomHeadersDlg *m_pCustomHeadersDlg; - XP_List *m_listSearch; XP_List *m_listResult; @@ -190,8 +185,8 @@ protected: BOOL PreTranslateMessage( MSG* pMsg ); void AdjustHeight(int dy); - void EditHeader(int iRow); //Brings up Modeless dialog to edit headers. + afx_msg void OnSetFocus(CWnd * pOldWnd); afx_msg int OnCreate(LPCREATESTRUCT); afx_msg void OnClose(); afx_msg void OnDestroy(); @@ -212,17 +207,22 @@ protected: afx_msg void OnUpdateSave( CCmdUI *pCmdUI ); afx_msg void OnUpdateHelp( CCmdUI *pCmdUI ); afx_msg void OnNew(); + afx_msg void OnUpdateClearSearch(CCmdUI *pCmdUI); afx_msg void OnAdvanced(); afx_msg void OnUpdateAdvanced(CCmdUI *pCmdUI ); - afx_msg void OnAttrib1(); + afx_msg void OnAttrib1(); afx_msg void OnAttrib2(); afx_msg void OnAttrib3(); afx_msg void OnAttrib4(); afx_msg void OnAttrib5(); - afx_msg void OnAndOr(); + + BOOL readyToSearch(); + + afx_msg void OnAndOr(); afx_msg void OnUpdateAndOr(CCmdUI *pCmdUI ); - afx_msg void OnFileButton(); + afx_msg void OnFileButton(); afx_msg void OnUpdateFileButton(CCmdUI *pCmdUI ); + afx_msg void OnUpdateDeleteButton(CCmdUI *pCmdUI ); afx_msg LONG OnFinishedAdvanced( WPARAM wParam, LPARAM lParam ); afx_msg LONG OnFinishedHeaders(WPARAM wParam, LPARAM lParam ); @@ -233,6 +233,7 @@ protected: afx_msg void OnUpdateFile( CCmdUI *pCmdUI ); afx_msg void OnOpenMessage(); afx_msg void OnUpdateOpenMessage(CCmdUI *pCmdUI); + afx_msg void OnUpdateOnlineStatus(CCmdUI *pCmdUI); DECLARE_MESSAGE_MAP() @@ -300,7 +301,12 @@ public: CLIPFORMAT *GetClipFormatList(void); virtual COleDataSource * GetDataSource(void); - afx_msg int OnCreate ( LPCREATESTRUCT ); + void deleteMessages(BOOL bNoTrash); + + afx_msg int OnCreate(LPCREATESTRUCT); + afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); + afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); + afx_msg void OnSetFocus(CWnd* pOldWnd); DECLARE_MESSAGE_MAP() }; @@ -329,6 +335,8 @@ public: } }; +#if 0 + ///////////////////////////////////////////////////////////////////////////// // CLDAPSearchFrame @@ -409,5 +417,6 @@ public: }; //////////////////////////////////////////////////////////////////////////// +#endif #endif diff --git a/mozilla/cmd/winfe/srchobj.cpp b/mozilla/cmd/winfe/srchobj.cpp index 4760729093f..43138c1399b 100644 --- a/mozilla/cmd/winfe/srchobj.cpp +++ b/mozilla/cmd/winfe/srchobj.cpp @@ -585,14 +585,15 @@ int CSearchObject::More(int* moreCount, BOOL bLogicType) for (int i = 0; i < COL_COUNT; i++) { nID = ChoicesTable[(*moreCount)][i]; widget = m_wnd->GetDlgItem(nID); + if(widget == NULL) continue; if (i == 3 && bLogicType) { - strLogicText.LoadString(IDS_ORTHE); + strLogicText.LoadString(IDS_ANDTHE); widget->SetWindowText(strLogicText); } else if ( i==3 && !bLogicType) { //jump to another set up resource id's - strLogicText.LoadString(IDS_ANDTHE); + strLogicText.LoadString(IDS_ORTHE); widget->SetWindowText(strLogicText); } widget->ShowWindow(SW_SHOW); @@ -623,13 +624,7 @@ int CSearchObject::More(int* moreCount, BOOL bLogicType) void CSearchObject::OnAndOr(int iMoreCount, BOOL* bLogicType) { - CComboBox *combo; - int iCurSel = 0; - - combo = (CComboBox *) m_wnd->GetDlgItem( IDC_COMBO_AND_OR ); - if (!combo) return; - iCurSel = combo->GetCurSel(); - *bLogicType = (iCurSel == 0 ? 0 : 1); + *bLogicType = m_wnd->IsDlgButtonChecked(IDC_RADIO_ALL); ChangeLogicText(iMoreCount, *bLogicType); } @@ -646,13 +641,13 @@ int CSearchObject::ChangeLogicText(int iMoreCount, BOOL bLogicType) widget = m_wnd->GetDlgItem(ChoicesTable[Row][3]); if (!widget) return 0; if (bLogicType) - { //Display OR logic text - strLogicText.LoadString(IDS_ORTHE); + { //Display AND logic text + strLogicText.LoadString(IDS_ANDTHE); widget->SetWindowText(strLogicText); } else - { //Display AND logic text - strLogicText.LoadString(IDS_ANDTHE); + { //Display OR logic text + strLogicText.LoadString(IDS_ORTHE); widget->SetWindowText(strLogicText); } widget->ShowWindow(SW_SHOW); @@ -671,6 +666,7 @@ int CSearchObject::Fewer(int* iMoreCount, BOOL bLogicTyp) if (*iMoreCount > 0) { for (int i = 0; i < COL_COUNT; i++) { widget = m_wnd->GetDlgItem(ChoicesTable[*iMoreCount][i]); + if(widget == NULL) continue; widget->ShowWindow(SW_HIDE); } (*iMoreCount)--; @@ -823,7 +819,7 @@ void CSearchObject::BuildQuery (MSG_Pane* searchPane, int iMoreCount, BOOL bLogi break; } - MSG_AddSearchTerm(searchPane, attrib, op, &value, !bLogicType, + MSG_AddSearchTerm(searchPane, attrib, op, &value, bLogicType, (attrib != attribOtherHeader ? NULL : szArbitraryHeader) ); if (freeValueStr) @@ -863,17 +859,12 @@ int CSearchObject::New(CWnd* window) for (int j = 1; j < 5; j++) { for (int i = 0; i < COL_COUNT; i++) { widget = m_wnd->GetDlgItem(ChoicesTable[j][i]); - ASSERT(widget); + if(widget == NULL) continue; widget->ShowWindow(SW_HIDE); } } - CComboBox *comboAndOr = (CComboBox*) m_wnd->GetDlgItem(IDC_COMBO_AND_OR); - if (comboAndOr) - { //Default to AND logic for display in the combobox - comboAndOr->SetCurSel(0); - } - + m_wnd->CheckRadioButton(IDC_RADIO_ANY, IDC_RADIO_ALL, IDC_RADIO_ANY); // Move more and fewer and disable fewer widget = m_wnd->GetDlgItem(IDC_FEWER); @@ -922,7 +913,15 @@ void CSearchObject::ReInitializeWidgets() widget = m_wnd->GetDlgItem( ChoicesTable[0][COL_VALUE] ); widget->SetFocus(); +} +void CSearchObject::RestoreDefaultFocus() +{ + if(m_wnd == NULL) + return; + CWnd * widget = m_wnd->GetDlgItem( ChoicesTable[0][COL_VALUE] ); + if(widget != NULL) + widget->SetFocus(); } void CSearchObject::UpdateColumn1Attributes() diff --git a/mozilla/cmd/winfe/srchobj.h b/mozilla/cmd/winfe/srchobj.h index 395d7cc4dc2..1166597adc8 100644 --- a/mozilla/cmd/winfe/srchobj.h +++ b/mozilla/cmd/winfe/srchobj.h @@ -58,6 +58,7 @@ public: void BuildQuery (MSG_Pane* searchPane, int iMoreCount, Bool bLogicType); int New (CWnd* window); void ReInitializeWidgets (); + void RestoreDefaultFocus(); void OnSize( UINT nType, int cx, int cy, int dx); void InitializeAttributes (MSG_SearchValueWidget widgetValue, MSG_SearchAttribute attribValue); void UpdateColumn1Attributes(); diff --git a/mozilla/cmd/winfe/statbar.cpp b/mozilla/cmd/winfe/statbar.cpp index b9468fa9d44..a25428606cc 100755 --- a/mozilla/cmd/winfe/statbar.cpp +++ b/mozilla/cmd/winfe/statbar.cpp @@ -31,6 +31,8 @@ /** INCLUDE **/ #include "stdafx.h" + +#include "rosetta.h" #include "statbar.h" #include "ssl.h" #include "tooltip.h" @@ -67,9 +69,12 @@ static const int nSEC_KEY_WIDTH = 34; // status bar format static const UINT BASED_CODE pPaneIndicators[] = { - IDS_SECURITY_STATUS, + HG21326 IDS_TRANSFER_STATUS, ID_SEPARATOR +#ifdef MOZ_OFFLINE + ,IDS_ONLINE_STATUS +#endif //MOZ_OFFLINE #ifdef MOZ_TASKBAR ,IDS_TASKBAR #endif /* MOZ_TASKBAR */ @@ -95,6 +100,13 @@ HBITMAP CNetscapeStatusBar::sm_hbmpSecure = NULL; SIZE CNetscapeStatusBar::sm_sizeSecure = {0,0}; int CNetscapeStatusBar::sm_iRefCount = 0; +#ifdef MOZ_OFFLINE +HBITMAP CNetscapeStatusBar::sm_hbmpOnline = NULL; +SIZE CNetscapeStatusBar::sm_sizeOnline = {0, 0}; +int CNetscapeStatusBar::sm_iOnlineRefCount = 0; + +CPtrArray CNetscapeStatusBar::gStatusBars; +#endif //MOZ_OFFLINE //------------------------------------------------------------------------------ CNetscapeStatusBar::CNetscapeStatusBar() { @@ -119,16 +131,20 @@ CNetscapeStatusBar::CNetscapeStatusBar() m_pProxy2Frame = NULL; - if( !sm_hbmpSecure ) + HG22121 + sm_iRefCount++; +#ifdef MOZ_OFFLINE + if( !sm_hbmpOnline ) { - VERIFY( sm_hbmpSecure = ::LoadBitmap( AfxGetResourceHandle(), MAKEINTRESOURCE( IDB_SECURE_STATUS ) )); + VERIFY( sm_hbmpOnline = ::LoadBitmap( AfxGetResourceHandle(), MAKEINTRESOURCE( IDB_OFFLINE_STATUS ) )); BITMAP bm; - ::GetObject( sm_hbmpSecure, sizeof(bm), &bm ); - sm_sizeSecure.cx = bm.bmWidth / 3; - sm_sizeSecure.cy = bm.bmHeight; + ::GetObject( sm_hbmpOnline, sizeof(bm), &bm ); + sm_sizeOnline.cx = bm.bmWidth / 2; + sm_sizeOnline.cy = bm.bmHeight; } - sm_iRefCount++; + sm_iOnlineRefCount++; +#endif //MOZ_OFFLINE } //------------------------------------------------------------------------------ @@ -144,16 +160,74 @@ CNetscapeStatusBar::~CNetscapeStatusBar() delete [] m_anIDSaved; if (!--sm_iRefCount) { - VERIFY(::DeleteObject(sm_hbmpSecure)); + HG28363 sm_hbmpSecure = NULL; } + +#ifdef MOZ_OFFLINE + if (!--sm_iOnlineRefCount) { + VERIFY(::DeleteObject(sm_hbmpOnline)); + sm_hbmpOnline = NULL; + } +#endif //MOZ_OFFLINE } //------------------------------------------------------------------------------ -BOOL CNetscapeStatusBar::Create( CWnd *pParent, BOOL bSecurityStatus /*=TRUE*/, BOOL bTaskbar /*=TRUE*/ ) +#ifdef MOZ_OFFLINE +BOOL CNetscapeStatusBar::Create( CWnd *pParent, BOOL bxxx /*=TRUE*/, BOOL bTaskbar /*=TRUE*/, + BOOL bOnlineStatus /*TRUE*/) { m_bTaskbar = bTaskbar; - m_bSecurityStatus = bSecurityStatus; + HG26545 + m_bOnlineStatus = bOnlineStatus; + + if( !CNetscapeStatusBarBase::Create( pParent ) ) + return FALSE; + + if( m_bSecurityStatus || m_bOnlineStatus) + { + m_pTooltip = new CNSToolTip2; + if( !m_pTooltip ) + { + return FALSE; + } + + m_pTooltip->Create( this ); + HG12421 + + if(m_bOnlineStatus) + { + m_pTooltip->AddTool(this, IDS_STATBAR_ONLINE, CRect(0,0,0,0), IDS_ONLINE_STATUS); + } + } + + if (!CreateDefaultPanes()) + return FALSE; + + pParentSubclass = new CNetscapeStatusBar::CParentSubclass( pParent, this ); + ASSERT( pParentSubclass ); + +#ifdef MOZ_TASKBAR + if( m_bTaskbar ) + { + // + // Tell the Task Bar manager about us so it can be docked on our status bar. + // + ((CNetscapeApp *)AfxGetApp())->GetTaskBarMgr().RegisterStatusBar( this ); + SaveModeState(); + } +#endif /* MOZ_TASKBAR*/ + + // add to status bar array + gStatusBars.Add(m_hWnd); + return TRUE; +} +#else //MOZ_OFFLINE +BOOL CNetscapeStatusBar::Create( CWnd *pParent, BOOL bxxx /*=TRUE*/, BOOL bTaskbar /*=TRUE*/ ) + +{ + m_bTaskbar = bTaskbar; + m_bSecurityStatus = bxxx; if( !CNetscapeStatusBarBase::Create( pParent ) ) return FALSE; @@ -167,8 +241,7 @@ BOOL CNetscapeStatusBar::Create( CWnd *pParent, BOOL bSecurityStatus /*=TRUE*/, } m_pTooltip->Create( this ); - m_pTooltip->AddTool( this, IDS_STATBAR_SECURITY, CRect(0,0,0,0), IDS_SECURITY_STATUS ); - m_pTooltip->AddTool( this, IDS_STATBAR_SECURITY, CRect(0,0,0,0), IDS_SIGNED_STATUS ); + HG17231 } if (!CreateDefaultPanes()) @@ -190,6 +263,7 @@ BOOL CNetscapeStatusBar::Create( CWnd *pParent, BOOL bSecurityStatus /*=TRUE*/, return TRUE; } +#endif //MOZ_OFFLINE #ifdef _WIN32 //------------------------------------------------------------------------------ @@ -346,33 +420,32 @@ void CNetscapeStatusBar::SetupMode() RECT rcTool; - int idx = CommandToIndex(IDS_SECURITY_STATUS); - if (idx > -1) { - SetPaneInfo(idx, IDS_SECURITY_STATUS, SBPS_DISABLED, sm_sizeSecure.cx - iFudge); - - if (m_pTooltip) { - GetItemRect(idx, &rcTool); - m_pTooltip->SetToolRect(this, IDS_SECURITY_STATUS, &rcTool); - } - } - idx = CommandToIndex(IDS_SIGNED_STATUS); - if (idx > -1) { - SetPaneInfo(idx, IDS_SIGNED_STATUS, SBPS_DISABLED, sm_sizeSecure.cx - iFudge); - - if (m_pTooltip) { - GetItemRect(idx, &rcTool); - m_pTooltip->SetToolRect(this, IDS_SIGNED_STATUS, &rcTool); - } - } + HG26576 + // // Set common pane info (size, style, etc). // WHS -- I'm assuming we'll always have these, probably not good in the long term // - SetPaneInfo( CommandToIndex( ID_SEPARATOR ), ID_SEPARATOR, SBPS_STRETCH, 0 ); - SetPaneInfo( CommandToIndex( IDS_TRANSFER_STATUS ), IDS_TRANSFER_STATUS, SBPS_NORMAL, 90 ); - + + + idx = CommandToIndex(IDS_TRANSFER_STATUS); + if(idx > -1) { + SetPaneInfo( idx, IDS_TRANSFER_STATUS, SBPS_NORMAL, 90 ); + } +#ifdef MOZ_OFFLINE + idx = CommandToIndex(IDS_ONLINE_STATUS); + if (idx > -1) { + SetPaneInfo(idx, IDS_ONLINE_STATUS, SBPS_DISABLED, sm_sizeOnline.cx - iFudge); + + if (m_pTooltip) { + GetItemRect(idx, &rcTool); + m_pTooltip->SetToolRect(this, IDS_ONLINE_STATUS, &rcTool); + } + } +#endif + // Note the taskbar mgr sets the width of the taskbar pane // Also note we must call these SetPaneXXX methods even if m_bTaskbar is FALSE because // pPaneIndicators specifies the IDS_TASKBAR. If we don't, the default CStatusBar @@ -545,6 +618,22 @@ void CNetscapeStatusBar::SetPercentDone(const int32 nPercent) //------------------------------------------------------------------------------ void CNetscapeStatusBar::OnDestroy() { +#ifdef MOZ_OFFLINE + //remove the status bar; + + int count = gStatusBars.GetSize(); + + for(int i = 0; i < count; i++) + { + HWND hWnd = (HWND)gStatusBars.GetAt(i); + if(hWnd == m_hWnd) + { + gStatusBars.RemoveAt(i); + break; + } + + } +#endif //MOZ_OFFLINE #ifdef MOZ_TASKBAR if( m_bTaskbar ) { @@ -609,20 +698,17 @@ void CNetscapeStatusBar::OnSize( UINT nType, int cx, int cy ) #endif /* MOZ_TASKBAR */ RECT rcTool; - int idx = CommandToIndex(IDS_SECURITY_STATUS); + HG26522 +#ifdef MOZ_OFFLINE + idx = CommandToIndex(IDS_ONLINE_STATUS); if (idx > -1) { if (m_pTooltip) { GetItemRect(idx, &rcTool); - m_pTooltip->SetToolRect(this, IDS_SECURITY_STATUS, &rcTool); - } - } - idx = CommandToIndex(IDS_SIGNED_STATUS); - if (idx > -1) { - if (m_pTooltip) { - GetItemRect(idx, &rcTool); - m_pTooltip->SetToolRect(this, IDS_SIGNED_STATUS, &rcTool); + m_pTooltip->SetToolRect(this, IDS_ONLINE_STATUS, &rcTool); } } +#endif + } } @@ -659,6 +745,9 @@ void CNetscapeStatusBar::OnPaint() DrawSecureStatus(dc.m_hDC); DrawSignedStatus(dc.m_hDC); +#ifdef MOZ_OFFLINE + DrawOnlineStatus(dc.m_hDC); +#endif //MOZ_OFFLINE DrawProgressBar(); } @@ -681,6 +770,7 @@ void CNetscapeStatusBar::DrawSecureStatus(HDC hdc) if (idx < 0) return; + HG87236 UINT nID, nStyle; int cxWidth; GetPaneInfo(idx, nID, nStyle, cxWidth); @@ -705,6 +795,7 @@ void CNetscapeStatusBar::DrawSignedStatus(HDC hdc) if (idx < 0) return; + HG17236 UINT nID, nStyle; int cxWidth; GetPaneInfo(idx, nID, nStyle, cxWidth); @@ -725,6 +816,32 @@ void CNetscapeStatusBar::DrawSignedStatus(HDC hdc) } } +#ifdef MOZ_OFFLINE +//------------------------------------------------------------------------------ +void CNetscapeStatusBar::DrawOnlineStatus(HDC hdc) +{ + int idx = CommandToIndex( IDS_ONLINE_STATUS ); + if (idx < 0) + return; + + UINT nID, nStyle; + int cxWidth; + GetPaneInfo(idx, nID, nStyle, cxWidth); + //BOOL bOnline = !(nStyle & SBPS_DISABLED); + BOOL bOnline = !NET_IsOffline(); + + RECT rect; + GetItemRect( idx, &rect ); + + HDC hdcBitmap = ::CreateCompatibleDC( hdc ); + HBITMAP hbmOld = (HBITMAP)::SelectObject( hdcBitmap, sm_hbmpOnline ); + + FEU_TransBlt( hdc, rect.left+1, rect.top+1, sm_sizeOnline.cx, sm_sizeOnline.cy, hdcBitmap, bOnline ? sm_sizeOnline.cx : 0, 0,WFE_GetUIPalette(GetParentFrame()) ); + + ::SelectObject( hdcBitmap, hbmOld ); + VERIFY( ::DeleteDC( hdcBitmap )); +} +#endif //MOZ_OFFLINE //------------------------------------------------------------------------------ void CNetscapeStatusBar::DrawProgressBar() { diff --git a/mozilla/cmd/winfe/statbar.h b/mozilla/cmd/winfe/statbar.h index 5aa5e78a60b..35dab279281 100755 --- a/mozilla/cmd/winfe/statbar.h +++ b/mozilla/cmd/winfe/statbar.h @@ -65,8 +65,12 @@ class CNetscapeStatusBar : public CNetscapeStatusBarBase public: CNetscapeStatusBar(); ~CNetscapeStatusBar(); - BOOL Create( CWnd *pParent, BOOL bSecurityStatus = TRUE, BOOL bTaskbar = TRUE ); - +#ifdef MOZ_OFFLINE + BOOL Create( CWnd *pParent, BOOL bxxx = TRUE, BOOL bTaskbar = TRUE, + BOOL bOnline = TRUE); +#else //MOZ_OFFLINE + BOOL Create( CWnd *pParent, BOOL bxxx = TRUE, BOOL bTaskbar = TRUE ); +#endif //MOZ_OFFLINE BOOL SetIndicators( const UINT* lpIDArray, int nIDCount ); BOOL ResetPanes( EStatBarMode enStatBarMode, BOOL bForce = FALSE ); @@ -105,6 +109,9 @@ protected: void DrawProgressBar(); void DrawSecureStatus(HDC hdc); void DrawSignedStatus(HDC hdc); +#ifdef MOZ_OFFLINE + void DrawOnlineStatus(HDC hdc); +#endif // Pulsing vapor trails (aka Cylon) mode methods protected: @@ -148,7 +155,9 @@ private: public: CFrameGlue *m_pProxy2Frame; // Used while serving OLE container; mainly for JavaScript - +#ifdef MOZ_OFFLINE + static CPtrArray gStatusBars; +#endif protected: int32 m_nDone; // Percentage for progress @@ -160,7 +169,9 @@ protected: BOOL m_bTaskbar; BOOL m_bSecurityStatus; - + #ifdef MOZ_OFFLINE + BOOL m_bOnlineStatus; +#endif EStatBarMode m_enStatBarMode; CNetscapeStatusBar::CParentSubclass *pParentSubclass; @@ -171,6 +182,12 @@ protected: static SIZE sm_sizeSecure; static int sm_iRefCount; +#ifdef MOZ_OFFLINE + static HBITMAP sm_hbmpOnline; + static SIZE sm_sizeOnline; + static int sm_iOnlineRefCount; +#endif //MOZ_OFFLINE + // Mode state info for particular pane modes private: int m_iStatBarPaneWidth; // eSBM_Panes: save the width of the Taskbar pane diff --git a/mozilla/cmd/winfe/subnews.cpp b/mozilla/cmd/winfe/subnews.cpp index a5d671499b8..e42a695aeb5 100644 --- a/mozilla/cmd/winfe/subnews.cpp +++ b/mozilla/cmd/winfe/subnews.cpp @@ -61,7 +61,7 @@ extern "C" XP_Bool FE_CreateSubscribePaneOnHost(MSG_Master* master, while (pFrame) { if (pFrame->IsKindOf(RUNTIME_CLASS(C3PaneMailFrame))) { C3PaneMailFrame *pThreadFrame = DYNAMIC_DOWNCAST(C3PaneMailFrame, pFrame); - pThreadFrame->SendMessage(WM_COMMAND, ID_FILE_SUBSCRIBE, (LPARAM)host); + pThreadFrame->PostMessage(WM_COMMAND, ID_FILE_SUBSCRIBE, (LPARAM)host); return TRUE; } pFrame = pFrame->m_pNext; @@ -70,7 +70,7 @@ extern "C" XP_Bool FE_CreateSubscribePaneOnHost(MSG_Master* master, while (pFrame) { if (pFrame->IsKindOf(RUNTIME_CLASS(CFolderFrame))) { CFolderFrame *pFolderFrame = DYNAMIC_DOWNCAST(CFolderFrame, pFrame); - pFolderFrame->SendMessage(WM_COMMAND, ID_FILE_SUBSCRIBE, (LPARAM)host); + pFolderFrame->PostMessage(WM_COMMAND, ID_FILE_SUBSCRIBE, (LPARAM)host); return TRUE; } pFrame = pFrame->m_pNext; @@ -527,6 +527,16 @@ int CNewsgroupsOutliner::TranslateIcon(void * pLineData) { if (pGroup->flags & MSG_GROUPNAME_FLAG_NEW_GROUP) return IDX_NEWSNEW; + else if (pGroup->flags & MSG_GROUPNAME_FLAG_IMAP_PERSONAL ) + return IDX_MAILFOLDERCLOSED; + else if (pGroup->flags & MSG_GROUPNAME_FLAG_IMAP_PUBLIC ) + return IDX_PUBLICCLOSED; + else if (pGroup->flags & MSG_GROUPNAME_FLAG_IMAP_OTHER_USER ) + return IDX_SHARECLOSED; + else if (pGroup->flags & MSG_GROUPNAME_FLAG_IMAP_NOSELECT ) + return IDX_MAILFOLDERCLOSED; + else if (pGroup->flags & MSG_GROUPNAME_FLAG_PERSONAL_SHARED ) + return IDX_SHARECLOSED; else return IDX_NEWSGROUP; } @@ -822,6 +832,8 @@ DoFetchGroups(MSG_Pane* pane, void* closure) { CSubscribePropertySheet* tmp = (CSubscribePropertySheet*) closure; tmp->GetAllGroupPage()->OnGetDeletions(); + tmp->GetAllGroupPage()->EnableAllControls(FALSE); + tmp->GetAllGroupPage()->GetDlgItem(IDC_STOP)->EnableWindow(TRUE); } static void @@ -832,6 +844,7 @@ DoEnableAllControls(MSG_Pane* pane, void* closure) { tmp->GetAllGroupPage()->m_bProcessGetDeletion = FALSE; tmp->GetAllGroupPage()->EnableAllControls(TRUE); + tmp->GetAllGroupPage()->GetDlgItem(IDC_STOP)->EnableWindow(FALSE); } CNewsgroupsOutliner* pOutliner = tmp->GetAllGroupPage()->GetOutliner(); @@ -887,6 +900,7 @@ BOOL CSubscribePropertyPage::OnInitDialog() } if (m_pOutliner) m_pOutliner->SelectInitialItem(); + GetDlgItem(IDC_STOP)->EnableWindow(FALSE); return ret; } @@ -910,19 +924,40 @@ BOOL CSubscribePropertyPage::InitSubscribePage() { BOOL result = TRUE; + MSG_Host *pHost = ((CSubscribePropertySheet*)GetParent())->GetHost(); + if (pHost) + { + if (MSG_IsIMAPHost(pHost) && m_nMode != MSG_SubscribeAll) + DoEnableImapControls(); + else if (MSG_IsNewsHost(pHost)) + EnableAllControls(TRUE); + } + if (m_bInitDialog) { m_bInitDialog = FALSE; result = CreateSubscribePage(); + if (!pHost) + pHost = ((CSubscribePropertySheet*)GetParent())->GetHost(); } - if (result && GetPane() && - m_nMode != MSG_SubscribeGetMode(GetPane())) + + if (GetPane()) { - MSG_SubscribeSetMode(GetPane(), m_nMode); + MSG_Host* pSubscribingHost = MSG_SubscribeGetHost(GetPane()); + if (m_nMode == MSG_SubscribeAll && pSubscribingHost != pHost) + { + MSG_SubscribeSetHost(GetPane(), pHost); + } + if (MSG_IsNewsHost(pHost) && result && + m_nMode != MSG_SubscribeGetMode(GetPane())) + { + MSG_SubscribeSetMode(GetPane(), m_nMode); + } if (GetList()) GetList()->SetSubscribePage(this); m_pOutliner->SetPane(GetPane()); } + return result; } @@ -1020,7 +1055,7 @@ void CSubscribePropertyPage::SetNewsHosts(MSG_Master* pMaster) } GetServerCombo()->SetCurSel(i); if (pNewsHost && MSG_IsIMAPHost(pNewsHost)) - m_pParent->EnableNonImapPages(FALSE); + DoEnableImapControls(); } } @@ -1067,7 +1102,7 @@ BOOL CSubscribePropertyPage::OnSetActive() if (nNewIndex != nSelection) GetServerCombo()->SetCurSel(nNewIndex); } - + if (GetOutliner()) { if (GetOutliner()->SelectInitialItem()) @@ -1280,21 +1315,25 @@ void CSubscribePropertyPage::OnChangeServer() return; DoStopListChange(); - ClearNewsgroupSelection(); - if (m_nMode != MSG_SubscribeNew && GetDlgItem(IDC_EDIT_NEWSGROUP)) - { - GetDlgItem(IDC_EDIT_NEWSGROUP)->SetWindowText(""); - //SetWindowText() caused call to OnChangeNewsgroup() and set - //m_bFromTyping == TRUE, reset it back to FALSE - m_bFromTyping = FALSE; - } - GetOutliner()->SetTotalLines(0); // fix for bug# 38007 + + pParent->ClearSelection(); pParent->SetHost(pHost); - MSG_SubscribeSetHost(GetPane(), pHost); if (MSG_IsIMAPHost(pHost)) - m_pParent->EnableNonImapPages(FALSE); + DoEnableImapControls(); else - m_pParent->EnableNonImapPages(TRUE); + { + EnableAllControls(TRUE); + } + + if (m_nMode == MSG_SubscribeAll || MSG_IsNewsHost(pHost)) + { + MSG_SubscribeSetHost(GetPane(), pHost); + if (MSG_IsNewsHost(pHost) && + m_nMode != MSG_SubscribeGetMode(GetPane())) + { + MSG_SubscribeSetMode(GetPane(), m_nMode); + } + } } void CSubscribePropertyPage::EnableAllControls(BOOL bEnable) @@ -1316,6 +1355,13 @@ void CSubscribePropertyPage::EnableAllControls(BOOL bEnable) wnd->EnableWindow(bEnable); if (wnd = GetDlgItem(IDC_COMBO_SERVER)) wnd->EnableWindow(bEnable); + if (wnd = GetDlgItem(IDC_SEARCH_NOW)) + wnd->EnableWindow(bEnable); + if (wnd = GetDlgItem(IDC_GET_NEW)) + wnd->EnableWindow(bEnable); + if (wnd = GetDlgItem(IDC_CLEAR_NEW)) + wnd->EnableWindow(bEnable); + if (wnd = GetParent()->GetDlgItem(IDOK)) wnd->EnableWindow(bEnable); if (bEnable == TRUE) @@ -1323,6 +1369,16 @@ void CSubscribePropertyPage::EnableAllControls(BOOL bEnable) } +void CSubscribePropertyPage::DoEnableImapControls() +{ + EnableAllControls(FALSE); + + CWnd* wnd = NULL; + if (wnd = GetDlgItem(IDC_COMBO_SERVER)) + wnd->EnableWindow(TRUE); +} + + void CSubscribePropertyPage::DoStopListChange() { if (m_bListChangeStarting) @@ -1522,6 +1578,7 @@ void CAllNewsgroupsPage::OnGetDeletions() ClearNewsgroupSelection(); m_bProcessGetDeletion = TRUE; EnableAllControls(FALSE); + GetDlgItem(IDC_STOP)->EnableWindow(TRUE); m_pParent->StartAnimation(); MSG_Command(GetPane(), MSG_FetchGroupList, NULL, 0); } @@ -1539,6 +1596,7 @@ void CAllNewsgroupsPage::OnStop() EnableAllControls(TRUE); } GetOutliner()->SelectInitialItem(); + GetDlgItem(IDC_STOP)->EnableWindow(FALSE); } void CAllNewsgroupsPage::DoDataExchange(CDataExchange* pDX) @@ -1896,14 +1954,25 @@ void CSubscribePropertySheet::AllConnectionsComplete(MWContext *pContext ) void CSubscribePropertySheet::AddServer(MSG_Host* pHost) { - if (::IsWindow(m_pSearchGroupPage->GetSafeHwnd())) + CSubscribePropertyPage* pActivePage = (CSubscribePropertyPage*)GetActivePage(); + if (pActivePage != m_pAllGroupPage && + ::IsWindow(m_pAllGroupPage->GetSafeHwnd())) + { + int nIndex = m_pAllGroupPage->GetServerCombo()->AddString(MSG_GetHostUIName(pHost)); + if (nIndex != CB_ERR) + m_pAllGroupPage->GetServerCombo()->SetItemDataPtr(nIndex, pHost); + } + + if (pActivePage != m_pSearchGroupPage && + ::IsWindow(m_pSearchGroupPage->GetSafeHwnd())) { int nIndex = m_pSearchGroupPage->GetServerCombo()->AddString(MSG_GetHostUIName(pHost)); if (nIndex != CB_ERR) m_pSearchGroupPage->GetServerCombo()->SetItemDataPtr(nIndex, pHost); } - if (::IsWindow(m_pNewGroupPage->GetSafeHwnd())) + if (pActivePage != m_pNewGroupPage && + ::IsWindow(m_pNewGroupPage->GetSafeHwnd())) { int nIndex = m_pNewGroupPage->GetServerCombo()->AddString(MSG_GetHostUIName(pHost)); if (nIndex != CB_ERR) @@ -1911,12 +1980,35 @@ void CSubscribePropertySheet::AddServer(MSG_Host* pHost) } } -void CSubscribePropertySheet::EnableNonImapPages(BOOL bEnable) +void CSubscribePropertySheet::ClearSelection() { + if (::IsWindow(m_pAllGroupPage->GetSafeHwnd())) + { + if (m_pAllGroupPage->GetDlgItem(IDC_EDIT_NEWSGROUP)) + { + m_pAllGroupPage->GetDlgItem(IDC_EDIT_NEWSGROUP)->SetWindowText(""); + //SetWindowText() caused call to OnChangeNewsgroup() and set + //m_bFromTyping == TRUE, reset it back to FALSE + m_pAllGroupPage->m_bFromTyping = FALSE; + } + m_pAllGroupPage->GetOutliner()->SelectItem(-1); + m_pAllGroupPage->GetOutliner()->SetTotalLines(0); + } if (::IsWindow(m_pSearchGroupPage->GetSafeHwnd())) - m_pSearchGroupPage->EnableAllControls(bEnable); - if (::IsWindow(m_pNewGroupPage->GetSafeHwnd())) - m_pNewGroupPage->EnableAllControls(bEnable); + { + if (m_pSearchGroupPage->GetDlgItem(IDC_EDIT_NEWSGROUP)) + { + m_pSearchGroupPage->GetDlgItem(IDC_EDIT_NEWSGROUP)->SetWindowText(""); + m_pSearchGroupPage->m_bFromTyping = FALSE; + } + m_pSearchGroupPage->GetOutliner()->SelectItem(-1); + m_pSearchGroupPage->GetOutliner()->SetTotalLines(0); + } + if (::IsWindow(m_pNewGroupPage->GetSafeHwnd())) + { + m_pNewGroupPage->GetOutliner()->SelectItem(-1); + m_pNewGroupPage->GetOutliner()->SetTotalLines(0); + } } void CSubscribePropertySheet::OnHelp() @@ -1973,3 +2065,87 @@ BEGIN_MESSAGE_MAP(CServerTypeDialog, CDialog) ON_BN_CLICKED(IDOK, OnOK) END_MESSAGE_MAP() +///////////////////////////////////////////////////////////////////////////// +// CUpgradeSubscribeDlg dialog + + +CUpgradeSubscribeDlg::CUpgradeSubscribeDlg(CWnd* pParent /*=NULL*/, const char* hostName) + : CDialog(CUpgradeSubscribeDlg::IDD, pParent) +{ + m_pHostName = hostName; + m_iUpgrade = 0; +} + +void CUpgradeSubscribeDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CFilterDialog) + DDX_Radio(pDX, IDC_RADIO1, m_iUpgrade); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CUpgradeSubscribeDlg, CDialog) + //{{AFX_MSG_MAP(CUpgradeSubscribeDlg) + ON_BN_CLICKED(IDHELP, OnHelp) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CUpgradeSubscribeDlg message handlers + +void CUpgradeSubscribeDlg::OnOK() +{ + // TODO: Add extra validation here + UpdateData(); + if (m_iUpgrade == 0) + CDialog::EndDialog(MSG_IMAPUpgradeAutomatic); + else + CDialog::EndDialog(MSG_IMAPUpgradeCustom); +} + +void CUpgradeSubscribeDlg::OnCancel() +{ + // TODO: Add extra validation here + CDialog::EndDialog(MSG_IMAPUpgradeDont); +} + +void CUpgradeSubscribeDlg::OnHelp() +{ + NetHelp(HELP_IMAP_UPGRADE); +} + +int CUpgradeSubscribeDlg::DoModal() +{ + if (!m_MNResourceSwitcher.Initialize()) + return -1; + return CDialog::DoModal(); +} + + +BOOL CUpgradeSubscribeDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + m_MNResourceSwitcher.Reset(); + + if (m_pHostName.GetLength()) + { + CString label, format; + GetDlgItemText (IDC_RADIO1, format ); + label.Format (format, m_pHostName); + SetDlgItemText (IDC_RADIO1, label ); + } + + return TRUE; // return TRUE unless you set the focus to a control +} + +MSG_IMAPUpgradeType FE_PromptIMAPSubscriptionUpgrade (MWContext* context, + const char *hostName) +{ + MSG_IMAPUpgradeType upgradeType = MSG_IMAPUpgradeDont; + CUpgradeSubscribeDlg * upgradeDlg = new CUpgradeSubscribeDlg (ABSTRACTCX(context)->GetDialogOwner(), hostName); + if (upgradeDlg) + upgradeType = (MSG_IMAPUpgradeType) upgradeDlg->DoModal(); + return upgradeType; +} + diff --git a/mozilla/cmd/winfe/subnews.h b/mozilla/cmd/winfe/subnews.h index 7518d8cc4a1..5de3b2aa703 100644 --- a/mozilla/cmd/winfe/subnews.h +++ b/mozilla/cmd/winfe/subnews.h @@ -24,6 +24,7 @@ #include "mailmisc.h" #include "statbar.h" #include "apimsg.h" +#include "mnrccln.h" // Definitions for column headings in the outliner control #define ID_COLNEWS_NAME 1 @@ -136,9 +137,10 @@ public: void DoSelChanged(MSG_GroupNameLine* pGroup); void CheckSubscribeButton(MSG_GroupNameLine* pGroup); Bool IsOutlinerHasFocus(); - void EnableAllControls(BOOL bEnable); void DoStopListChange(); void ClearNewsgroupSelection(); + void EnableAllControls(BOOL bEnable); + void DoEnableImapControls(); virtual void ListChangeStarting(MSG_Pane* pane, XP_Bool asynchronous, MSG_NOTIFY_CODE notify, MSG_ViewIndex where, @@ -387,7 +389,7 @@ public: void StopAnimation(); void AllConnectionsComplete(MWContext *pContext); void AddServer(MSG_Host* pHost); - void EnableNonImapPages(BOOL bEnable); + void ClearSelection(); //In Win16, GetActivePage() is a protected @@ -462,5 +464,37 @@ protected: DECLARE_MESSAGE_MAP() }; +//CUpgradeSubscribeDlg prompts user to synchronize before going offline. +class CUpgradeSubscribeDlg : public CDialog +{ + +public: + CMailNewsResourceSwitcher m_MNResourceSwitcher; + CString m_pHostName; + +// Construction +public: + CUpgradeSubscribeDlg(CWnd* pParent = NULL, const char* hostName = NULL); // standard constructor + virtual int DoModal (); + + // Dialog Data + //{{AFX_DATA(CUpgradeSubscribeDlg) + enum { IDD = IDD_UPGRADE_SUBSCRIBE }; + int m_iUpgrade; + //}}AFX_DATA + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + +// Implementation +protected: + virtual void OnOK(); + virtual void OnCancel(); + virtual void OnHelp(); + virtual BOOL OnInitDialog(); + DECLARE_MESSAGE_MAP() +}; + + #endif SUBNEWS_H diff --git a/mozilla/cmd/winfe/thrdfrm.cpp b/mozilla/cmd/winfe/thrdfrm.cpp index 7fdcb4bfed1..dc295476f67 100644 --- a/mozilla/cmd/winfe/thrdfrm.cpp +++ b/mozilla/cmd/winfe/thrdfrm.cpp @@ -36,6 +36,7 @@ #include "mailpriv.h" #include "mailqf.h" #include "dspppage.h" +#include "addrfrm.h" //for MOZ_NEWADDR #ifdef DEBUG_WHITEBOX #include "qa.h" @@ -67,31 +68,32 @@ UINT MailCodes[10] = { ID_FILE_GETNEWMAIL, ID_FILE_NEWMESSAGE, ID_MESSAGE_REPLYBUTTON, - ID_MESSAGE_FORWARD, + ID_MESSAGE_FORWARDBUTTON, ID_MESSAGE_FILE, ID_MESSAGE_NEXTUNREAD, ID_FILE_PRINT, ID_SECURITY, - ID_EDIT_DELETEMESSAGE, + ID_EDIT_DELETE_3PANE, ID_NAVIGATE_INTERRUPT }; int MailIndices[10] = { 0, 1, 2, 3, 4, 5, 6, 10, 11, 13 }; -UINT NewsCodes[10] = { +UINT NewsCodes[11] = { ID_FILE_GETNEWMAIL, ID_NEWS_POSTNEW, ID_MESSAGE_REPLYBUTTON, - ID_MESSAGE_FORWARD, + ID_MESSAGE_FORWARDBUTTON, ID_MESSAGE_FILE, ID_MESSAGE_NEXTUNREAD, ID_FILE_PRINT, ID_SECURITY, ID_MESSAGE_MARKBUTTON, + ID_EDIT_DELETE_3PANE, ID_NAVIGATE_INTERRUPT }; -int NewsIndices[10] = { 0, 1, 2, 3, 4, 5, 6, 10, 11, 13 }; +int NewsIndices[11] = { 0, 1, 2, 3, 4, 5, 6, 10, 11, 12, 14 }; //status bar format static const UINT BASED_CODE indicators[] = @@ -101,6 +103,7 @@ static const UINT BASED_CODE indicators[] = IDS_SIGNED_STATUS, IDS_TRANSFER_STATUS, ID_SEPARATOR, + IDS_ONLINE_STATUS, IDS_TASKBAR }; @@ -117,11 +120,18 @@ C3PaneMailFrame::C3PaneMailFrame() m_pThreadSplitter = NULL; m_nLoadingFolder = 0; m_bDragCopying = FALSE; + m_bBlockingFolderSelection = FALSE; m_bNoScrollHack = FALSE; - // All our favorite hotkeys - LoadAccelerators( IDR_ONEKEYMESSAGE ); + m_actionOnLoad = actionSelectFirst; + m_navPending = MSG_FirstMessage; + m_selPending = -1L; + + m_pFocusWnd = NULL; + + // All our favorite hotkeys + LoadAccelerators( IDR_ONEKEYMESSAGE ); } C3PaneMailFrame::~C3PaneMailFrame() @@ -181,6 +191,16 @@ void C3PaneMailFrame::PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, } return; } + if (notify == MSG_PaneNotifySafeToSelectFolder) + { + if (m_bBlockingFolderSelection) + { + m_bBlockingFolderSelection = FALSE; + PostMessage(WM_COMMAND, ID_FOLDER_SELECT, 0); + } + return; + } + if ( notify == MSG_PaneNotifyFolderLoaded ) { if (m_nLoadingFolder > 0) { @@ -205,9 +225,22 @@ void C3PaneMailFrame::PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, switch ( m_actionOnLoad ) { case actionSelectFirst: { - m_pOutliner->SelectItem( m_pOutliner->GetTotalLines() > 0 ? 0 : -1 ); - m_bNoScrollHack = TRUE; - OnDoneGettingMail(); + if (m_navPending != MSG_NextUnreadMessage) + { + XP_Bool bSelectLastMsg = FALSE; + PREF_GetBoolPref("mailnews.remember_selected_message", &bSelectLastMsg); + MessageKey lastKey = MSG_GetLastMessageLoaded(folderInfo); + MSG_ViewIndex index = + MSG_GetMessageIndexForKey(m_pPane, lastKey, TRUE); + if (index != MSG_VIEWINDEXNONE && bSelectLastMsg) + SelectMessage(lastKey); + else + m_pOutliner->SelectItem( m_pOutliner->GetTotalLines() > 0 ? 0 : -1 ); + m_bNoScrollHack = TRUE; + OnDoneGettingMail(); + } + else + m_navPending = MSG_FirstMessage; } break; @@ -258,7 +291,8 @@ void C3PaneMailFrame::PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, } m_bWantToGetMail = FALSE; } else if ( notify == MSG_PaneNotifyFolderDeleted ) { - OnSelectFolder(); + if (!m_pPane) + CreateThreadPane(); } else if ( notify == MSG_PaneNotifyMessageLoaded ) { MSG_FolderInfo *curFolder = GetCurFolder(); MSG_FolderInfo *folderInfo = MSG_GetCurFolder(m_pMessagePane); @@ -288,7 +322,7 @@ void C3PaneMailFrame::PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, } // We get notified of message deletes individually, so lets // ignore it. - if ( notify != MSG_PaneNotifyMessageDeleted ) { + if ( notify != MSG_PaneNotifyMessageDeleted && m_pPane) { m_pInfoBar->Update(); } #ifdef DEBUG_WHITEBOX @@ -385,8 +419,73 @@ void C3PaneMailFrame::SelectItem( MSG_Pane* pane, int item ) } } -#define IS_IN_WINDOW(hParent,hChild)\ - (((hParent) == (hChild)) || ::IsChild(hParent, hChild)) +//clock wise +void C3PaneMailFrame::CheckFocusWindow(BOOL bUseTab) +{ + CWnd* pNextFocusWnd = NULL; + CWnd* pMsgBodyView = m_pMessageView ? m_pMessageView->GetMessageBodyView() : NULL; + BOOL bFolderClosed = m_pFolderSplitter->IsOnePaneClosed(); + BOOL bMessageClosed = m_pThreadSplitter->IsOnePaneClosed(); + + if (m_pFocusWnd == pMsgBodyView ) + { + if (bUseTab || bMessageClosed) + pNextFocusWnd = bFolderClosed ? m_pOutliner : m_pFolderOutliner; + else + pNextFocusWnd = pMsgBodyView; + } + else if (m_pFocusWnd == m_pOutliner) + { + if (bUseTab) + { + if (!bMessageClosed) + pNextFocusWnd = pMsgBodyView; + else if (!bFolderClosed) + pNextFocusWnd = m_pFolderOutliner; + else + pNextFocusWnd = m_pOutliner; + } + else + pNextFocusWnd = m_pOutliner; + } + else + pNextFocusWnd = m_pOutliner; + + if (pNextFocusWnd != m_pFocusWnd) + { + m_pFocusWnd = pNextFocusWnd; + m_pFocusWnd->SetFocus(); + } +} + +//counter clock wise +void C3PaneMailFrame::CheckShiftKeyFocusWindow() +{ + CWnd* pNextFocusWnd = NULL; + CWnd* pMsgBodyView = m_pMessageView ? m_pMessageView->GetMessageBodyView() : NULL; + BOOL bFolderClosed = m_pFolderSplitter->IsOnePaneClosed(); + BOOL bMessageClosed = m_pThreadSplitter->IsOnePaneClosed(); + + if (m_pFocusWnd == m_pFolderOutliner) + pNextFocusWnd = bMessageClosed ? m_pOutliner : pMsgBodyView; + else if (m_pFocusWnd == m_pOutliner) + { + if (!bFolderClosed) + pNextFocusWnd = m_pFolderOutliner; + else if (!bMessageClosed) + pNextFocusWnd = pMsgBodyView; + else + pNextFocusWnd = m_pOutliner; + } + else + pNextFocusWnd = m_pOutliner; + + if (pNextFocusWnd != m_pFocusWnd) + { + m_pFocusWnd = pNextFocusWnd; + m_pFocusWnd->SetFocus(); + } +} BOOL C3PaneMailFrame::PreTranslateMessage(MSG* pMsg) { @@ -394,7 +493,10 @@ BOOL C3PaneMailFrame::PreTranslateMessage(MSG* pMsg) { CWnd* pFocusWnd = GetFocus(); if (pFocusWnd == m_pFolderOutliner) + { + PrepareForDeleteFolder(); OnDeleteFolder(); + } else { if (GetKeyState(VK_SHIFT) & 0x8000) @@ -406,41 +508,14 @@ BOOL C3PaneMailFrame::PreTranslateMessage(MSG* pMsg) } if ( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB && !(GetKeyState(VK_MENU) & 0x8000) && - !(GetKeyState(VK_CONTROL) & 0x8000)) { - HWND hwndFocus = ::GetFocus(); + !(GetKeyState(VK_CONTROL) & 0x8000)) + { + if (GetKeyState(VK_SHIFT) & 0x8000) + CheckShiftKeyFocusWindow(); + else + CheckFocusWindow(); - HWND hwndFolder = m_pFolderOutliner ? m_pFolderOutliner->m_hWnd : NULL; - HWND hwndOutliner = m_pOutliner ? m_pOutliner->m_hWnd : NULL; - HWND hwndView = m_pMessageView ? m_pMessageView->m_hWnd : NULL; - - HWND hwndNext = NULL; - - if (GetKeyState(VK_SHIFT) & 0x8000) { - if ( hwndView && IS_IN_WINDOW(hwndView, hwndFocus) ) { - // Don't steal the event if the tab is destined for a child window of - // the active view, because the child window may want the tab itself - hwndNext = hwndOutliner; - } else if ( hwndFocus == hwndOutliner ) { - hwndNext = hwndFolder; - } else { // hwndFocus == hwndFolder - hwndNext = hwndView; - } - } else { - if ( hwndView && IS_IN_WINDOW(hwndView, hwndFocus) ) { - // Don't steal the event if the tab is destined for a child window of - // the active view, because the child window may want the tab itself - hwndNext = hwndFolder; - } else if ( hwndFocus == hwndFolder ) { - hwndNext = hwndOutliner; - } else { // hwndFocus == hwndOutliner - hwndNext = hwndView; - } - } - - if ( hwndNext ) { - ::SetFocus( hwndNext ); - return TRUE; - } + return TRUE; } return CMsgListFrame::PreTranslateMessage( pMsg ); @@ -460,6 +535,8 @@ BOOL C3PaneMailFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pCont m_pFolderSplitter->ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED); #endif + m_pFolderSplitter->SetNotifyFrame(this); //for setting focus in pane + m_pThreadSplitter = (CMailNewsSplitter *) RUNTIME_CLASS(CMailNewsSplitter)->CreateObject(); ASSERT(m_pThreadSplitter); @@ -472,6 +549,8 @@ BOOL C3PaneMailFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pCont WS_BORDER|WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, CRect(0,0,0,0), m_pFolderSplitter, 99, pContext ); #endif + m_pThreadSplitter->SetNotifyFrame(this); //for loading message when pane opens + m_pThreadSplitter->SetLoadMessage(TRUE); //for loading message when pane opens m_pMessageView = (CMessageView *) RUNTIME_CLASS(CMessageView)->CreateObject(); #ifdef _WIN32 @@ -523,8 +602,6 @@ BOOL C3PaneMailFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pCont DOWNCAST(CMessageOutliner, m_pOutliner)->SetNews(m_bNews); m_pOutlinerParent->CreateColumns ( ); - m_pMessagePane = MSG_CreateMessagePane( pWinCX->GetContext(), m_pMaster ); - int32 prefInt = -1; PREF_GetIntPref("mailnews.3pane_thread_height", &prefInt); m_pThreadSplitter->AddPanes(m_pOutlinerParent, m_pMessageView, prefInt, FALSE); @@ -533,12 +610,11 @@ BOOL C3PaneMailFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pCont PREF_GetIntPref("mailnews.3pane_folder_width", &prefInt); m_pFolderSplitter->AddPanes(m_pFolderOutlinerParent, m_pThreadSplitter, prefInt); + CreateMessagePane(); CreateThreadPane(); - MSG_SetFEData( m_pFolderPane, (LPVOID) (LPUNKNOWN) (LPMSGLIST) this ); - MSG_SetFEData( m_pMessagePane, (LPVOID) (LPUNKNOWN) (LPMSGLIST) this ); - MSG_SetMessagePaneCallbacks(m_pMessagePane, &MsgPaneCB, NULL); m_pOutlinerParent->SetFocus(); + m_pFocusWnd = m_pOutliner; // Don't call CMsgListFrame, since we create our list // differently @@ -562,7 +638,11 @@ BEGIN_MESSAGE_MAP(C3PaneMailFrame, CMailNewsFrame) ON_WM_CREATE() ON_WM_CLOSE() ON_WM_DESTROY() + ON_WM_SETFOCUS() + // File Menu Items + ON_COMMAND(ID_FILE_EMPTYTRASHFOLDER, OnEmptyTrash) + // Edit Menu Items ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) ON_COMMAND(ID_EDIT_REDO, OnEditRedo) @@ -572,12 +652,14 @@ BEGIN_MESSAGE_MAP(C3PaneMailFrame, CMailNewsFrame) ON_UPDATE_COMMAND_UI(ID_EDIT_SELECTMARKEDMESSAGES, OnUpdateSelectFlagged) ON_COMMAND(ID_EDIT_SELECTALL, OnSelectAll) ON_UPDATE_COMMAND_UI(ID_EDIT_SELECTALL, OnUpdateSelectAll) - ON_UPDATE_COMMAND_UI(ID_VIEW_PROPERTIES, OnUpdateProperties) - ON_COMMAND(ID_VIEW_PROPERTIES,OnEditProperties) + ON_COMMAND(ID_EDIT_DELETE_3PANE, OnDeleteFrom3Pane) + ON_UPDATE_COMMAND_UI(ID_EDIT_DELETE_3PANE, OnUpdateDeleteFrom3Pane) // View Menu Items ON_COMMAND(ID_VIEW_MESSAGE, OnViewMessage) ON_UPDATE_COMMAND_UI(ID_VIEW_MESSAGE, OnUpdateViewMessage) + ON_COMMAND(ID_VIEW_FOLDER, OnViewFolder) + ON_UPDATE_COMMAND_UI(ID_VIEW_FOLDER, OnUpdateViewFolder) // Message Menu Items #ifdef ON_COMMAND_RANGE @@ -602,7 +684,6 @@ BEGIN_MESSAGE_MAP(C3PaneMailFrame, CMailNewsFrame) ON_COMMAND(ID_NAVIGATE_CONTAINER, OnContainer ) ON_UPDATE_COMMAND_UI( ID_MESSAGE_FILE, OnUpdateFile ) ON_COMMAND(ID_FILE_OPENFOLDER, OnOpenNewFrame ) - ON_COMMAND(ID_VIEW_FOLDER, OnViewFolder) ON_COMMAND(ID_HOTLIST_ADDCURRENTTOHOTLIST, OnFileBookmark) ON_UPDATE_COMMAND_UI(ID_HOTLIST_ADDCURRENTTOHOTLIST, OnUpdateFileBookmark) @@ -619,9 +700,43 @@ BEGIN_MESSAGE_MAP(C3PaneMailFrame, CMailNewsFrame) ON_UPDATE_COMMAND_UI(ID_PRIORITY_HIGHEST, OnUpdatePriority) ON_COMMAND(ID_DONEGETTINGMAIL, OnDoneGettingMail) + + ON_MESSAGE(TB_FILLINTOOLTIP, OnFillInToolTip) + ON_MESSAGE(TB_FILLINSTATUS, OnFillInToolbarButtonStatus) + END_MESSAGE_MAP() +void C3PaneMailFrame::HandleGetNNNMessageMenuItem() +{ + //News needs to have Get Next N messages and mail doesn't. + CMenu *pMainMenu = GetMenu(); + if(pMainMenu) + { + CMenu *pFileMenu = pMainMenu->GetSubMenu(0); + + if(pFileMenu) + { + if(!m_bNews) + { + pFileMenu->RemoveMenu(ID_FILE_GETNEXT, MF_BYCOMMAND); + } + else + { + int nGetNNNMessagePosition = WFE_FindMenuItem(pFileMenu, ID_FILE_GETNEXT); + if(nGetNNNMessagePosition == -1) + { + int nGetMessagePosition = WFE_FindMenuItem(pFileMenu, ID_FILE_GETNEWMAIL); + if(nGetMessagePosition != -1) + { + pFileMenu->InsertMenu(nGetMessagePosition + 1, MF_BYPOSITION, ID_FILE_GETNEXT); + + } + } + } + } + } +} void C3PaneMailFrame::SwitchUI( ) { @@ -651,15 +766,17 @@ void C3PaneMailFrame::SwitchUI( ) DWORD dwButtonStyle = 0; switch (aidButtons[i]) { - case ID_MESSAGE_REPLYBUTTON: case ID_MESSAGE_MARKBUTTON: dwButtonStyle |= TB_HAS_IMMEDIATE_MENU; break; + case ID_MESSAGE_REPLYBUTTON: case ID_MESSAGE_NEXTUNREAD: dwButtonStyle |= TB_HAS_TIMED_MENU; break; - + case ID_EDIT_DELETE_3PANE: + dwButtonStyle |= TB_DYNAMIC_TOOLTIP | TB_DYNAMIC_STATUS; + break; case ID_NAVIGATE_MSG_BACK: break; default: @@ -697,6 +814,8 @@ void C3PaneMailFrame::SwitchUI( ) #endif } + + void C3PaneMailFrame::SetIsNews( BOOL bNews ) { if ( bNews != m_bNews ) { @@ -804,7 +923,6 @@ void C3PaneMailFrame::DoNavigate( MSG_MotionType msgCommand ) switch ( msgCommand ) { case MSG_NextFolder: case MSG_NextUnreadGroup: - LoadFolder(pFolderInfo); break; case MSG_Forward: case MSG_Back: @@ -813,6 +931,8 @@ void C3PaneMailFrame::DoNavigate( MSG_MotionType msgCommand ) default: break; } + + LoadFolder(pFolderInfo, MSG_MESSAGEKEYNONE, actionNavigation); } } else if ( resultId != key && (int) resultIndex >= 0 && (int) resultIndex < m_pOutliner->GetTotalLines() ) { @@ -846,6 +966,14 @@ void C3PaneMailFrame::DoUpdateNavigate( CCmdUI* pCmdUI, MSG_MotionType msgComman pCmdUI->Enable( enable ); } +void C3PaneMailFrame::LoadFrameMenu(CMenu *pPopup, UINT nIndex) +{ + CGenericFrame::LoadFrameMenu(pPopup, nIndex); + //if it's the file menu we want to make sure it's correct + HandleGetNNNMessageMenuItem(); + +} + int C3PaneMailFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { // Add menus to genframe's menu map in order to load these menus @@ -947,6 +1075,7 @@ BOOL C3PaneMailFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLER OnUpdateFile( pCmdUI ); return TRUE; } + } return CMsgListFrame::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); } @@ -987,18 +1116,14 @@ void C3PaneMailFrame::OnDestroy() MSG_FreeAttachmentList(m_pMessagePane, m_pAttachmentData); m_pAttachmentData = NULL; - if (m_pMessagePane) { - // Since MSG_DestroyPane can result in notifications that - // we may attempt to act upon with the dying pane, NULL - // it out first - MSG_Pane *pTemp = m_pMessagePane; - m_pMessagePane = NULL; - MSG_DestroyPane( pTemp ); - } + DestroyMessagePane(); + if ( m_pFolderPane ) { // Ditto... MSG_Pane *pTemp = m_pFolderPane; m_pFolderPane = NULL; + //otherwise folder pane sometimes gets accessed on quit + m_pFolderOutliner->SetPane(NULL); MSG_DestroyPane( pTemp ); } @@ -1012,6 +1137,14 @@ void C3PaneMailFrame::OnDestroy() CMsgListFrame::OnDestroy(); } +void C3PaneMailFrame::OnSetFocus(CWnd* pOldWnd) +{ + CMsgListFrame::OnSetFocus(pOldWnd); + if (!m_pFocusWnd) + m_pFocusWnd = m_pOutliner; + m_pFocusWnd->SetFocus(); +} + // Edit Menu Items void C3PaneMailFrame::OnSelectThread() @@ -1047,6 +1180,9 @@ void C3PaneMailFrame::OnUpdateSelectFlagged( CCmdUI *pCmdUI ) pCmdUI->Enable( TRUE ); } +#define IS_IN_WINDOW(hParent,hChild)\ + (((hParent) == (hChild)) || ::IsChild(hParent, hChild)) + void C3PaneMailFrame::OnSelectAll() { HWND hwndFocus = ::GetFocus(); @@ -1062,6 +1198,8 @@ void C3PaneMailFrame::OnSelectAll() UINT nID = IDS_MENU_ALL; if (IS_IN_WINDOW(hwndOutliner, hwndFocus)) { + if (MSG_GetToggleStatus(m_pPane, MSG_SortByThread, NULL, 0) == MSG_Checked) + ((CMessageOutliner*)m_pOutliner)->SelectAllMessages(); m_pOutliner->SelectRange( 0, -1, TRUE ); } else if (hwndView == hwndFocus){ LO_SelectAll(pContext->GetDocumentContext()); @@ -1092,81 +1230,29 @@ void C3PaneMailFrame::OnUpdateSelectAll( CCmdUI *pCmdUI ) pCmdUI->Enable(bEnable); } -void C3PaneMailFrame::OnUpdateProperties(CCmdUI *pCmdUI) +void C3PaneMailFrame::OnUpdateDeleteFrom3Pane(CCmdUI* pCmdUI) { - MSG_ViewIndex *indices = NULL; - int count = 0; - MSG_FolderLine folderLine; + if(IsThreadFocus() || IsMessageFocus()) + { + OnUpdateDeleteMessage(pCmdUI); - - if (pCmdUI) - { - if (m_pFolderOutliner == GetFocus()) - { - m_pFolderOutliner->GetSelection( indices, count ); - - if (indices && count) - { - MSG_FolderInfo *folderInfo = MSG_GetFolderInfo( m_pFolderPane, indices[0] ); - MSG_GetFolderLineByIndex( m_pFolderPane, indices[0], 1, &folderLine ); - - //only make and add the pages if they selected a news group or category - if ( folderLine.flags & (MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_CATEGORY) ) - { - pCmdUI->Enable(TRUE); - return; - } - } - } } - pCmdUI->Enable(FALSE); + else + { + OnUpdateDeleteFolder(pCmdUI); + } } -void C3PaneMailFrame::OnEditProperties() +void C3PaneMailFrame::OnDeleteFrom3Pane() { - MSG_ViewIndex *indices = NULL; - int count = 0; - MSG_FolderLine folderLine; - - if (m_pFolderOutliner) - m_pFolderOutliner->GetSelection( indices, count ); - - if (indices && count) + if(IsThreadFocus() || IsMessageFocus()) { - MSG_FolderInfo *folderInfo = MSG_GetFolderInfo( m_pFolderPane, indices[0] ); - MSG_GetFolderLineByIndex( m_pFolderPane, indices[0], 1, &folderLine ); - - CNewsFolderPropertySheet FolderSheet( szLoadString(IDS_NEWSGROUPPROP), this ); - //destructor handles clean up of added sheets - - //only make and add the pages if they selected a news group or category - if ( folderLine.flags & (MSG_FOLDER_FLAG_NEWSGROUP|MSG_FOLDER_FLAG_CATEGORY) ) - { - FolderSheet.m_pNewsFolderPage= new CNewsGeneralPropertyPage(&FolderSheet); - FolderSheet.m_pNewsFolderPage->SetFolderInfo( folderInfo, (MWContext*)GetContext() ); - - FolderSheet.m_pDownLoadPageNews = new CDownLoadPPNews(&FolderSheet); - FolderSheet.m_pDownLoadPageNews->SetFolderInfo(folderInfo); - - FolderSheet.m_pDiskSpacePage = new CDiskSpacePropertyPage(&FolderSheet); - FolderSheet.m_pDiskSpacePage->SetFolderInfo (folderInfo ); - - FolderSheet.AddPage(FolderSheet.m_pNewsFolderPage); - FolderSheet.AddPage(FolderSheet.m_pDownLoadPageNews); - FolderSheet.AddPage(FolderSheet.m_pDiskSpacePage); - - if(FolderSheet.DoModal() == IDOK) - { - if(FolderSheet.DownLoadNow()) - { - new CProgressDialog(this, NULL,_ShutDownFrameCallBack, - folderInfo,szLoadString(IDS_DOWNLOADINGARTICLES)); - ;//DonwLoad!!!!!!! - } - else if (FolderSheet.SynchronizeNow()) - ;//Synchronize!!!! NOT IMPLEMENTED - } - } + OnDeleteMessage(); + } + else + { + PrepareForDeleteFolder(); + OnDeleteFolder(); } } @@ -1216,12 +1302,46 @@ void C3PaneMailFrame::OnCopy(UINT nID) void C3PaneMailFrame::OnUpdateFile( CCmdUI *pCmdUI ) { + //note you can get in here if m_nID == ID_MESSAGE_FILE or + //if in the move and copy ranges. So we have to make sure it + //works for all of those scenarios. MSG_ViewIndex *indices; int count; m_pOutliner->GetSelection( indices, count ); - BOOL bEnable = count > 0; + // find the desired effect + MSG_DragEffect request = (pCmdUI->m_nID >= FIRST_MOVE_MENU_ID && + pCmdUI->m_nID <= LAST_MOVE_MENU_ID) ? + MSG_Require_Move : MSG_Require_Copy; + // find the id + int nID = (request == MSG_Require_Move) ? + pCmdUI->m_nID - FIRST_MOVE_MENU_ID : + pCmdUI->m_nID - FIRST_COPY_MENU_ID; + + + // get the folderInfo + MSG_FolderInfo *folderInfo = NULL; + MSG_DragEffect effect = MSG_Drag_Not_Allowed; + + if(pCmdUI->m_nID != ID_MESSAGE_FILE && + (request == MSG_Require_Move && pCmdUI->m_nID >=FIRST_MOVE_MENU_ID + && pCmdUI->m_nID <=LAST_MOVE_MENU_ID) || + (request == MSG_Require_Copy && pCmdUI->m_nID >=FIRST_COPY_MENU_ID + && pCmdUI->m_nID <=LAST_COPY_MENU_ID)) + { + folderInfo = FolderInfoFromMenuID(pCmdUI->m_nID); + } + + if(pCmdUI->m_nID != ID_MESSAGE_FILE && folderInfo) + { + effect = MSG_DragMessagesIntoFolderStatus(m_pPane, + NULL, 0, folderInfo, request); + } + + BOOL bEnable = count > 0 && (pCmdUI->m_nID == ID_MESSAGE_FILE || + (pCmdUI->m_pSubMenu || effect != MSG_Drag_Not_Allowed)); +// BOOL bEnable = count > 0; if (pCmdUI->m_pSubMenu) { pCmdUI->m_pMenu->EnableMenuItem(pCmdUI->m_nIndex, MF_BYPOSITION |(bEnable ? MF_ENABLED : MF_GRAYED)); @@ -1237,17 +1357,21 @@ void C3PaneMailFrame::OnViewMessage() if ( folderInfo ) { if (m_pThreadSplitter->IsOnePaneClosed()) { CFolderFrame::SetFolderPref( folderInfo, MSG_FOLDER_PREF_ONEPANE ); + m_pThreadSplitter->SetPaneSize(m_pOutlinerParent, m_pThreadSplitter->GetPreviousPaneSize()); + SendMessage(WM_COMMAND, ID_MESSAGE_SELECT, 0); + } else { CFolderFrame::ClearFolderPref( folderInfo, MSG_FOLDER_PREF_ONEPANE ); + m_pThreadSplitter->SetPaneSize(m_pMessageView, 0); } } } void C3PaneMailFrame::OnUpdateViewMessage( CCmdUI *pCmdUI ) { - pCmdUI->SetText( szLoadString( CASTUINT(m_pThreadSplitter->IsOnePaneClosed() ? - IDS_MENU_SHOWMESSAGE : IDS_MENU_HIDEMESSAGE )) ); + pCmdUI->SetCheck(!m_pThreadSplitter->IsOnePaneClosed()); pCmdUI->Enable( TRUE ); + } void C3PaneMailFrame::OnViewFolder() @@ -1258,7 +1382,26 @@ void C3PaneMailFrame::OnViewFolder() MSG_FolderInfo *pFolderInfo = MSG_GetCurFolder(m_pPane); UpdateFolderPane(pFolderInfo); + + m_pFolderSplitter->SetPaneSize(m_pFolderOutlinerParent, m_pFolderSplitter->GetPreviousPaneSize()); + } + else + { + m_pFolderSplitter->SetPaneSize(m_pFolderOutlinerParent , 0); + + } + + + +} + + +void C3PaneMailFrame::OnUpdateViewFolder( CCmdUI *pCmdUI ) +{ + pCmdUI->SetCheck(!m_pFolderSplitter->IsOnePaneClosed()); + pCmdUI->Enable( TRUE ); + } // Message Menu Items @@ -1276,6 +1419,9 @@ void C3PaneMailFrame::OnUpdateIgnore(CCmdUI *pCmdUI) void C3PaneMailFrame::OnSelectFolder() { + if (m_bBlockingFolderSelection) + return; + MSG_FolderLine folderLine; if (GetSelectedFolder(&folderLine)) { @@ -1287,6 +1433,7 @@ void C3PaneMailFrame::OnSelectFolder() MSG_FolderInfo *folderInfo = MSG_GetCurFolder(m_pPane); if (folderLine.id == folderInfo) { + m_pInfoBar->Update(); if (folderLine.total == m_pOutliner->GetTotalLines()) return; } @@ -1294,24 +1441,25 @@ void C3PaneMailFrame::OnSelectFolder() pFrame = FindFrame(folderLine.id); if (pFrame) { - pFrame->ActivateFrame(); - // fix do next unread group selection problem - if (folderLine.total != m_pOutliner->GetTotalLines()) - return; - // set selection back to original one when doing a double click - int nIndex = m_pFolderOutliner->GetCurrentSelected(); - if (nIndex != -1) - m_pFolderOutliner->SelectItem(nIndex); + if (pFrame != this) + { + pFrame->ActivateFrame(); + // set selection back to original one when doing a double click + int nIndex = m_pFolderOutliner->GetCurrentSelected(); + if (nIndex != -1) + { + m_pFolderOutliner->SelectItem(nIndex); + m_pFolderOutliner->ScrollIntoView(nIndex); + } + } } else - LoadFolder(folderLine.id); + LoadFolder(folderLine.id, MSG_MESSAGEKEYNONE, m_actionOnLoad); } else { BlankOutThreadPane(); BlankOutMessagePane(NULL); - MSG_DestroyPane(m_pPane); - m_pPane = NULL; } } @@ -1403,7 +1551,12 @@ void C3PaneMailFrame::DoOpenMessage(BOOL bReuse) pFrame->ActivateFrame(); } } - m_pOutliner->SelectItem(((CMessageOutliner*)m_pOutliner)->GetCurrentSelected()); + int nPreviousSel = ((CMessageOutliner*)m_pOutliner)->GetCurrentSelected(); + if (-1 != nPreviousSel) + { + m_pOutliner->SelectItem(nPreviousSel); + m_pOutliner->ScrollIntoView(nPreviousSel); + } } } } @@ -1452,7 +1605,10 @@ void C3PaneMailFrame::OnOpenNewFrame() { int nIndex = m_pFolderOutliner->GetCurrentSelected(); if (nIndex != -1) - m_pFolderOutliner->SelectItem(nIndex); + { + m_pFolderOutliner->SelectItem(nIndex); + m_pFolderOutliner->ScrollIntoView(nIndex); + } } } } @@ -1571,6 +1727,24 @@ void C3PaneMailFrame::DoUndoNavigate( MSG_MotionType motionCmd ) } } +// File Menu Items + +void C3PaneMailFrame::OnEmptyTrash() +{ + MSG_FolderLine folderLine; + MSG_FolderInfo *curFolderInfo = MSG_GetCurFolder( m_pPane ); + if (MSG_GetFolderLineById(WFE_MSGGetMaster(), curFolderInfo, &folderLine)) + { + if (folderLine.flags & MSG_FOLDER_FLAG_TRASH) + { + BlankOutThreadPane(); + BlankOutMessagePane(curFolderInfo); + } + } + + CMailNewsFrame::OnEmptyTrash(); +} + // Edit Menu Items void C3PaneMailFrame::OnEditUndo() @@ -1585,6 +1759,62 @@ void C3PaneMailFrame::OnEditRedo() DoUndoNavigate(MSG_EditRedo); } +//lpttt->szText can only hold 80 characters +#define MAX_TOOLTIP_CHARS 79 +//status can only hold 1000 characters +#define MAX_STATUS_CHARS 999 + +LRESULT C3PaneMailFrame::OnFillInToolTip(WPARAM wParam, LPARAM lParam) +{ + HWND hwnd = (HWND)wParam; + LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT) lParam; + + CToolbarButton *pButton = (CToolbarButton *)CWnd::FromHandle(hwnd); + UINT nCommand = pButton->GetButtonCommand(); + + const char * pText = ""; + if(nCommand == ID_EDIT_DELETE_3PANE) + { + if(IsThreadFocus() || IsMessageFocus()) + { + pText = szLoadString(IDS_DELETEMESSAGE_TOOLTIP); + } + else + { + pText = szLoadString(IDS_DELETEFOLDER_TOOLTIP); + } + + } + + strncpy(lpttt->szText, pText, MAX_TOOLTIP_CHARS); + + return 1; +} + +LRESULT C3PaneMailFrame::OnFillInToolbarButtonStatus(WPARAM wParam, LPARAM lParam) +{ + UINT nCommand = LOWORD(wParam); + char *pStatus = (char*)lParam; + + const char * pText = ""; + + if(nCommand == ID_EDIT_DELETE_3PANE) + { + if(IsThreadFocus() || IsMessageFocus()) + { + pText = szLoadString(IDS_DELETEMESSAGE_STATUS); + } + else + { + pText = szLoadString(IDS_DELETEFOLDER_STATUS); + } + + } + + strncpy(pStatus, pText, MAX_TOOLTIP_CHARS); + return 1; +} + void C3PaneMailFrame::SelectMessage( MessageKey key ) { MSG_ViewIndex index = @@ -1603,11 +1833,25 @@ void C3PaneMailFrame::CreateThreadPane() if (m_pOutliner) m_pOutliner->SetPane(m_pPane); MSG_SetFEData( m_pPane, (LPVOID) (LPUNKNOWN) (LPMSGLIST) this ); +#ifdef MOZ_NEWADDR + AB_SetShowPropertySheetForEntryFunc(m_pPane, ShowPropertySheetForEntry); +#endif if (m_pInfoBar) m_pInfoBar->SetPane(m_pPane); } } +void C3PaneMailFrame::CreateMessagePane() +{ + m_pMessagePane = MSG_CreateMessagePane(GetMainContext()->GetContext(), m_pMaster ); + + if (m_pMessagePane) + { + MSG_SetFEData( m_pMessagePane, (LPVOID) (LPUNKNOWN) (LPMSGLIST) this ); + MSG_SetMessagePaneCallbacks(m_pMessagePane, &MsgPaneCB, NULL); + } +} + void C3PaneMailFrame::CreateFolderOutliner() { m_pFolderOutlinerParent = new CFolderOutlinerParent; @@ -1626,6 +1870,8 @@ void C3PaneMailFrame::CreateFolderOutliner() m_pFolderOutliner = DOWNCAST(CFolderOutliner, m_pFolderOutlinerParent->m_pOutliner); m_pFolderOutlinerParent->CreateColumns ( ); m_pFolderOutliner->SetPane(m_pFolderPane); + + MSG_SetFEData( m_pFolderPane, (LPVOID) (LPUNKNOWN) (LPMSGLIST) this ); } void C3PaneMailFrame::UpdateFolderPane(MSG_FolderInfo *pFolderInfo) @@ -1658,14 +1904,46 @@ BOOL C3PaneMailFrame::GetSelectedFolder(MSG_FolderLine* pFolderLine) else { int nIndex = m_pFolderOutliner->GetCurrentSelected(); - indices[0] = nIndex; - if (MSG_GetFolderLineByIndex(m_pFolderPane, indices[0], 1, pFolderLine)) - return TRUE; + if (count == 0) + { + indices[0] = nIndex; + if (MSG_GetFolderLineByIndex(m_pFolderPane, indices[0], 1, pFolderLine)) + return TRUE; + } + else + { + ASSERT(m_pPane); + if (m_pPane) + { + MSG_FolderInfo *pFolderInfo = MSG_GetCurFolder( m_pPane ); + if (pFolderInfo && MSG_GetFolderLineById(m_pMaster, pFolderInfo, pFolderLine)) + return TRUE; + } + } } } return FALSE; } +void C3PaneMailFrame::PrepareForDeleteFolder() +{ + MSG_FolderLine folderLine; + if (GetSelectedFolder(&folderLine)) + { + BlankOutMessagePane(folderLine.id); + DestroyMessagePane(); + CreateMessagePane(); + + BlankOutThreadPane(); + MSG_Pane *pTemp = m_pPane; + m_pPane = NULL; + MSG_DestroyPane(pTemp); + CreateThreadPane(); + + m_bBlockingFolderSelection = TRUE; + } +} + void C3PaneMailFrame::BlankOutThreadPane() { m_pOutliner->SelectItem(-1); @@ -1676,17 +1954,76 @@ void C3PaneMailFrame::BlankOutThreadPane() void C3PaneMailFrame::BlankOutMessagePane(MSG_FolderInfo *pFolderInfo) { - MSG_LoadMessage(m_pMessagePane, pFolderInfo, MSG_MESSAGEKEYNONE); - m_pChrome->SetDocumentTitle(""); - m_pMessageView->SetAttachments(NULL, 0); + if (m_pMessagePane) + { + MSG_LoadMessage(m_pMessagePane, pFolderInfo, MSG_MESSAGEKEYNONE); + m_pChrome->SetDocumentTitle(""); + m_pMessageView->SetAttachments(NULL, 0); + } +} + +void C3PaneMailFrame::DestroyMessagePane() +{ + if (m_pMessagePane) { + // Since MSG_DestroyPane can result in notifications that + // we may attempt to act upon with the dying pane, NULL + // it out first + MSG_Pane *pTemp = m_pMessagePane; + m_pMessagePane = NULL; + MSG_DestroyPane( pTemp ); + } +} + +void C3PaneMailFrame::BlankOutRightPanes() +{ + MSG_FolderInfo *pCurFolderInfo = MSG_GetCurFolder( m_pPane ); + if (pCurFolderInfo) + BlankOutMessagePane(pCurFolderInfo); + DestroyMessagePane(); + CreateMessagePane(); + + BlankOutThreadPane(); + MSG_Pane *pTemp = m_pPane; + m_pPane = NULL; + MSG_DestroyPane(pTemp); + CreateThreadPane(); +} + +void C3PaneMailFrame::CheckForChangeFocus() +{ + MSG_FolderInfo* pFolderInfo = NULL; + MSG_FolderLine folderLine; + + if (m_pPane) + pFolderInfo = MSG_GetCurFolder(m_pPane); + if (m_pFolderOutliner && m_pFolderPane) + { + MSG_ViewIndex *indices; + int count = 0; + + m_pFolderOutliner->GetSelection(indices, count); + if (count == 1) + MSG_GetFolderLineByIndex(m_pFolderPane, indices[0], 1, &folderLine); + } + if (!pFolderInfo || (pFolderInfo != folderLine.id)) + m_pOutliner->SetFocus(); } void C3PaneMailFrame::LoadFolder( MSG_FolderInfo *folderInfo, MessageKey key, int action ) { - if (m_pPane) { - if ( key == MSG_MESSAGEKEYNONE ) { + MSG_FolderInfo *curFolderInfo = MSG_GetCurFolder( m_pPane ); + if (curFolderInfo != folderInfo && m_pPane) + { + //remember last message + MessageKey lastKey = GetCurMessage(); + MSG_SetLastMessageLoaded(curFolderInfo, lastKey); + + if ( key == MSG_MESSAGEKEYNONE ) + { m_actionOnLoad = action; - } else { + } + else + { m_actionOnLoad = actionSelectKey; m_selPending = key; } @@ -1695,7 +2032,8 @@ void C3PaneMailFrame::LoadFolder( MSG_FolderInfo *folderInfo, MessageKey key, in UIForFolder( folderInfo ); - if (m_nLoadingFolder == 0) { + if (m_nLoadingFolder == 0) + { m_nLoadingFolder++; // FYI m_pOutliner->BlockSelNotify(TRUE); } @@ -1719,10 +2057,7 @@ MessageKey C3PaneMailFrame::GetCurMessage() const MSG_FolderInfo *C3PaneMailFrame::GetCurFolder() const { - if (m_pPane) - return MSG_GetCurFolder(m_pPane); - else - return NULL; + return m_pPane ? MSG_GetCurFolder( m_pPane ) : NULL; } LPCTSTR C3PaneMailFrame::GetWindowMenuTitle() @@ -1804,6 +2139,18 @@ BOOL C3PaneMailFrame::FileBookmark() return res; } +void C3PaneMailFrame::SetFocusWindowBackToFrame() +{ + CWnd* pWnd = GetFocus(); + if (m_pFocusWnd != pWnd) + m_pFocusWnd->SetFocus(); +} + +BOOL C3PaneMailFrame::MessageViewClosed() +{ + return m_pThreadSplitter->IsOnePaneClosed(); +} + C3PaneMailFrame *C3PaneMailFrame::FindFrame( MSG_FolderInfo *folderInfo ) { CGenericFrame *pFrame = theApp.m_pFrameList; diff --git a/mozilla/cmd/winfe/thrdfrm.h b/mozilla/cmd/winfe/thrdfrm.h index 9e56170507a..eabd5a2c4d1 100644 --- a/mozilla/cmd/winfe/thrdfrm.h +++ b/mozilla/cmd/winfe/thrdfrm.h @@ -20,6 +20,7 @@ #define _THRDFRM_H #include "mailfrm.h" +#include "msgview.h" ///////////////////////////////////////////////////////////////////////////// // C3PaneMailFrame frame @@ -38,6 +39,7 @@ protected: int m_nLoadingFolder; BOOL m_bDragCopying; + BOOL m_bBlockingFolderSelection; BOOL m_bNoScrollHack; @@ -51,12 +53,14 @@ protected: CMailNewsSplitter *m_pFolderSplitter; CMailNewsSplitter *m_pThreadSplitter; CThreadStatusBar m_barStatus; + CWnd* m_pFocusWnd; void UIForFolder( MSG_FolderInfo *folderInfo ); void DoOpenMessage(BOOL bReuse); void BlankOutThreadPane(); void BlankOutMessagePane(MSG_FolderInfo *folderInfo = NULL); - + void DestroyMessagePane(); + void HandleGetNNNMessageMenuItem(); // IMailFrame override virtual void PaneChanged( MSG_Pane *pane, XP_Bool asynchronous, MSG_PANE_CHANGED_NOTIFY_CODE, int32 value); @@ -81,11 +85,12 @@ protected: void CreateFolderOutliner(); void CreateThreadPane(); + void CreateMessagePane(); virtual void SetSort( int idSort ); - BOOL IsThreadFocus() const { return m_pOutliner && m_pOutliner == GetFocus(); } - BOOL IsMessageFocus() const; + BOOL IsThreadFocus() { return m_pOutliner && m_pOutliner == GetFocus(); } + BOOL IsMessageFocus() { return m_pMessageView && m_pMessageView->HasFocus(); } virtual void DoUpdateNavigate( CCmdUI* pCmdUI, MSG_MotionType cmd ); virtual void DoNavigate( MSG_MotionType msgCommand ); @@ -93,6 +98,8 @@ protected: virtual void GetMessageString( UINT nID, CString& rMessage ) const; + virtual void LoadFrameMenu(CMenu *pPopup, UINT nIndex); + // Helper void DoUndoNavigate( MSG_MotionType msgCommand ); @@ -103,7 +110,10 @@ protected: #endif afx_msg void OnClose(); afx_msg void OnDestroy(); + afx_msg void OnSetFocus( CWnd* pOldWnd ); + // File Menu Items + afx_msg void OnEmptyTrash (); // Edit Menu Items afx_msg void OnEditUndo(); afx_msg void OnEditRedo(); @@ -113,8 +123,9 @@ protected: afx_msg void OnUpdateSelectFlagged( CCmdUI *pCmdUI ); afx_msg void OnSelectAll(); afx_msg void OnUpdateSelectAll( CCmdUI *pCmdUI ); - afx_msg void OnEditProperties(); - afx_msg void OnUpdateProperties( CCmdUI *pCmdUI ); + afx_msg void OnUpdateDeleteFrom3Pane(CCmdUI* pCmdUI); + afx_msg void OnDeleteFrom3Pane(); + // View Menu Items afx_msg void OnViewMessage(); @@ -122,11 +133,13 @@ protected: afx_msg void OnViewCategories(); afx_msg void OnUpdateViewCategories( CCmdUI *pCmdUI ); afx_msg void OnViewFolder(); + afx_msg void OnUpdateViewFolder(CCmdUI *pCmdUI); // Message Menu Items afx_msg void OnMove( UINT nID ); afx_msg void OnCopy( UINT nID ); afx_msg void OnUpdateFile( CCmdUI *pCmdUI ); + afx_msg void OnIgnore(); afx_msg void OnUpdateIgnore(CCmdUI *pCmdUI); @@ -153,19 +166,32 @@ protected: afx_msg void OnUpdatePriority( CCmdUI *pCmdUI ); afx_msg void OnDoneGettingMail(); + afx_msg LRESULT OnFillInToolTip(WPARAM, LPARAM); + afx_msg LRESULT OnFillInToolbarButtonStatus(WPARAM, LPARAM); + + DECLARE_MESSAGE_MAP() void SelectMessage( MessageKey key ); - public: ~C3PaneMailFrame(); - + CMailNewsOutliner* GetFolderOutliner() { return m_pFolderOutliner; } + MSG_Pane* GetFolderPane() { return m_pFolderPane; } + void SetFocusWindow(CWnd* pWnd) { m_pFocusWnd = pWnd; } void LoadFolder( MSG_FolderInfo *folderInfo, MessageKey key = MSG_MESSAGEKEYNONE, int action = actionSelectFirst); void UpdateFolderPane(MSG_FolderInfo *pFolderInfo); BOOL GetSelectedFolder(MSG_FolderLine* pFolderLine); + void SetFocusWindowBackToFrame(); + void BlankOutRightPanes(); + void CheckForChangeFocus(); + void BlockFolderSelection (BOOL block) { m_bBlockingFolderSelection = block; } + void PrepareForDeleteFolder(); + void CheckFocusWindow(BOOL bUseTab = TRUE); + void CheckShiftKeyFocusWindow(); + BOOL MessageViewClosed(); virtual MessageKey GetCurMessage() const; virtual MSG_FolderInfo *GetCurFolder() const; diff --git a/mozilla/cmd/winfe/tlbutton.h b/mozilla/cmd/winfe/tlbutton.h index 2f1d674d732..ea2d0e29d5b 100644 --- a/mozilla/cmd/winfe/tlbutton.h +++ b/mozilla/cmd/winfe/tlbutton.h @@ -25,8 +25,10 @@ #include "winproto.h" -#include "tooltip.h" +/* Needed for IconType enum */ +#include "rdfacc.h" +#include "tooltip.h" #define SHOW_ALL_CHARACTERS -1 diff --git a/mozilla/cmd/winfe/toolbar.cpp b/mozilla/cmd/winfe/toolbar.cpp index a69a0300c43..9c3eb454779 100755 --- a/mozilla/cmd/winfe/toolbar.cpp +++ b/mozilla/cmd/winfe/toolbar.cpp @@ -25,6 +25,8 @@ #include "stdafx.h" +#include "rosetta.h" + // arrays of IDs used to initialize control bars // This must correspond to position in toolbar @@ -42,7 +44,7 @@ static UINT BASED_CODE buttons[] = ID_PLACES, ID_VIEW_LOADIMAGES, ID_FILE_PRINT, - ID_SECURITY, + HG28118 ID_NAVIGATE_INTERRUPT, ID_HOTLIST_MCOM }; diff --git a/mozilla/cmd/winfe/wfemsg.h b/mozilla/cmd/winfe/wfemsg.h index 759ce8aba53..28132cf2aea 100644 --- a/mozilla/cmd/winfe/wfemsg.h +++ b/mozilla/cmd/winfe/wfemsg.h @@ -30,9 +30,21 @@ CFolderFrame *WFE_MSGOpenFolders(); // In fldrfrm.cpp CFolderFrame *WFE_MSGOpenNews(); // In fldrfrm.cpp // Master API +//gets current master. If there isn't one it creates +// one MSG_Master *WFE_MSGGetMaster(); // In msgfrm.cpp +//gets current master. If there isn't one it returns NULL. +MSG_Master* WFE_MSGGetMasterValue(); void WFE_MSGDestroyMaster(); // In msgfrm.cpp +//building the add address book popup In addrfrm.cpp +//bCreateMenuItem is TRUE if the add menu items don't already exist. +void WFE_MSGBuildAddAddressBookPopups(HMENU hMenu, int nStartPosition, + BOOL bCreateMenuItem, MWContext *pContext); + +void WFE_MSGLaunchMigrationUtility(HWND parent, int calledFromAddressBook, + char* directory); + // Pref API void WFE_MSGInit(); // In mailmisc.cpp void WFE_MSGShutdown(); @@ -40,9 +52,38 @@ BOOL WFE_MSGCheckWizard( CWnd *pParent = NULL ); // In mailfrm.cpp void WFE_MSGOpenSearch(); void WFE_MSGSearchClose(); -void WFE_MSGOpenLDAPSearch(); -void WFE_MSGLDAPSearchClose(); void WFE_MSGOpenAB(); void WFE_MSGABClose(); +void WFE_Synchronize(CWnd *pParent, BOOL bExitAfterSynchronizing); //in offlndlg.cpp + + +//in mnprefs.cpp + +typedef enum +{ + CHAR_USERNAME, + BOOL_REMEMBER_PASSWORD, + BOOL_CHECK_NEW_MAIL, + INT_CHECK_TIME, + BOOL_OFFLINE_DOWNLOAD, + INT_DELETE_MODEL, + BOOL_IS_SECURE, + CHAR_PERAONAL_DIR, + CHAR_PUBLIC_DIR, + CHAR_OTHER_USER_DIR, + BOOL_OVERRIDE_NAMESPACES, + BOOL_EMPTY_TRASH_ON_EXIT, + BOOL_CLEANUP_INBOX_ON_EXIT + +}IMAP_PREF; + +BOOL IMAP_PrefIsLocked(const char *pHostName, int nID); +void IMAP_SetCharPref(const char *pHostName, int nID, const char* pValue); +void IMAP_SetIntPref(const char *pHostName, int nID, int32 lValue); +void IMAP_SetBoolPref(const char *pHostName, int nID, XP_Bool bValue); +void IMAP_GetCharPref(const char *pHostName, int nID, char **hBuffer); +void IMAP_GetIntPref(const char *pHostName, int nID, int32 *pInt); +void IMAP_GetBoolPref(const char *pHostName, int nID, XP_Bool *pBool); + #endif diff --git a/mozilla/cmd/winfe/winli.cpp b/mozilla/cmd/winfe/winli.cpp index 9e7ba17435f..0dc2d9aedcd 100644 --- a/mozilla/cmd/winfe/winli.cpp +++ b/mozilla/cmd/winfe/winli.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- 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 @@ -12,194 +12,245 @@ * * 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 + * Copyright (C) 1997 Netscape Communications Corporation. All Rights * Reserved. */ - #include "stdafx.h" - #include "prefapi.h" - #include "logindg.h" - #include "winli.h" - #include "li_public.h" - #include "net.h" - #include "cast.h" - - - /* This function will "spin" until it retreives the necessary files (LI & MC). It will then - * continue with the normal initialization - */ - Bool FEU_GetCriticalFiles(const char * szProfileName, const char * szProfileDir) - { - int iNumFiles = 0; - theApp.m_bInGetCriticalFiles = TRUE; - - LI_StartGettingCriticalFiles(&iNumFiles); - // REMIND: Add Mission Control .JSC file retreival here - - while (iNumFiles > 0) { - NET_ProcessNet(NULL, NET_EVERYTIME_TYPE); - FEU_StayingAlive(); - } - theApp.m_bInGetCriticalFiles = FALSE; - - return login_ProfileSelectedCompleteTheLogin(szProfileName,szProfileDir); +#ifdef MOZ_LOC_INDEP +#include "stdafx.h" +#include "prefapi.h" +#include "logindg.h" +#include "winli.h" +#include "li_public.h" +#include "net.h" +#include "cast.h" +#include "secnav.h" +#include "LIConflictDlg.h" + +static int LIActive = 0; + +void FE_makeConflictDialog(LIConflictDialogCallback f, void* closure, const char* title, const char* message, + const char* leftButton, const char* rightButton) +{ + // Create a new one, set bSuicide to TRUE so it deletes itself on exit. + new CLIConflictDlg(f,closure,title,message,leftButton,rightButton,PR_TRUE); +} + + +void winli_RegisterCallbacks() +{ + LI_RegisterCallbacks(); +} + +BOOL winli_StartAndVerify() +{ + int iResults; + theApp.m_bInGetCriticalFiles = TRUE; + + LI_StartAndVerify(&iResults); + + while (iResults > 0) { + NET_ProcessNet((NETSOCK)-1, NET_EVERYTIME_TYPE); + FEU_StayingAlive(); } - - Bool winli_QueryNetworkProfile(void) { - #ifdef _DEBUG - // REMIND need to get rid of this. - PREF_SetCharPref("li.protocol","ldap"); - PREF_SetCharPref("li.server.ldap.url","ldap://nearpoint.mcom.com/nsLIProfileName=$USERID,ou=LIProfiles,o=Airius.com"); - PREF_SetCharPref("li.server.ldap.userbase","uid=$USERID,ou=People,o=Airius.com"); -// PREF_SetCharPref("li.server.ldap.searchBase","uid=$USERID, ou=LIProfiles, o=airius.com"); -// PREF_SetCharPref("li.login.name",""); - #endif + theApp.m_bInGetCriticalFiles = FALSE; - CRemoteProfileLoginDlg dlg; - if (dlg.DoModal() == IDOK) { - int ret; + if (iResults == 0) + return TRUE; + + return FALSE; +} + +/* This function will "spin" until it retreives the necessary files (LI & MC). It will then + * continue with the normal initialization + */ +Bool FEU_GetCriticalFiles(const char * szProfileName, const char * szProfileDir) +{ + int iResults = 0; + theApp.m_bInGetCriticalFiles = TRUE; + + // if we got here, li is active + LIActive = 1; + + LI_GetFiles(&iResults); + + while (iResults > 0) { + NET_ProcessNet((NETSOCK)-1, NET_EVERYTIME_TYPE); + FEU_StayingAlive(); + } + + theApp.m_bInGetCriticalFiles = FALSE; + +// return login_ProfileSelectedCompleteTheLogin(szProfileName,szProfileDir); + return TRUE; +} + + +Bool winli_QueryNetworkProfile(BOOL bTempProfile) { + CRemoteProfileLoginDlg dlg; + + if (dlg.DoModal() == IDOK) { + CString pTempDir; + if (bTempProfile) { + int ret; XP_StatStruct statinfo; - - PREF_SetBoolPref("li.enabled",TRUE); - - CString pTempDir; - - if(getenv("TEMP")) - pTempDir = getenv("TEMP"); // environmental variable - if (pTempDir.IsEmpty() && getenv("TMP")) - pTempDir = getenv("TMP"); // How about this environmental variable? + + if(getenv("TEMP")) + pTempDir = getenv("TEMP"); // environmental variable + if (pTempDir.IsEmpty() && getenv("TMP")) + pTempDir = getenv("TMP"); // How about this environmental variable? if (pTempDir.IsEmpty()) { // Last resort: put it in the windows directory char path[_MAX_PATH]; GetWindowsDirectory(path, sizeof(path)); pTempDir = path; } - + pTempDir += "\\nstmpusr"; ret = _stat((char *)(const char *)pTempDir, &statinfo); if (ret == 0) { XP_RemoveDirectoryRecursive(pTempDir, xpURL); } mkdir(pTempDir); - + login_CreateEmptyProfileDir(pTempDir,NULL,TRUE); - + theApp.m_UserDirectory = pTempDir; if (!pTempDir.IsEmpty()) PREF_SetDefaultCharPref( "profile.directory", pTempDir ); - - return FEU_GetCriticalFiles(dlg.m_csLoginName,pTempDir); - } - return FALSE; + } + return FEU_GetCriticalFiles(dlg.m_csLoginName, theApp.m_UserDirectory); } - + return FALSE; +} - void verifyLoginCallbackFunction2(void * closure, LIStatus result) { - int * pi = (int *)closure; - if(result == LINoError) { - *pi = 0; - return ; +/* This function will "spin" until it gets the verify login return It will then + * continue with FEU_GetCriticalFiles to fetch the startup files. + */ +Bool FEU_StartGetCriticalFiles(const char * szProfileName, const char * szProfileDir) +{ + // the login failed if the return is false + if (! winli_StartAndVerify()) + return FALSE; + + return FEU_GetCriticalFiles(szProfileName, szProfileDir); +} + +// Remote Profile Login Dialog code +CRemoteProfileLoginDlg::CRemoteProfileLoginDlg(CWnd* pParent /*=NULL*/) + : CDialog(CRemoteProfileLoginDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CLoginDlg) + m_csLoginName = _T(""); + m_csPasswordName = _T(""); + //}}AFX_DATA_INIT +} + + +// returns true when done +Bool winli_Exit() +{ + static BOOL beenHere = FALSE; + static int iResult; + + if (LIActive > 0) { // REMIND, is this the right test to do? should we check the pref instead? + if (!beenHere) { + beenHere = TRUE; + + theApp.m_bInGetCriticalFiles = TRUE; + + + LI_Exit(&iResult); } - *pi = -result; - - LI_Shutdown(); - //REMIND deal with error here. - AfxMessageBox("You cannot be logged in to the li server -- fix this error."); - } - - /* This function will "spin" until it gets the verify login return It will then - * continue with FEU_GetCriticalFiles to fetch the startup files. - */ - Bool FEU_StartGetCriticalFiles(const char * szProfileName, const char * szProfileDir) - { - int iResult = 1; - theApp.m_bInGetCriticalFiles = TRUE; - - LI_Init(); - - LIMediator::verifyLogin(verifyLoginCallbackFunction2,(void*)&iResult); - - while (iResult > 0) { - NET_ProcessNet(NULL, NET_EVERYTIME_TYPE); - FEU_StayingAlive(); - } - // the login failed if iResult is < 0 - // REMIND we need to find a way to get back to the profile dialog. - if (iResult < 0) + NET_ProcessNet((NETSOCK)-1, NET_EVERYTIME_TYPE); + FEU_StayingAlive(); + if (iResult > 0) return FALSE; - theApp.m_bInGetCriticalFiles = FALSE; - - return FEU_GetCriticalFiles(szProfileName, szProfileDir); - } - - // Remote Profile Login Dialog code - CRemoteProfileLoginDlg::CRemoteProfileLoginDlg(CWnd* pParent /*=NULL*/) - : CDialog(CRemoteProfileLoginDlg::IDD, pParent) - { - //{{AFX_DATA_INIT(CLoginDlg) - m_csLoginName = _T(""); - m_csPasswordName = _T(""); - //}}AFX_DATA_INIT - } - - - void CRemoteProfileLoginDlg::DoDataExchange(CDataExchange* pDX) - { - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CLoginDlg) - DDX_Text(pDX, IDC_LOGINNAME, m_csLoginName); - DDX_Text(pDX, IDC_PASSWORD, m_csPasswordName); - //}}AFX_DATA_MAP - } - - BOOL CRemoteProfileLoginDlg::OnInitDialog() - { - BOOL bRet; - bRet = CDialog::OnInitDialog(); - - CWnd * widget; - - widget = GetDlgItem(IDC_LOGINNAME); - widget->SetFocus(); - - return bRet; - } - -void verifyLoginCallbackFunction(void * closure, - LIStatus result) { - if(result == LINoError) { - ((CRemoteProfileLoginDlg*)closure)->Done(); - return; + LIActive = 0; + + /* ok to close browser */ + theApp.m_bInGetCriticalFiles = FALSE; + } - - LI_Shutdown(); - //REMIND deal with error here. - AfxMessageBox("Error"); + LI_UnregisterCallbacks(); + return TRUE; } -void CRemoteProfileLoginDlg::Done() + +void CRemoteProfileLoginDlg::DoDataExchange(CDataExchange* pDX) { - CDialog::OnOK(); + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CLoginDlg) + DDX_Text(pDX, IDC_LOGINNAME, m_csLoginName); + DDX_Text(pDX, IDC_PASSWORD, m_csPasswordName); + //}}AFX_DATA_MAP } +void CRemoteProfileLoginDlg::SetCheckItemLock(CString csPrefName, int nID) +{ + if (PREF_PrefIsLocked(csPrefName)) + GetDlgItem(nID)->EnableWindow(FALSE); +} + + /* fill the 'global' buffer that is passed in with the preference */ +void CRemoteProfileLoginDlg::GetPreferenceString(const CString name, CString& buffer, int nID) +{ + char *pstr; + + PREF_CopyCharPref(name, &pstr); + SetCheckItemLock(name, nID); + buffer = pstr; + if (pstr) + XP_FREE(pstr); +} + + +BOOL CRemoteProfileLoginDlg::OnInitDialog() +{ + BOOL bRet; + + GetPreferenceString("li.login.name", m_csLoginName, IDC_LOGINNAME); + + bRet = CDialog::OnInitDialog(); + + CWnd * widget; + + widget = GetDlgItem(IDC_LOGINNAME); + widget->SetFocus(); + + return bRet; +} + void CRemoteProfileLoginDlg::OnOK() { - UpdateData(); PREF_SetCharPref("li.login.name",m_csLoginName); - PREF_SetCharPref("li.login.password",m_csPasswordName); - LI_Init(); + // always save the password, we will get rid of it in startandverify if + // the user doesn't want it saved. + LI_SavePassword(m_csPasswordName); + + PREF_SetBoolPref("li.enabled",TRUE); + + if (winli_StartAndVerify()) + CDialog::OnOK(); + else // we failed + PREF_SetBoolPref("li.enabled",FALSE); - LIMediator::verifyLogin(verifyLoginCallbackFunction,(void*)this); } + void CAdvRemoteProfileLoginDlg::SetCheckItemLock(CString csPrefName, int nID) + { + if (PREF_PrefIsLocked(csPrefName)) + GetDlgItem(nID)->EnableWindow(FALSE); + } + void CRemoteProfileLoginDlg::OnAdvanced() { CAdvRemoteProfileLoginDlg dlg; @@ -213,7 +264,18 @@ void CRemoteProfileLoginDlg::OnOK() END_MESSAGE_MAP() /* fill the 'global' buffer that is passed in with the preference */ - void GetPreferenceString(const CString name, CString& buffer) + void CAdvRemoteProfileLoginDlg::GetPreferenceString(const CString name, CString& buffer, int nID) + { + char *pstr; + + PREF_CopyCharPref(name, &pstr); + SetCheckItemLock(name, nID); + buffer = pstr; + if (pstr) + XP_FREE(pstr); + } + + void CAdvRemoteProfileLoginDlg::GetPreferenceString(const CString name, CString& buffer) { char *pstr; @@ -223,26 +285,15 @@ void CRemoteProfileLoginDlg::OnOK() XP_FREE(pstr); } + void CAdvRemoteProfileLoginDlg::GetPreferenceBool(const CString name, BOOL* bPref, int nID) + { + PREF_GetBoolPref(name, bPref); + SetCheckItemLock(name, nID); + } + CAdvRemoteProfileLoginDlg::CAdvRemoteProfileLoginDlg(CWnd* pParent /*=NULL*/) : CDialog(CAdvRemoteProfileLoginDlg::IDD, pParent) { - CString csProtoStr; - //{{AFX_DATA_INIT(CLoginDlg) - GetPreferenceString("li.protocol", csProtoStr); - m_iLDAP = (csProtoStr == "ldap"); - m_iHTTP = (csProtoStr == "http"); - GetPreferenceString("li.server.ldap.url", m_csLdapAddress); - GetPreferenceString("li.server.ldap.userbase", m_csLdapBase); - GetPreferenceString("li.server.http.baseURL", m_csHttpBase); - PREF_GetBoolPref("li.client.bookmarks", &m_bBookmarks); - PREF_GetBoolPref("li.client.cookies", &m_bCookies); - PREF_GetBoolPref("li.client.filters", &m_bFilters); - PREF_GetBoolPref("li.client.addressbook", &m_bAddressBook); - PREF_GetBoolPref("li.client.navcntr", &m_bNavcntr); - PREF_GetBoolPref("li.client.liprefs", &m_bPrefs); - PREF_GetBoolPref("li.client.security", &m_bSecurity); - PREF_GetBoolPref("li.client.javasecurity", &m_bJavaSec); - //}}AFX_DATA_INIT } BOOL CAdvRemoteProfileLoginDlg::OnInitDialog() @@ -250,7 +301,26 @@ void CRemoteProfileLoginDlg::OnOK() BOOL bRet; bRet = CDialog::OnInitDialog(); - CButton * widget; + CString csProtoStr; + //{{AFX_DATA_INIT(CLoginDlg) + GetPreferenceString("li.protocol", csProtoStr); + + m_iLDAP = (csProtoStr == "ldap"); + m_iHTTP = (csProtoStr == "http"); + GetPreferenceString("li.server.ldap.url", m_csLdapAddress, IDC_LDAP_ADDRESS); + GetPreferenceString("li.server.ldap.userbase", m_csLdapBase, IDC_LDAP_SEARCHBASE); + GetPreferenceString("li.server.http.baseURL", m_csHttpBase, IDC_HTTP_ADDRESS); + GetPreferenceBool("li.client.bookmarks", &m_bBookmarks, IDC_BOOKMARKS); + GetPreferenceBool("li.client.cookies", &m_bCookies, IDC_COOKIES); + GetPreferenceBool("li.client.filters", &m_bFilters, IDC_FILTERS); + GetPreferenceBool("li.client.addressbook", &m_bAddressBook, IDC_ADDBOOK); + GetPreferenceBool("li.client.globalhistory", &m_bHistory, IDD_HISTORY); + GetPreferenceBool("li.client.liprefs", &m_bPrefs, IDC_SUGGESTIONS); + GetPreferenceBool("li.client.security", &m_bSecurity, IDC_SECURITY_TYPE); + GetPreferenceBool("li.client.javasecurity", &m_bJavaSec, IDC_JAVA); + //}}AFX_DATA_INIT + + CButton * widget; widget = (CButton *) GetDlgItem(IDC_LDAP_SERVER); widget->SetCheck(1); @@ -258,7 +328,10 @@ void CRemoteProfileLoginDlg::OnOK() widget = (CButton *) GetDlgItem(IDC_HTTP_SERVER); widget->SetCheck(0); - UpdateData(FALSE); + SetCheckItemLock("li.protocol", IDC_LDAP_SERVER); + SetCheckItemLock("li.protocol", IDC_HTTP_SERVER); + + UpdateData(FALSE); return bRet; } @@ -273,7 +346,7 @@ void CRemoteProfileLoginDlg::OnOK() DDX_Check(pDX, IDC_COOKIES, m_bCookies); DDX_Check(pDX, IDC_FILTERS, m_bFilters); DDX_Check(pDX, IDC_ADDBOOK, m_bAddressBook); - DDX_Check(pDX, IDC_SELECTEDBOOKMARKS, m_bNavcntr); + DDX_Check(pDX, IDD_HISTORY, m_bHistory); DDX_Check(pDX, IDC_SUGGESTIONS, m_bPrefs); DDX_Check(pDX, IDC_JAVA, m_bJavaSec); DDX_Check(pDX, IDC_SECURITY_TYPE, m_bSecurity); @@ -306,7 +379,7 @@ void CRemoteProfileLoginDlg::OnOK() PREF_SetBoolPref("li.client.cookies", IsDlgButtonChecked(IDC_COOKIES) ); PREF_SetBoolPref("li.client.filters", IsDlgButtonChecked(IDC_FILTERS) ); PREF_SetBoolPref("li.client.addressbook", IsDlgButtonChecked(IDC_ADDBOOK) ); - PREF_SetBoolPref("li.client.navcntr", IsDlgButtonChecked(IDC_SELECTEDBOOKMARKS) ); + PREF_SetBoolPref("li.client.globalhistory", IsDlgButtonChecked(IDD_HISTORY) ); PREF_SetBoolPref("li.client.liprefs", IsDlgButtonChecked(IDC_SUGGESTIONS) ); PREF_SetBoolPref("li.client.security", IsDlgButtonChecked(IDC_SECURITY_TYPE) ); PREF_SetBoolPref("li.client.javasecurity", IsDlgButtonChecked(IDC_JAVA) ); @@ -349,46 +422,4 @@ void CRemoteProfileLoginDlg::OnOK() //}}AFX_MSG_MAP END_MESSAGE_MAP() - BOOL CXPProgressDialog::OnInitDialog( ) - { - m_ProgressMeter.SubclassDlgItem( IDC_PROGRESSMETER, this ); - return CDialog::OnInitDialog(); - } - - BEGIN_MESSAGE_MAP(CXPProgressDialog, CDialog) - ON_WM_CREATE() - END_MESSAGE_MAP() - - CXPProgressDialog::CXPProgressDialog(CWnd* pParent /*=NULL*/) - : CDialog(IDD_XPPROGRESS, pParent) - { - m_Min =0; - m_Max =100; - m_Range = 100; - m_cancelCallback = NULL; - m_cancelClosure = NULL; - } - - BOOL CXPProgressDialog::PreTranslateMessage( MSG* pMsg ) - { - return CDialog::PreTranslateMessage(pMsg); - } - - int CXPProgressDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) - { - int res = CDialog::OnCreate(lpCreateStruct); - return res; - } - - void CXPProgressDialog::OnCancel() - { - if (m_cancelCallback) - m_cancelCallback(m_cancelClosure); - DestroyWindow(); - } - - void CXPProgressDialog::DoDataExchange(CDataExchange *pDX) - { - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_PERCENTCOMPLETE, m_PercentComplete); - } +#endif //MOZ_LOC_INDEP diff --git a/mozilla/cmd/winfe/winli.h b/mozilla/cmd/winfe/winli.h index 8e969e7a89f..8b9e76bd9f5 100644 --- a/mozilla/cmd/winfe/winli.h +++ b/mozilla/cmd/winfe/winli.h @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- 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 @@ -12,39 +12,20 @@ * * 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 + * Copyright (C) 1997 Netscape Communications Corporation. All Rights * Reserved. */ +#ifdef MOZ_LOC_INDEP + #include "widgetry.h" #include "pw_public.h" -extern Bool winli_QueryNetworkProfile(void); +extern Bool winli_QueryNetworkProfile(BOOL bTempProfile); extern Bool FEU_StartGetCriticalFiles(const char * szProfileName, const char * szProfileDir); - -class CXPProgressDialog: public CDialog -{ -public: - CXPProgressDialog(CWnd* pParent =NULL); - - virtual BOOL OnInitDialog( ); - BOOL PreTranslateMessage( MSG* pMsg ); - CProgressMeter m_ProgressMeter; - CStatic m_PercentComplete; - int32 m_Min; - int32 m_Max; - int32 m_Range; - PW_CancelCallback m_cancelCallback; - void * m_cancelClosure; - -protected: - virtual void OnCancel(); - virtual void DoDataExchange(CDataExchange*); - afx_msg int OnCreate( LPCREATESTRUCT ); - - DECLARE_MESSAGE_MAP() -}; +extern Bool winli_Exit(void); +extern void winli_RegisterCallbacks(); ///////////////////////////////////////////////////////////////////////////// @@ -74,6 +55,8 @@ public: // Implementation protected: + void CRemoteProfileLoginDlg::GetPreferenceString(const CString name, CString & buffer, int nID); + void CRemoteProfileLoginDlg::SetCheckItemLock(CString csPrefName, int nID) ; // Generated message map functions //{{AFX_MSG(CLoginDlg) @@ -106,7 +89,7 @@ public: BOOL m_bAddressBook; BOOL m_bSecurity; BOOL m_bJavaSec; - BOOL m_bNavcntr; + BOOL m_bHistory; BOOL m_bPrefs; int m_iLDAP; int m_iHTTP; @@ -123,6 +106,10 @@ public: // Implementation protected: + void CAdvRemoteProfileLoginDlg::GetPreferenceString(const CString name, CString & buffer, int nID); + void CAdvRemoteProfileLoginDlg::GetPreferenceString(const CString name, CString& buffer) ; + void CAdvRemoteProfileLoginDlg::GetPreferenceBool(const CString name, BOOL * bPref, int nID); + void CAdvRemoteProfileLoginDlg::SetCheckItemLock(CString csPrefName, int nID) ; // Generated message map functions //{{AFX_MSG(CLoginDlg) @@ -136,3 +123,5 @@ protected: private: }; + +#endif /* MOZ_LOC_INDEP */ diff --git a/mozilla/cmd/winfe/woohoo.cpp b/mozilla/cmd/winfe/woohoo.cpp index 057aac2cb71..eb53144ba91 100644 --- a/mozilla/cmd/winfe/woohoo.cpp +++ b/mozilla/cmd/winfe/woohoo.cpp @@ -35,7 +35,9 @@ #endif void WFE_LJ_StartDebugger(void); - +#ifdef MOZ_MAIL_NEWS +extern "C" void WFE_StartCalendar(); +#endif // // Parse the command line for component launch arguments // Set bRemove to TRUE if you want to remove the switch from pszCommandLine @@ -74,9 +76,17 @@ BOOL CNetscapeApp::ParseComponentArguments(char * pszCommandLine,BOOL bRemove) m_bCreateInboxMAPI = TRUE; // rhp - for MAPI startup + }else if (IsRuntimeSwitch("-NABAPI", pszCommandLine, bRemove)){ + m_bCreateNABWin = TRUE; + // rhp - for Address Book API startup + }else if (IsRuntimeSwitch("-ADDRESS", pszCommandLine, bRemove)){ m_bCreateAddress = TRUE; + #endif /* MOZ_MAIL_NEWS */ + }else if (IsRuntimeSwitch("-CALENDAR", pszCommandLine, bRemove)){ + m_bCreateCalendar = TRUE; + }else if (IsRuntimeSwitch("-IMPORT", pszCommandLine, bRemove)){ m_bCreateLDIF_IMPORT = TRUE; @@ -139,6 +149,10 @@ BOOL CNetscapeApp::ExistComponentArguments(char * pszCommandLine) m_bCreateInboxMAPI = TRUE; // rhp - for MAPI startup + }else if (strcasestr(pszCommandLine, "-NABAPI" )) { + m_bCreateNABWin = TRUE; + // rhp - for Address Book API startup + } else if (strcasestr(pszCommandLine, "-FOLDERS" )){ m_bCreateFolders = TRUE; @@ -155,6 +169,9 @@ BOOL CNetscapeApp::ExistComponentArguments(char * pszCommandLine) } else if (strcasestr(pszCommandLine, "-NETCASTER" )){ m_bCreateNetcaster = TRUE; + }else if (strcasestr(pszCommandLine, "-CALENDAR" )){ + m_bCreateCalendar = TRUE; + #ifdef MOZ_MAIL_NEWS } else if (strcasestr(pszCommandLine, "-COMPOSE" )){ m_bCreateCompose = TRUE; @@ -467,6 +484,10 @@ void CNetscapeApp::LaunchComponentWindow(int iStartupMode, char *pszCmdLine) //starts the news and opens the default news server and group in split pain. WFE_MSGOpenNews(); break; + + case STARTUP_CALENDAR: + WFE_StartCalendar(); + break; #endif // MOZ_MAIL_NEWS #ifdef EDITOR @@ -518,7 +539,12 @@ void CNetscapeApp::LaunchComponentWindow(int iStartupMode, char *pszCmdLine) // rhp - added STARTUP_CLIENT_MAPI for starting MAPI if ((iStartupMode & STARTUP_BROWSER || iStartupMode & STARTUP_EDITOR || // if startup browser or editor !(iStartupMode & (STARTUP_JAVA_DEBUG_AGENT|STARTUP_BROWSER|STARTUP_NEWS|STARTUP_MAIL|STARTUP_ADDRESS - |STARTUP_INBOX|STARTUP_CLIENT_MAPI|STARTUP_COMPOSE|STARTUP_FOLDER|STARTUP_FOLDERS)) || // or invalid data +#ifdef MOZ_MAIL_NEWS + |STARTUP_INBOX|STARTUP_COMPOSE|STARTUP_FOLDER|STARTUP_FOLDERS|STARTUP_NETCASTER|STARTUP_CALENDAR + |STARTUP_CLIENT_MAPI|STARTUP_CLIENT_ABAPI)) || // or invalid data +#else + |STARTUP_INBOX|STARTUP_CLIENT_MAPI|STARTUP_COMPOSE|STARTUP_FOLDER|STARTUP_FOLDERS|STARTUP_CALENDAR)) || // or invalid data +#endif /* MOZ_MAIL_NEWS */ m_bKioskMode )) { // or kiosk mode - start browser #ifdef EDITOR @@ -799,7 +825,7 @@ MSG_AttachmentData * CNetscapeApp::BuildAttachmentListFromFile(char *pszAttachFi //Purpose: Initialize iStartupMode with the appropriate component launch // value. ///////////////////////////////////////////////////////////////////////////// -void CNetscapeApp::SetStartupMode(int *iStartupMode) +void CNetscapeApp::SetStartupMode(int32 *iStartupMode) { // set launch type and clear global flag. if (m_bAccountSetup) { // MUST be first to ensure only in browser @@ -865,6 +891,10 @@ void CNetscapeApp::SetStartupMode(int *iStartupMode) //over ride prefference settings for this mode #endif /* MOZ_MAIL_NEWS */ + }else if (m_bCreateCalendar) { + *iStartupMode= STARTUP_CALENDAR; + m_bCreateCalendar= 0; + } else if (m_bCreateBrowser) { *iStartupMode= STARTUP_BROWSER; m_bCreateBrowser= 0; @@ -886,6 +916,17 @@ void CNetscapeApp::SetStartupMode(int *iStartupMode) }else if (m_bAccountSetupStartupJava) { m_bAccountSetupStartupJava = FALSE; *iStartupMode= STARTUP_JAVA; +#ifdef MOZ_MAIL_NEWS + // rhp - for MAPI startup + }else if (m_bCreateInboxMAPI) { + *iStartupMode= STARTUP_CLIENT_MAPI; + m_bCreateInboxMAPI= 0; + // rhp - for Address Book startup + }else if (m_bCreateNABWin) { + *iStartupMode= STARTUP_CLIENT_ABAPI; + m_bCreateNABWin= 0; + // rhp - for MAPI startup +#endif /* MOZ_MAIL_NEWS */ } else { // Implied component checking here. @@ -964,7 +1005,7 @@ BOOL CNetscapeApp::ProcessCommandLineDDE(char *pszDDECommand) if (ExistComponentArguments(pszCommand)) { - int iStartupMode = 0; + int32 iStartupMode = 0; SetStartupMode(&iStartupMode); LaunchComponentWindow(iStartupMode,pszCommand); } diff --git a/mozilla/cmd/xfe/Makefile b/mozilla/cmd/xfe/Makefile index 994fd41627b..e6623259495 100644 --- a/mozilla/cmd/xfe/Makefile +++ b/mozilla/cmd/xfe/Makefile @@ -106,6 +106,7 @@ REQUIRES =\ java \ ldap \ xfeicons \ + progress \ $(NULL) CSRCS = \ @@ -127,7 +128,6 @@ CSRCS = \ strings.c \ visual.c \ MozillaWm.c \ - lite_stubs.c \ commands.c \ dialogs.c \ hot.c \ @@ -143,11 +143,16 @@ CSRCS = \ xfe.c \ editor.c \ editordialogs.c \ + addrbk.c \ $(NULL) +ifndef MOZ_MAIL_NEWS +CSRCS += lite_stubs.c \ + $(NULL) +endif + ifdef MOZ_MAIL_NEWS CSRCS += \ - addrbk.c \ mailattach.c \ mailcompose.c \ movemail.c \ @@ -284,30 +289,29 @@ BASIC_LIBS_2 = \ ifdef MOZ_MAIL_NEWS BASIC_LIBS += \ - $(DIST)/lib/libmsg.a \ $(DIST)/lib/libnet.a \ + $(DIST)/lib/libns_mime.a \ $(NULL) endif BASIC_LIBS += \ $(DIST)/lib/libmisc.a \ + $(DIST)/lib/libprgrss.a \ $(NULL) ifdef MOZ_MAIL_NEWS BASIC_LIBS += \ - $(DIST)/lib/libaddr.a \ - $(NULL) -endif - -ifdef MOZ_NEO -BASIC_LIBS += \ - $(DIST)/lib/libneo.a \ - $(NULL) -endif - -ifdef MOZ_MAIL_NEWS -BASIC_LIBS += \ + $(DIST)/lib/libmozmsg.a \ + $(DIST)/lib/libmsg.a \ $(DIST)/lib/libmime.a \ + $(DIST)/lib/libnet.a \ + $(DIST)/lib/libjulian.a \ + $(DIST)/lib/libnscnv30.a \ + $(DIST)/lib/libnsuni30.a \ + $(DIST)/lib/libnsfmt30.a \ + $(DIST)/lib/libaddr.a \ + $(DIST)/lib/libneo.a \ + $(DIST)/lib/libaddr.a \ $(NULL) endif @@ -355,7 +359,7 @@ BASIC_LIBS += \ $(DIST)/lib/libjbn.a \ $(NULL) -ifndef NO_SECURITY +ifdef MOZ_SECURITY BASIC_LIBS += $(DIST)/lib/libjsl.a endif @@ -399,10 +403,14 @@ endif # Post-Java libs BASIC_LIBS += $(DIST)/lib/libstyle.a -ifndef NO_SECURITY +ifdef MOZ_SECURITY BASIC_LIBS += $(DIST)/lib/libjar.a else -EXPORT_LIB = $(DIST)/lib/libhtmldlgs.a $(DIST)/lib/libsecfree.a +EXPORT_LIB = $(DIST)/lib/libhtmldlgs.a +endif + +ifndef MOZ_SECURITY +EXPORT_LIB += $(DIST)/lib/libsecfree.a endif ifdef MOZ_LDAP @@ -470,7 +478,9 @@ ifdef USE_ABCOM DEFINES += -DUSE_ABCOM endif -INCLUDES += -Isrc -I. +INCLUDES += -Isrc -I. -I$(DEPTH)/dist/public/nls -I$(DEPTH)/dist/public/security \ + -I$(DEPTH)/lib/libmsg -I$(DEPTH)/dist/public/ldap \ + -I$(DEPTH)/modules/libimg/public ####################################################################### @@ -520,7 +530,11 @@ DSO_EX_LIBS = $(EXPORT_LDFLAGS:$(DIST)/lib/lib%.a=-l%) ifeq ($(OS_ARCH),AIX) CCLD = svxlC -+ #LDFLAGS = -bGhooksyslibs -bGlibpathexec -bGnoproc -LDFLAGS = -bGnoproc +#LDFLAGS = -bGnoproc +# +# ??? need to double check +# +LDFLAGS = -bE:aix_exports -bGhooksyslibs -bGlibpathexec -bGnoproc -bmaxdata:20000000 OTHER_LIBS = $(MOTIFLIB) -lXt -lXmu -lX11 $(OS_LIBS) US_LDFLAGS += $(AIX_NSPR_LINK) EXPORT_LDFLAGS += $(AIX_NSPR_LINK) @@ -649,7 +663,9 @@ ifeq ($(OS_RELEASE),2.0) ifeq ($(CPU_ARCH),ppc) MOTIFLIB = /usr/local/lib/libXm.a else - +# +# Ramiro: pls double check this block +# MOTIFLIB =\ $(MOTIFPATCH_LIB) \ $(MOZILLA_XM_2_1_BROKEN_LOCALE_FLAGS) \ @@ -1002,6 +1018,17 @@ $(OBJDIR)/strids.o: xfe_err.h $(OBJDIR)/strings.o: xfe_err.h ifeq ($(OS_ARCH),AIX) + +# +# In first. Need to double check +# +# This fixes a 4.5-specific problem caused by including /usr/include/strings.h unnecessarily. +$(OBJDIR)/mozilla.o: mozilla.c + @$(MAKE_OBJDIR) + $(CC) -o $@ -c $(CFLAGS) -D_H_STRINGS $< +# +# end +# AIX_HACK := $(notdir $(AIX_NSPR)) # Install nspr dynamic library for AIX. diff --git a/mozilla/cmd/xfe/addrbk.c b/mozilla/cmd/xfe/addrbk.c index 01d1d210ee1..7ad01c5fd6e 100644 --- a/mozilla/cmd/xfe/addrbk.c +++ b/mozilla/cmd/xfe/addrbk.c @@ -36,43 +36,15 @@ #include "mozilla.h" -#include "xfe.h" -#include "menu.h" -#include "outline.h" -#include "felocale.h" -#include "xlate.h" -#include "addrbook.h" #include "xp_file.h" -#include "intl_csi.h" - -/* Kludge around conflicts between Motif and xp_core.h... */ -#undef Bool -#define Bool char - -#include /* for xfe widgets and utilities */ - - -/* for XP_GetString() */ -#include #include "addrbk.h" -#ifndef LDAP_PORT -#define LDAP_PORT 389 -#endif +#ifdef MOZ_MAIL_NEWS /* list of DIR_Server */ static ABook* AddrBook = NULL; -static MWContext* ABfeContext = NULL; - extern ABook* fe_GetABook(MWContext *); -extern void fe_attach_dropfunc(Widget dropw, void* closure, - fe_dnd_Event type, - fe_dnd_Source* source, - XEvent* event); - -#define XFE_CHUNK_SIZE 1024 -#define AB_DATA(context) ((context->type == MWContextAddressBook)?CONTEXT_DATA(context)->abdata:CONTEXT_DATA(context)->mailcomposer->abdata) /***************************************************** * Actual code begins here @@ -157,3 +129,12 @@ void FE_InitAddrBook() void FE_CloseAddrBook() { AB_CloseAddressBook(&AddrBook); } + +#else +extern XP_List* FE_GetDirServers() +{ + return 0 ; +} + +#endif + diff --git a/mozilla/cmd/xfe/addrbk.h b/mozilla/cmd/xfe/addrbk.h index 02647a8228e..2e1c87499ca 100644 --- a/mozilla/cmd/xfe/addrbk.h +++ b/mozilla/cmd/xfe/addrbk.h @@ -18,7 +18,7 @@ /* addrbk.h --- X-specific headers for the front end. - Created: Tao Cheng , 10-nov-94. + Created: Tao Cheng , 10-nov-96. */ #ifndef _ADDRBK_H_ #define _ADDRBK_H_ @@ -30,6 +30,62 @@ #define AB_MAX_ENTRIES 175000 #define AB_MAX_STRLEN 1024 +#if !defined(EMPTY_STRVAL) +#define EMPTY_STRVAL(value) \ + (!(value) || !((value)->u.string) || !XP_STRLEN(((value)->u.string))) + +#endif + +#ifndef IS_AB_PANE_CMD +#define IS_AB_PANE_CMD(command) \ + ((command == xfeCmdComposeMessage) || \ + (command == xfeCmdComposeMessagePlain) || \ + (command == xfeCmdComposeMessageHTML) || \ + \ + (command == xfeCmdImport) || \ + (command == xfeCmdSaveAs) || \ + \ + (command == xfeCmdClose) || \ + \ + (command == xfeCmdUndo) || \ + (command == xfeCmdRedo) || \ + \ + (command == xfeCmdABDeleteAllEntries) || \ + \ + (command == xfeCmdABByType) || \ + (command == xfeCmdABByName) || \ + (command == xfeCmdABByEmailAddress) || \ + (command == xfeCmdABByNickName) || \ + (command == xfeCmdABByCompany) || \ + (command == xfeCmdABByLocality) || \ + \ + (command == xfeCmdSortAscending) || \ + (command == xfeCmdSortDescending) || \ + \ + (command == xfeCmdAddToAddressBook) || \ + (command == xfeCmdABNewList) || \ + \ + (command == xfeCmdABCall) \ + ) + +#endif /* IS_AB_PANE_CMD */ + +#ifndef IS_CONTAINER_PANE_CMD +#define IS_CONTAINER_PANE_CMD(command) \ + ((command == xfeCmdABNewPAB) || \ + (command == xfeCmdABNewLDAPDirectory)\ + ) +#endif /* IS_CONTAINER_PANE_CMD */ + +#ifndef IS_2_PANE_CMD +#define IS_2_PANE_CMD(command) \ + ((command == xfeCmdShowPopup) || \ + (command == xfeCmdABDeleteEntry) || \ + (command == xfeCmdABEditEntry) ||\ + (command == xfeCmdViewProperties)\ + ) +#endif /* IS_2_PANE_CMD */ + typedef struct fe_addrbk_data { diff --git a/mozilla/cmd/xfe/colors.c b/mozilla/cmd/xfe/colors.c index 81e9ae732d7..958e7ba67cc 100644 --- a/mozilla/cmd/xfe/colors.c +++ b/mozilla/cmd/xfe/colors.c @@ -427,9 +427,20 @@ fe_FreeTransientColors(MWContext *context) unsigned long i; int num_cells; int pixel; + fe_colormap *colormap; + fe_ContextData *context_data; - fe_colormap *colormap = CONTEXT_DATA (context)->colormap; + XP_ASSERT(context); + if (!context) return; + context_data = CONTEXT_DATA(context); + XP_ASSERT(context_data); + if (!context_data) return; + + colormap = context_data->colormap; + XP_ASSERT(colormap); + if (!colormap) return; + /* colormap is shared, by the time this function is called visual_info by be NULL because it was deleted with earlier deletion of a context that reference to it. diff --git a/mozilla/cmd/xfe/commands.c b/mozilla/cmd/xfe/commands.c index 24617a57455..0f0b9f42172 100644 --- a/mozilla/cmd/xfe/commands.c +++ b/mozilla/cmd/xfe/commands.c @@ -2901,6 +2901,144 @@ extern NET_StreamClass *fe_MakeSaveAsStream (int format_out, void *data_obj, extern NET_StreamClass *fe_MakeSaveAsStreamNoPrompt (int format_out, void *data_obj, URL_Struct *url_struct, MWContext *context); +/* + * parse_extensions + * Give a comma separated string of extensions, fills in the array of + * character strings in NET_cdataStruct. + * eg, "cpp,cc" becomes: + * mimetype_entry->exts[0] = "cpp"; + * mimetype_entry->exts[1] = "cc"; + * mimetype_entry->exts[2] = NULL; + */ +static void +parse_extensions(NET_cdataStruct* mimetype_entry, char* exts) +{ + int i; + char* p; + + XP_ASSERT(mimetype_entry && exts); + + mimetype_entry->num_exts = 0; + for ( p = exts; p && *p; p = strchr(p, ',') ) { + if ( *p == ',' ) p++; + mimetype_entry->num_exts++; + } + + mimetype_entry->exts = (char**) malloc(sizeof(char*) * (mimetype_entry->num_exts+1)); + if ( mimetype_entry->exts == NULL ) return; + + for ( i = 0, p = exts; p && *p; p = strchr(p, ','), i++ ) { + if ( *p == ',' ) p++; + mimetype_entry->exts[i] = strdup(p); + if ( strchr(mimetype_entry->exts[i], ',') ) *strchr(mimetype_entry->exts[i], ',') = '\0'; + } + mimetype_entry->exts[i] = NULL; +} + + +/* + * add_pref_mime_type + * Given the beginning of a mimetype preference, registers that + * mimetype handler with netlib. + */ +static void +add_pref_mime_type(char* name) +{ + char buf[1024]; + int32 load_action; + char* extension = NULL; + char* contenttype = NULL; + char* command = NULL; + char* description = NULL; + NET_cdataStruct* mimetype_entry = NULL; + NET_mdataStruct* mailcap_entry = NULL; + + strcpy(buf, name); strcat(buf, ".mimetype"); + if ( PREF_CopyCharPref(buf, &contenttype) != PREF_OK ) goto failed; + + strcpy(buf, name); strcat(buf, ".extension"); + if ( PREF_CopyCharPref(buf, &extension) != PREF_OK ) goto failed; + + strcpy(buf, name); strcat(buf, ".load_action"); + if ( PREF_GetIntPref(buf, &load_action) != PREF_OK ) goto failed; + + strcpy(buf, name); strcat(buf, ".unix_appname"); + if ( PREF_CopyCharPref(buf, &command) != PREF_OK ) goto failed; + + strcpy(buf, name); strcat(buf, ".description"); + if ( PREF_CopyCharPref(buf, &description) != PREF_OK ) goto failed; + + mailcap_entry = NET_mdataCreate(); + mimetype_entry = NET_cdataCreate(); + + mailcap_entry->contenttype = strdup(contenttype); + mailcap_entry->command = command ? strdup(command) : NULL; + mailcap_entry->xmode = (load_action == 1) ? + strdup(NET_COMMAND_SAVE_TO_DISK) : + (load_action == 3) ? + strdup(NET_COMMAND_UNKNOWN) : + (load_action == 4) ? + strdup(NET_COMMAND_PLUGIN) : NULL; + + mimetype_entry->ci.type = contenttype ? strdup(contenttype) : NULL; + mimetype_entry->ci.desc = description ? strdup(description) : NULL; + mimetype_entry->pref_name = strdup(name); + + parse_extensions(mimetype_entry, extension); + + if ( mailcap_entry->xmode == NULL && + mailcap_entry->command && + *(mailcap_entry->command) && + strcasecmp(mailcap_entry->contenttype, TEXT_HTML) && + strcasecmp(mailcap_entry->contenttype, MESSAGE_RFC822) && + strcasecmp(mailcap_entry->contenttype, MESSAGE_NEWS) ) { + NET_RegisterExternalViewerCommand(mailcap_entry->contenttype, mailcap_entry->command, mailcap_entry->stream_buffer_size); + } + + NET_cdataAdd(mimetype_entry); + NET_mdataAdd(mailcap_entry); + + if ( extension ) XP_FREE(extension); + if ( contenttype ) XP_FREE(contenttype); + if ( description ) XP_FREE(description); + if ( command ) XP_FREE(command); + return; + +failed: + if ( extension ) XP_FREE(extension); + if ( contenttype ) XP_FREE(contenttype); + if ( description ) XP_FREE(description); + if ( command ) XP_FREE(command); + if ( mimetype_entry ) NET_cdataFree(mimetype_entry); + if ( mailcap_entry ) NET_mdataFree(mailcap_entry); +} + + +/* + * fe_RegisterPrefConverters + * Registers the mimetype converters that are specified by the + * preferences. + */ +void +fe_RegisterPrefConverters(void) +{ + extern FILE* real_stderr; + char* children = NULL; + char* child = NULL; + int index = 0; + + if ( PREF_CreateChildList("mime", &children) != PREF_OK ) { + return; + } + + while ( (child = PREF_NextChild(children, &index)) != NULL ) { + add_pref_mime_type(child); + } + + XP_FREE(children); +} + + void fe_RegisterConverters (void) { @@ -3065,6 +3203,8 @@ fe_RegisterConverters (void) fe_isFileChanged(fe_globalPrefs.private_mailcap_file, 0, &fe_globalData.privateMailcapFileModifiedTime); + fe_RegisterPrefConverters(); + #ifndef NO_WEB_FONTS /* Register webfont converters */ NF_RegisterConverters(); diff --git a/mozilla/cmd/xfe/dialogs.c b/mozilla/cmd/xfe/dialogs.c index 72f53be0eec..93bcd87224a 100644 --- a/mozilla/cmd/xfe/dialogs.c +++ b/mozilla/cmd/xfe/dialogs.c @@ -181,6 +181,29 @@ FE_Alert (MWContext *context, const char *message) } } +/* Hack for 109371 */ +void +FE_Alert_modal (MWContext *context, const char *message) +{ + if (context && context->type == MWContextBiff) + return; + + if (context) + fe_Alert_modal(CONTEXT_WIDGET (context), message); + else + { + Widget toplevel = FE_GetToplevelWidget(); + if ( toplevel ) { + fe_Alert_2(toplevel, message); + } else { + /* So that didn't even work. Write to stdout and + * exit. + */ + XP_ABORT((message)); + } + } +} + /* Lame hack to get the right title for javascript dialogs. * This should be instead added to the call arguments. */ @@ -200,7 +223,7 @@ XFE_Alert (MWContext *context, const char *message) if (context->bJavaScriptCalling) javaScriptCallingContextHack = context; - fe_Alert_2 (CONTEXT_WIDGET (context), message); + fe_Alert_2(CONTEXT_WIDGET (context), message); } /* Just like XFE_Alert, but with a different dialog title. */ @@ -226,6 +249,16 @@ XFE_Confirm (MWContext *context, const char *message) return fe_Confirm_2 (CONTEXT_WIDGET (context), message); } +/* + * Yet Another front end function that + * noone told us we were supposed to implement. + */ +PRBool +XP_Confirm(MWContext *c, const char *msg) +{ + return XFE_Confirm(c,msg); +} + Boolean fe_Confirm_2 (Widget parent, const char *message) { @@ -233,6 +266,12 @@ fe_Confirm_2 (Widget parent, const char *message) TRUE, 0, TRUE, FALSE, 0)); } +void +fe_Alert_modal (Widget parent, const char *message) +{ + (void) fe_dialog (parent, "error", message, FALSE, 0, TRUE, FALSE, 0); +} + void fe_Alert_2 (Widget parent, const char *message) { @@ -1894,6 +1933,18 @@ fe_CreateFileSelectionBox(Widget parent, char* name, #endif +#ifdef IRIX +#ifndef IRIX5_3 + /* FIX 98019 + * + * For IRIX 6.2 and later: + * Reset filetype mask to suit custom Sgm file dialog. + * (otherwise directories don't show up in the list.) + */ + XtVaSetValues(fsb,XmNfileTypeMask,XmFILE_ANY_TYPE,NULL); +#endif +#endif + #ifdef USE_WINNING_FILE_SELECTION if (mode == FSB_HACKS || mode == FSB_CDE_PLUS) { filter_button = XmFileSelectionBoxGetChild(fsb, XmDIALOG_APPLY_BUTTON); @@ -2768,6 +2819,15 @@ XFE_PromptPassword (MWContext *context, const char *message) ((char **) 1)); } +/* + * Yet Another front end function that + * noone told us we were supposed to implement. + */ +char *XP_PromptPassword(MWContext *context, const char *message) +{ + return XFE_PromptPassword(context, message); +} + /* Prompt for a username and password * * message is a prompt message. @@ -2804,6 +2864,17 @@ XFE_PromptUsernameAndPassword (MWContext *context, } } +/* + * Yet Another front end function that + * noone told us we were supposed to implement. + */ +PRBool XP_PromptUsernameAndPassword (MWContext *window_id, + const char *message, + char **username, + char **password) +{ + return XFE_PromptUsernameAndPassword(window_id, message, username, password); +} /* Prompting for visuals diff --git a/mozilla/cmd/xfe/editor.c b/mozilla/cmd/xfe/editor.c index 2b858a360f2..8defcd61041 100644 --- a/mozilla/cmd/xfe/editor.c +++ b/mozilla/cmd/xfe/editor.c @@ -57,7 +57,9 @@ #include "il_icons.h" /* Image icon enumeration. */ +#ifdef JAVA #include "edtplug.h" +#endif #define CB_STATIC static /* let commands.c see it */ diff --git a/mozilla/cmd/xfe/felocale.h b/mozilla/cmd/xfe/felocale.h index e8f098fadfe..0bc11681535 100644 --- a/mozilla/cmd/xfe/felocale.h +++ b/mozilla/cmd/xfe/felocale.h @@ -40,6 +40,13 @@ fe_ConvertFromLocaleEncoding(int16, unsigned char *); unsigned char * fe_ConvertToLocaleEncoding(int16, unsigned char *); +#define INTL_CONVERT_BUF_TO_LOCALE(s,l) \ + (l) = (char*)fe_ConvertToLocaleEncoding(\ + INTL_DefaultWinCharSetID(NULL), \ + (unsigned char*)(s)); \ + if ((NULL!=(l)) && ((l) != (s))) \ + XP_STRNCPY_SAFE((s), (l), sizeof(s)), XP_FREE(l); + XmString fe_ConvertToXmString(unsigned char *, int16, fe_Font, XmFontType, XmFontList *); diff --git a/mozilla/cmd/xfe/forms.c b/mozilla/cmd/xfe/forms.c index 8ef850313be..6447f573fe0 100644 --- a/mozilla/cmd/xfe/forms.c +++ b/mozilla/cmd/xfe/forms.c @@ -2900,7 +2900,9 @@ fe_mocha_submit_form_cb (MWContext *context, LO_Element *element, int32 event, } NET_AddLOSubmitDataToURLStruct (data, url); - if (data->window_target) + + /* rb, conflict start */ + if (data->window_target) { MWContext *tempContext; @@ -2915,6 +2917,14 @@ fe_mocha_submit_form_cb (MWContext *context, LO_Element *element, int32 event, } } +/* ======= + if (data->window_target) + { + context = XP_FindNamedContextInList(context, data->window_target); + data->window_target = NULL; + } + +>>>>>>> 3.2.2.1 , conflict end */ fe_GetURL (context, url, FALSE); LO_FreeSubmitData (data); diff --git a/mozilla/cmd/xfe/icons.c b/mozilla/cmd/xfe/icons.c index ef3e6df5243..8cd5f317f91 100644 --- a/mozilla/cmd/xfe/icons.c +++ b/mozilla/cmd/xfe/icons.c @@ -21,6 +21,7 @@ */ +#include "rosetta.h" #include "mozilla.h" #include "xfe.h" #include "fonts.h" @@ -1131,20 +1132,7 @@ fe_make_icon (MWContext *context, Pixel transparent_color, int id, static void fe_new_init_security_icons (Widget widget) { -#ifndef NO_SECURITY - Pixel fg = 0; - Pixel bg = 0; - - XtVaGetValues (widget, XmNbackground, &bg, 0); - XtVaGetValues (widget, XmNforeground, &fg, 0); - - fe_NewMakeIcon (widget, fg, bg, &fe_icons[IL_IMAGE_INSECURE], - NULL, - SEC_Replace.width, SEC_Replace.height, - SEC_Replace.mono_bits, SEC_Replace.color_bits, SEC_Replace.mask_bits, - FALSE); - -#endif + HG12675 } static void @@ -1176,18 +1164,7 @@ fe_init_document_icons (MWContext *c) NULL, IconUnknown.width, IconUnknown.height, IconUnknown.mono_bits, IconUnknown.color_bits, IconUnknown.mask_bits); -#ifndef NO_SECURITY - fe_make_icon (c, bg, IL_IMAGE_INSECURE, - NULL, - SEC_Replace.width, SEC_Replace.height, - SEC_Replace.mono_bits, SEC_Replace.color_bits, SEC_Replace.mask_bits); - - bg2 = bg; - if (CONTEXT_DATA(c)->dashboard) { - /* XXX need to find why we do this - dp */ - XtVaGetValues (CONTEXT_DATA (c)->dashboard, XmNbackground, &bg2, 0); - } -#endif + HG87163 /* Load all the desktop icons */ save = fe_globalData.force_mono_p; /* hack. hack, hack */ if (XP_STRCASECMP(fe_globalData.wm_icon_policy, "mono") == 0) @@ -1969,8 +1946,7 @@ fe_NewSecurityPixmap (Widget widget, Dimension *w, Dimension *h, int index = 0; switch (type) { - case SSL_SECURITY_STATUS_ON_LOW: index = IL_ICON_SECURITY_ON; break; - case SSL_SECURITY_STATUS_ON_HIGH: index = IL_ICON_SECURITY_HIGH; break; + HG27367 #ifdef FORTEZZA case SSL_SECURITY_STATUS_FORTEZZA: index = IL_ICON_SECURITY_FORTEZZA; break; #endif @@ -1990,8 +1966,7 @@ fe_SecurityPixmap (MWContext *context, Dimension *w, Dimension *h, int index = 0; switch (type) { - case SSL_SECURITY_STATUS_ON_LOW: index = IL_ICON_SECURITY_ON; break; - case SSL_SECURITY_STATUS_ON_HIGH: index = IL_ICON_SECURITY_HIGH; break; + HG72671 #ifdef FORTEZZA case SSL_SECURITY_STATUS_FORTEZZA: index = IL_ICON_SECURITY_FORTEZZA; break; #endif @@ -2627,15 +2602,7 @@ FE_AboutData (const char *which, *length_ret = sizeof (hype_au) - 1; *content_type_ret = AUDIO_BASIC; } -#ifndef NO_SECURITY - else if (!strcmp (which, "rsalogo")) - { - /* Note, this one returns a read-only string. */ - *data_ret = (char *) rsalogo_gif; - *length_ret = sizeof (rsalogo_gif) - 1; - *content_type_ret = IMAGE_GIF; - } -#endif + HG78262 #ifdef JAVA else if (!strcmp (which, "javalogo")) { @@ -2872,18 +2839,9 @@ FE_AboutData (const char *which, { char *a2; int len; -#ifndef NO_SECURITY - /* These strings are for display in the about: page */ - char *s0 = XP_GetString(XFE_SECURITY_WITH); - char *s1 = SECNAV_SecurityVersion(PR_TRUE); - char *s2 = SECNAV_SSLCapabilities(); - char *ss; - len = strlen(s0)+strlen(s1)+strlen(s2); - ss = (char*) malloc(len); - PR_snprintf(ss, len, s0, s1, s2); -#else - char *ss = XP_GetString(XFE_SECURITY_DISABLED); -#endif + char *ss = NULL; + + HG72729 /* sets ss */ len = strlen(a) + strlen(fe_version_and_locale) + strlen(fe_version_and_locale) + strlen(ss); a2 = (char *) malloc(len); @@ -2892,10 +2850,9 @@ FE_AboutData (const char *which, fe_version_and_locale, ss ); -#ifndef NO_SECURITY - free (s2); + + HG78268 free (ss); -#endif free (a); a = a2; } @@ -3083,10 +3040,7 @@ fe_get_icon_data(int icon_number) return &IconUnknown; case IL_IMAGE_BAD_DATA: return &IBad; -#ifndef NO_SECURITY - case IL_IMAGE_INSECURE: - return &SEC_Replace; -#endif /* ! NO_SECURITY */ + HG87268 case IL_IMAGE_EMBED: return &IconUnknown; @@ -3122,31 +3076,7 @@ fe_get_icon_data(int icon_number) return &ed_tage; #endif /* EDITOR */ - /* Security Advisor and S/MIME icons. */ - case IL_SA_SIGNED: - return &A_Signed; - case IL_SA_ENCRYPTED: - return &A_Encrypt; - case IL_SA_NONENCRYPTED: - return &A_NoEncrypt; - case IL_SA_SIGNED_BAD: - return &A_SignBad; - case IL_SA_ENCRYPTED_BAD: - return &A_EncrypBad; - case IL_SMIME_ATTACHED: - return &M_Attach; - case IL_SMIME_SIGNED: - return &M_Signed; - case IL_SMIME_ENCRYPTED: - return &M_Encrypt; - case IL_SMIME_ENC_SIGNED: - return &M_SignEncyp; - case IL_SMIME_SIGNED_BAD: - return &M_SignBad; - case IL_SMIME_ENCRYPTED_BAD: - return &M_EncrypBad; - case IL_SMIME_ENC_SIGNED_BAD: - return &M_SgnEncypBad; + HG78261 /* Message attachment icon. */ case IL_MSG_ATTACH: diff --git a/mozilla/cmd/xfe/lay.c b/mozilla/cmd/xfe/lay.c index 99ee300a3e0..f165535f46b 100644 --- a/mozilla/cmd/xfe/lay.c +++ b/mozilla/cmd/xfe/lay.c @@ -4076,10 +4076,18 @@ fe_FinishHREF (MWContext *context, #ifdef MOZ_MAIL_NEWS if (MSG_NewWindowProhibited (context, url->address)) { +#if 1 + XP_ASSERT (!MSG_NewWindowRequiredForURL (context, url)); +#else XP_ASSERT (!MSG_NewWindowRequired (context, url->address)); +#endif other_p = False; } +#if 1 + else if (MSG_NewWindowRequiredForURL (context, url)) +#else else if (MSG_NewWindowRequired (context, url->address)) +#endif { MWContext *new_context = 0; XP_ASSERT (!MSG_NewWindowProhibited (context, url->address)); diff --git a/mozilla/cmd/xfe/make-resources b/mozilla/cmd/xfe/make-resources index c3933d9ed73..d32f865ab58 100755 --- a/mozilla/cmd/xfe/make-resources +++ b/mozilla/cmd/xfe/make-resources @@ -49,6 +49,15 @@ else ONLYSGI="!" fi +SUNP=`echo ${DEST} | sed -n 's/.*SunOS.*/TRUE/p'` +if [ "x${SUNP}" = "xTRUE" ]; then + NOTSUN="!" + ONLYSUN="" +else + NOTSUN="" + ONLYSUN="!" +fi + SCOP=`echo ${DEST} | sed -n 's/.*SCO.*/TRUE/p'` if [ "x${SCOP}" = "xTRUE" ]; then ONLYSCO="" @@ -63,8 +72,10 @@ cat resources ${LOCALE_MAP} strs | sed \ s/@PROGNAME@/${PROGNAME}/g; s/@VERSION@/${VERS}/g; s/@NOTSGI@/${NOTSGI}/g; + s/@NOTSUN@/${NOTSUN}/g; s/@ONLYSGI@/${ONLYSGI}/g; s/@ONLYSCO@/${ONLYSCO}/g; + s/@ONLYSUN@/${ONLYSUN}/g; s/@LOC@//g; s/@LTD@//g; s:@LIBDIR@:${LOC_LIB_DIR}:g; diff --git a/mozilla/cmd/xfe/mozilla.c b/mozilla/cmd/xfe/mozilla.c index 3f1be2a53e1..69851a8a4f1 100644 --- a/mozilla/cmd/xfe/mozilla.c +++ b/mozilla/cmd/xfe/mozilla.c @@ -21,6 +21,7 @@ Created: Jamie Zawinski , 22-Jun-94. */ +#include "rosetta.h" #include "mozilla.h" #include "altmail.h" #include "name.h" @@ -38,6 +39,12 @@ #include "secnav.h" #include "secrng.h" #include "mozjava.h" +#ifdef MOZ_MAIL_NEWS +#include "nlsxp.h" +#endif +#ifdef MOZ_SMARTUPDATE +#include "softupdt.h" +#endif #ifdef NSPR20 #include "private/prpriv.h" /* for PR_NewNamedMonitor */ #endif /* NSPR20 */ @@ -170,7 +177,7 @@ extern int XFE_THE_MOTIF_KEYSYMS_NOT_DEFINED; extern int XFE_SOME_MOTIF_KEYSYMS_NOT_DEFINED; extern int XFE_SPLASH_REGISTERING_CONVERTERS; -extern int XFE_SPLASH_INITIALIZING_SECURITY_LIBRARY; +HG78265 extern int XFE_SPLASH_INITIALIZING_NETWORK_LIBRARY; extern int XFE_SPLASH_INITIALIZING_MESSAGE_LIBRARY; extern int XFE_SPLASH_INITIALIZING_IMAGE_LIBRARY; @@ -906,12 +913,11 @@ static XEvent fe_last_event; /* Process events. The idea here is to give X events priority over file descriptor input so that the user gets better interactive - response under heavy i/o load. + response under heavy i/o load. */ - While we are it, we try to gather up a bunch of events to shovel - into the security library to "improve" randomness. + HG87627 - Finally, we try to block when there is really nothing to do, +/* Finally, we try to block when there is really nothing to do, but we block in such a way as to allow java applets to get the cpu while we are blocked. @@ -932,11 +938,7 @@ fe_EventLoop () entry_depth++; #endif - /* Feed the security library the last event we handled. We do this here - before peeking for another event so that the elapsed time between calls - can have some impact on the outcome. - */ - fe_EventForRNG (&fe_last_event); + HG72721 /* Release X lock and wait for an event to show up. This might not return an X event, and it will not block until there is an X event. However, @@ -1025,19 +1027,10 @@ fe_EventLoop () we want to be as responsive to the user as possible. */ if (device_event_count < 300) { - /* While the security library is still hungry for events - we feed it all the events we get. We use XtAppPeekEvent - to grab a copy of the event that XtAppPending said was - available. - */ + XtAppPeekEvent(fe_XtAppContext, &fe_last_event); - fe_EventForRNG (&fe_last_event); + HG13267 - /* If it's an interesting event, count it towards our - goal of 300 events. After 300 events, we don't need - to feed the security library as often (which makes - us more efficient at event processing) - */ if (fe_last_event.xany.type == ButtonPress || fe_last_event.xany.type == ButtonRelease || fe_last_event.xany.type == KeyPress || @@ -1148,17 +1141,7 @@ fe_EventForRNG (XEvent *event) data.event = *event; - /* At this point, we are idle. Get a high-res clock value. */ - (void) RNG_GetNoise(data.noise, sizeof(data.noise)); - - /* Kick security library random number generator to make it very - hard for a bad guy to predict where the random number generator - is at. Initialize it with the current time, and the *previous* - X event we read (which happens to have a server timestamp in it.) - The X event came from before this current idle period began, and - will be uninitialized stack data the first time through. - */ - RNG_RandomUpdate(&data, sizeof(data)); + HG87262 } @@ -1881,8 +1864,7 @@ build_user_agent_string(char *versionLocale) } strcat (buf, " (X11; "); - /* US or International security versions */ - strcat (buf, SECNAV_SecurityVersion (PR_FALSE)); + HG71265 strcat (buf, "; "); if (uname (&uts) < 0) @@ -2047,6 +2029,7 @@ main fe_hack_uid(); /* Do this real early */ + /* * Check the environment for MOZILLA_NO_ASYNC_DNS. It would be nice to * make this either a pref or a resource/option. But, at this point in @@ -2117,6 +2100,9 @@ main mozilla_thread = PR_CurrentThread(); fdset_lock = PR_NewNamedMonitor("mozilla-fdset-lock"); +#ifdef MOZ_MAIL_NEWS + NLS_EncInitialize(NULL,NULL); +#endif /* ** Create a pipe used to wakeup mozilla from select. A problem we had ** to solve is the case where a non-mozilla thread uses the netlib to @@ -2376,6 +2362,10 @@ main } { char buf [1024]; + int32 profile_age; + XP_StatStruct statPrefs; + int status; + PR_snprintf (buf, sizeof (buf), "%s/%s", fe_home_dir, #ifdef OLD_UNIX_FILES ".netscape-preferences" @@ -2385,13 +2375,24 @@ main ); fe_globalData.user_prefs_file = strdup (buf); - + /* check if preferences previously existed */ + status=XP_Stat(buf, &statPrefs, xpUserPrefs); + + /* moved this here because NET_InitNetLib needs to happen + * before PREF_Init + */ + NET_InitNetLib(fe_globalPrefs.network_buffer_size,50); + PREF_Init((char*) fe_globalData.user_prefs_file); +#ifdef MOZ_MAIL_NEWS + if (status!=0) /* stuff to run the first time a user starts */ + MSG_WriteNewProfileAge(); +#endif /* MOZ_MAIL_NEWS */ } #ifdef MOZ_MAIL_NEWS fe_mailNewsPrefs = MSG_CreatePrefs(); -#endif +#endif /* MOZ_MAIL_NEWS */ toplevel = XtAppInitialize (&fe_XtAppContext, (char *) fe_progclass, options, sizeof (options) / sizeof (options [0]), @@ -2492,14 +2493,14 @@ main #endif /*XFE_XLOCK_FD_TIMER_HACK*/ } - /* For security stuff... */ + /* For xxx stuff... */ fe_dpy_kludge = dpy; fe_screen_kludge = XtScreen (toplevel); - /* Initialize the security library. This must be done prior + /* Initialize the xxx library. This must be done prior to any calls that will cause X event activity, since the - event loop calls security functions. + event loop calls xxx functions. */ XtGetApplicationNameAndClass (dpy, @@ -2800,9 +2801,14 @@ main fe_splashUpdateText(XP_GetString(XFE_SPLASH_REGISTERING_CONVERTERS)); #endif -#ifdef MOZ_SMARTUPDATE + +#ifdef JAVA + /* Startup softupdate */ +#if defined(MOZ_SMARTUPDATE) SU_Startup(); -#endif +#endif /* MOZ_SMARTUPDATE */ +#endif /* MOZ_MAIL_NEWS */ + NR_StartupRegistry(); fe_RegisterConverters (); /* this must be before InstallPreferences(), and after fe_InitializeGlobalResources(). */ @@ -2834,8 +2840,7 @@ main ** OTHERWISE THE FILE LOCK ON THE HISTORY DB IS LOST! */ #ifdef NSPR_SPLASH - if (fe_globalData.show_splash) - fe_splashUpdateText(XP_GetString(XFE_SPLASH_INITIALIZING_SECURITY_LIBRARY)); + HG72587 #endif SECNAV_Init(); @@ -2853,8 +2858,6 @@ main if (fe_globalData.show_splash) fe_splashUpdateText(XP_GetString(XFE_SPLASH_INITIALIZING_NETWORK_LIBRARY)); #endif - /* The unit for tcp buffer size is changed from ktypes to btyes */ - NET_InitNetLib (fe_globalPrefs.network_buffer_size, 50); #ifdef UNIX_ASYNC_DNS if (fe_UseAsyncDNS()) @@ -4204,7 +4207,7 @@ fe_create_composition_widgets(MWContext* context, Widget pane, int *numkids) } *((Widget*) ((char*) data + description[i].offset)) = widget[i]; - + ac = 0; XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; @@ -4362,27 +4365,7 @@ FE_MakeAppletSecurityChrome(Widget parent, char* warning) label = XmCreateLabelGadget (form, "mouseDocumentation", av, ac); XmStringFree(cwarning); -#ifndef NO_SECURITY - /* - ** This section of displays security logos. It won't compile - ** properly if security is turned off. Instead of ifdef'ing - ** we might want to replace with a placeholder. - */ - { - Dimension w, h; - Pixmap p = fe_SecurityPixmap(NULL, &w, &h, 0); - ac = 0; - XtSetArg(av[ac], XmNresizable, False); ac++; - XtSetArg(av[ac], XmNlabelType, XmPIXMAP); ac++; - XtSetArg(av[ac], XmNalignment, XmALIGNMENT_CENTER); ac++; - XtSetArg(av[ac], XmNlabelPixmap, p); ac++; - XtSetArg(av[ac], XmNwidth, w); ac++; - XtSetArg(av[ac], XmNheight, h); ac++; - XtSetArg(av[ac], XmNcolormap, cmap); ac++; - XtSetArg (av [ac], XmNshadowThickness, 2); ac++; - sec_logo = XmCreatePushButtonGadget (form, "javaSecLogo", av, ac); - } -#endif /* ! NO_SECURITY */ + HG87271 /* Now that widgets have been created, do the form attachments */ XtVaSetValues(skinnyDrawingArea, diff --git a/mozilla/cmd/xfe/prefdialogs.c b/mozilla/cmd/xfe/prefdialogs.c index 6a0a06dc7e9..56b7162ecf3 100644 --- a/mozilla/cmd/xfe/prefdialogs.c +++ b/mozilla/cmd/xfe/prefdialogs.c @@ -34,6 +34,7 @@ #include +#include "rosetta.h" #include "mozilla.h" #include "xlate.h" #include "xfe.h" @@ -164,7 +165,7 @@ extern void fe_installMserverMore(void); #endif extern void fe_installProxiesView(void); extern void fe_installDiskMore(void); -extern void fe_installSslConfig(void); +HG26262 extern void fe_installOffline(void); extern void fe_installDiskSpace(void); @@ -283,7 +284,7 @@ struct fe_prefs_data Widget memory_text, memory_clear; Widget disk_text, disk_dir, disk_clear; Widget verify_label, once_p, every_p, expired_p; - Widget cache_ssl_p; + HG79266 /* Nework page */ Widget network_selector, network_page; @@ -324,7 +325,7 @@ struct fe_prefs_data /* General Security page */ Widget sec_general_selector, sec_general_page; Widget enter_toggle, leave_toggle, mixed_toggle, submit_toggle; - Widget ssl2_toggle, ssl3_toggle; + HG72611 /* Security Passwords page */ Widget sec_passwords_selector, sec_passwords_page; @@ -654,7 +655,7 @@ fe_InstallPreferences (MWContext *context) #endif fe_installProxiesView(); - fe_installSslConfig(); + HG72625 fe_installDiskMore(); /* CACHE diff --git a/mozilla/cmd/xfe/prefs.c b/mozilla/cmd/xfe/prefs.c index dd3e2f08981..71cb77bdb56 100644 --- a/mozilla/cmd/xfe/prefs.c +++ b/mozilla/cmd/xfe/prefs.c @@ -94,7 +94,6 @@ struct pref_map { */ static void fix_path(void*); static Bool XFE_OldReadPrefs(char * filename, XFE_GlobalPrefs *prefs); -static Bool evaluate_preferences_file(char* filename); static Bool read_old_prefs_file(XFE_GlobalPrefs* prefs); static void split_all_proxies(XFE_GlobalPrefs* prefs); static void split_proxy(char** proxy, int* port, int default_port); @@ -261,7 +260,6 @@ static struct pref_map pref_map[] = { {"mail.use_movemail", FIELD_OFFSET(use_movemail_p), read_bool, write_bool}, {"mail.use_builtin_movemail", FIELD_OFFSET(builtin_movemail_p), read_bool, write_bool}, {"mail.movemail_program", FIELD_OFFSET(movemail_program), read_path, write_path, }, -{"mail.pop_name", FIELD_OFFSET(pop3_user_id), read_str, write_str}, {"mail.directory", FIELD_OFFSET(mail_directory), read_path, write_path, }, {"mail.imap.server_sub_directory", FIELD_OFFSET(imap_mail_directory), read_path, write_path, }, {"mail.imap.root_dir", FIELD_OFFSET(imap_mail_local_directory), read_path, write_path, }, @@ -299,7 +297,6 @@ static struct pref_map pref_map[] = { {"network.cookie.warnAboutCookies", FIELD_OFFSET(warn_accept_cookie), read_bool, write_bool}, {"network.cookie.cookieBehavior", FIELD_OFFSET(accept_cookie), read_int, write_int}, {"network.hosts.smtp_server", FIELD_OFFSET(mailhost), read_str, write_str}, -{"network.hosts.pop_server", FIELD_OFFSET(pop3_host), read_str, write_str}, {"network.max_connections", FIELD_OFFSET(max_connections), read_int, write_int}, {"network.tcpbufsize", FIELD_OFFSET(network_buffer_size), read_int, write_int}, {"network.hosts.nntp_server", FIELD_OFFSET(newshost), read_str, write_str}, @@ -467,12 +464,15 @@ XFE_UpgradePrefs(char* filename, XFE_GlobalPrefs* prefs) char* tmp = NULL; void* field; Bool status; + XP_Bool passwordProtectLocalCache; + PREF_GetBoolPref("mail.password_protect_local_cache", + &passwordProtectLocalCache); /* * If we're not supposed to remember the password, replace * the password with blank, and then restore it after saving. */ - if ( !prefs->rememberPswd ) { + if ( !prefs->rememberPswd && !passwordProtectLocalCache) { tmp = prefs->pop3_password; prefs->pop3_password = ""; } @@ -486,14 +486,13 @@ XFE_UpgradePrefs(char* filename, XFE_GlobalPrefs* prefs) status = ( PREF_SavePrefFileAs(filename) == PREF_NOERROR ) ? TRUE : FALSE; - if ( !prefs->rememberPswd ) { + if ( !prefs->rememberPswd && !passwordProtectLocalCache) { prefs->pop3_password = tmp; } return status; } - /* * XFE_SavePrefs * Save the preferences to the Javascript file. @@ -505,12 +504,16 @@ XFE_SavePrefs(char* filename, XFE_GlobalPrefs* prefs) char* tmp = NULL; void* field; Bool status; + XP_Bool passwordProtectLocalCache; + + PREF_GetBoolPref("mail.password_protect_local_cache", + &passwordProtectLocalCache); /* * If we're not supposed to remember the password, replace * the password with blank, and then restore it after saving. */ - if ( !prefs->rememberPswd ) { + if ( !prefs->rememberPswd && !passwordProtectLocalCache) { tmp = prefs->pop3_password; prefs->pop3_password = ""; } @@ -526,7 +529,7 @@ XFE_SavePrefs(char* filename, XFE_GlobalPrefs* prefs) status = ( PREF_SavePrefFileAs(filename) == PREF_NOERROR ) ? TRUE : FALSE; - if ( !prefs->rememberPswd ) { + if ( !prefs->rememberPswd && !passwordProtectLocalCache) { prefs->pop3_password = tmp; } @@ -595,10 +598,6 @@ XFE_ReadPrefs(char* filename, XFE_GlobalPrefs* prefs) } } - if ( evaluate_preferences_file(filename) == FALSE ) { - return FALSE; - } - def = 0; /* Indicate that we want to read real prefs, not defaults */ for ( i = 0; i < num_prefs; i++ ) { field = GET_FIELD(pref_map[i], prefs); @@ -645,42 +644,6 @@ XFE_DefaultPrefs(XFE_GlobalPrefs* prefs) } -/* - * evaluate_preferences_file - */ -static Bool -evaluate_preferences_file(char* filename) -{ - FILE* file; - char* pref_buf; - struct stat stat_buf; - size_t size; - Bool ret; - - if ( stat(filename, &stat_buf) == -1 ) { - return FALSE; - } - - size = stat_buf.st_size; - - if ( (file = fopen(filename, "r")) == NULL ) { - return FALSE; - } - - if ( (pref_buf = malloc(size)) == NULL ) { - return FALSE; - } - - if ( fread(pref_buf, sizeof(char), size, file) != size ) { - return FALSE; - } - - ret = (Bool) PREF_EvaluateJSBuffer(pref_buf, size); - free(pref_buf); - return ret; -} - - /* * fix_path */ @@ -1412,10 +1375,10 @@ XFE_OldReadPrefs(char * filename, XFE_GlobalPrefs *prefs) prefs->builtin_movemail_p = BOOLP (value); else if (!XP_STRCASECMP("MOVEMAIL_PROGRAM", name)) StrAllocCopy (prefs->movemail_program, value); - else if (!XP_STRCASECMP("POP3_HOST", name)) - StrAllocCopy (prefs->pop3_host, value); - else if (!XP_STRCASECMP("POP3_USER_ID", name)) - StrAllocCopy (prefs->pop3_user_id, value); + /* else if (!XP_STRCASECMP("POP3_HOST", name)) */ + /* StrAllocCopy (prefs->pop3_host, value); */ + /* else if (!XP_STRCASECMP("POP3_USER_ID", name)) */ + /* StrAllocCopy (prefs->pop3_user_id, value); */ else if (!XP_STRCASECMP("POP3_LEAVE_ON_SERVER", name)) prefs->pop3_leave_mail_on_server = BOOLP (value); else if (!XP_STRCASECMP("POP3_MSG_SIZE_LIMIT", name)) diff --git a/mozilla/cmd/xfe/prefs.h b/mozilla/cmd/xfe/prefs.h index 1b72a2f20df..f0075b44ab6 100644 --- a/mozilla/cmd/xfe/prefs.h +++ b/mozilla/cmd/xfe/prefs.h @@ -84,6 +84,15 @@ #define HTML_ACTION_HTML 2 #define HTML_ACTION_BOTH 3 +/* default request receipt action */ +#define RETURN_RECEIPTS_DSN 1 +#define RETURN_RECEIPTS_MDN 2 +#define RETURN_RECEIPTS_BOTH 3 + +/* default receipt arrival action */ +#define RECEIPTS_ARRIVE_INBOX 0 +#define RECEIPTS_ARRIVE_SENTMAIL 1 + /* global preferences structure. */ typedef struct _XFE_GlobalPrefs @@ -339,8 +348,6 @@ typedef struct _XFE_GlobalPrefs char *mailhost; char *movemail_program; - char *pop3_host; - char *pop3_user_id; char *mail_directory; char *imap_mail_directory; char *imap_mail_local_directory; diff --git a/mozilla/cmd/xfe/resources b/mozilla/cmd/xfe/resources index 39ff8f69dc9..d987260034b 100644 --- a/mozilla/cmd/xfe/resources +++ b/mozilla/cmd/xfe/resources @@ -516,6 +516,8 @@ Alt ~CtrlH: xfeDoCommand(deliverQueuedMessages) \n\ Meta ~CtrlK: xfeDoCommand(compressFolders) \n\ Alt ~CtrlK: xfeDoCommand(compressFolders) \n\ + Meta ~Ctrl Shift f: xfeDoCommand(search) \n\ + Alt ~Ctrl Shift f: xfeDoCommand(search) \n\ Meta ~Ctrl Shifti: xfeDoCommand(viewSecurity) \n\ Alt ~Ctrl Shifti: xfeDoCommand(viewSecurity) \n\ Meta ~CtrlO: xfeDoCommand(openSelected) \n\ @@ -1063,8 +1065,8 @@ \ ~Meta ~Alt ~CtrlosfDelete: PageUp() \n\ ~Meta ~Alt ~CtrlosfBackSpace:PageUp() \n\ - Meta Ctrlf: fishcam() \n\ - Alt Ctrlf: fishcam() \n\ + Meta Ctrlg: fishcam() \n\ + Alt Ctrlg: fishcam() \n\ Meta Ctrlt: net_showstatus() \n\ Alt Ctrlt: net_showstatus() \n\ ~Meta ~Alt ~CtrlosfUp: LineUp() \n\ @@ -1488,13 +1490,14 @@ Open a local file or a web page in the current window *menuBar*recentSubmenu.labelString: Open Recent... *menuBar*saveAs.labelString: Save As... +*menuBar*saveMsgAs.labelString: Save As + *saveAsCmdString: Save As... *saveFramesetAsCmdString: Save Frameset As... *menuBar*saveAs.mnemonic: S *menuBar*saveAs.acceleratorText: Alt+S *saveAs.documentationString: Save a copy of the current page -!xxx out of spec (saveFrameAs) *menuBar*saveFrameAs.labelString: Save Frame As... *menuBar*saveFrameAs.mnemonic: F *saveFrameAs.documentationString: Save a copy of the selected frame @@ -1548,7 +1551,7 @@ Send current page location to a recipient *exit.documentationString: Close all windows in the application and exit !=========================== - File Menu - Page Composer +! File Menu - Page Composer !=========================== *menuBar*save.labelString: Save @@ -1569,17 +1572,25 @@ Upload current file or directory to a server for public viewing Open the current file in a new browser window !============================= - File Menu - Compose Message +! File Menu - Compose Message !============================= -*menuBar*saveDraft.labelString: Save Draft -*menuBar*saveDraft.mnemonic: S -*saveDraft.documentationString: Save the message in the Drafts folder +*Composition*menuBar*saveAs.labelString: File +*Composition*menuBar*saveAs.mnemonic: F +*Composition*menuBar*saveAs.acceleratorText: -*menuBar*saveMessagesAs.labelString: Save As... -*menuBar*saveMessagesAs.mnemonic: A -*menuBar*saveMessagesAs.acceleratorText: Alt+S -*saveMessagesAs.documentationString: Save the message as a file +*menuBar*saveDraft.labelString: Draft +*menuBar*saveDraft.mnemonic: D +*saveDraft.documentationString: Finish this message at a later time by saving it in the Drafts folder. + +*menuBar*saveTemplate.labelString: Template +*menuBar*saveTemplate.mnemonic: T +*saveTemplate.documentationString: Use this message as a template for future messages. + +*menuBar*saveAsMenu.labelString: Save As... +*menuBar*saveAsMenu.mnemonic: A +*menuBar*saveAsMenu.acceleratorText: Alt+S +*menuBar*saveAsMenu.saveMessagesAs.documentationString: Save the message *menuBar*sendMessageNow.labelString: Send Now *menuBar*sendMessageNow.mnemonic: d @@ -1603,6 +1614,11 @@ Paste text from the original page in quoted form *menuBar*attach.mnemonic: A *attach.documentationString: Attach a page or address book card to the current message +*menuBar*showChrome.labelString: Show +*menuBar*showChrome.mnemonic: S + +*menuBar*floatingTaskBarClose.labelString: Floating Component Bar + !============================ File Menu - Message Center !============================ @@ -1646,9 +1662,8 @@ Open the selected mail folder or discussion group Get new mail and discussion group messages ! File/Get Messages Submenu -*menuBar*getNewMessages.labelString: New -*menuBar*getNewMessages.mnemonic: N -*menuBar*getNewMessages.acceleratorText: Alt+T +*menuBar*getNewMessages.labelString: Get New Messages +*menuBar*getNewMessages.mnemonic: M ! This label is generated dynamically from the preferences !*menuBar*getNextNNewMsgs.labelString: Next 500 @@ -1668,9 +1683,9 @@ Send messages in Outbox folder now *updateMessageCount.documentationString: \ Update number of unread messages -*addNewsgroup.labelString: Join Discussion Groups... +*menuBar*addNewsgroup.labelString: Subscribe... *menuBar*addNewsgroup.mnemonic: b -*addNewsgroup.documentationString: Join discussion groups +*addNewsgroup.documentationString: Subscribe... !============================= File Menu - Message Threads @@ -1693,24 +1708,45 @@ Open the selected attachment *menuBar*editMessage.mnemonic: E *editMessage.documentationString: Edit the selected message +*menuBar*saveAsTemplate.labelString: Template +*menuBar*saveAsTemplate.mnemonic: T + +*MailThread*menuBar*saveMessageAs.labelString: File +*MailThread*menuBar*saveMessageAs.mnemonic: F +*MailThread*menuBar*saveMessageAs.acceleratorText: Alt+S !========================== File Menu - Address Book !========================== -*addToAddressBook.labelString: New Card... -*addToAddressBook.mnemonic: w +*addToAddressBook.labelString: Card... +*addToAddressBook.mnemonic: C +*addToAddressBook.acceleratorText: Alt+N *addToAddressBook.documentationString: \ Create a new address book card entry -*abNewList.labelString: New List... +*abNewList.labelString: List... *abNewList.mnemonic: L *abNewList.documentationString: \ Create a new address book list +*abNewPAB.labelString: Address Book... +*abNewPAB.mnemonic: A +*abNewPAB.documentationString: \ +Create a new address book + +*abNewLDAPDirectory.labelString: Directory... +*abNewLDAPDirectory.mnemonic: D +*abNewLDAPDirectory.documentationString: \ +Create a Directory Server + *menuBar*import.labelString: Import... *menuBar*import.mnemonic: I *AddressBook*import.documentationString: \ Import a file into the address book +! +! customized for PAB +! +*AddressBook*menuBar*saveAs.labelString: Export... *AddressBook*menuBar*composeMessage.labelString: Message *menuBar*composeMessage.mnemonic: M @@ -1932,14 +1968,14 @@ Paste clipboard contents in quoted form *menuBar*search.labelString: Search Messages... *menuBar*search.mnemonic: M -!*menuBar*search.acceleratorText: Alt+S +*menuBar*search.acceleratorText: Alt+Shift+F *search.documentationString: Search mail and discussion group messages *menuBar*editConfiguration.labelString: Manage Mail Account *menuBar*editConfiguration.mnemonic: n -*menuBar*moderateDiscussion.labelString: Manage Discussion Group -*menuBar*moderateDiscussion.mnemonic: v +*menuBar*moderateDiscussion.labelString: Manage Newsgroups +*menuBar*moderateDiscussion.mnemonic: N *menuBar*editMailFilterRules.labelString: Mail Filters... *editMailFilterRules.documentationString: \ @@ -1993,12 +2029,15 @@ View mail folder or discussion group properties *abDeleteEntry.documentationString: \ Delete the selected address book entries +*menuBar*abDeleteAllEntries.labelString: Delete All Occurences +*menuBar*abDeleteAllEntries.mnemonic: O + *menuBar*displayHTMLDomainsDialog.labelString: HTML Domains... *menuBar*displayHTMLDomainsDialog.mnemonic: H *displayHTMLDomainsDialog.documentationString: \ Edit the list of domains that can receive HTML messages -*AddressBook*menuBar*viewProperties.labelString: Card Properties +*AddressBook*menuBar*viewProperties.labelString: Properties *menuBar*viewProperties.mnemonic: s *viewProperties.documentationString: \ Place a call with Mozilla Conference @@ -2213,6 +2252,7 @@ Wrap long lines when the message is sent View Menu - Message Center !============================ +*menuBar*showSubmenu.labelString: Show *MailFolder*hideNavToolbarCmdString: Hide Message Center Toolbar *MailFolder*showNavToolbarCmdString: Show Message Center Toolbar *MailFolder*toggleNavigationToolbar.documentationString: \ @@ -2234,6 +2274,9 @@ Show or hide the Message toolbar *showMsgAreaCmdString: Show Message *hideMsgAreaCmdString: Hide Message +*showFolderAreaCmdString: Show Folder +*hideFolderAreaCmdString: Hide Folder + *menuBar*sortSubmenu.labelString: Sort *menuBar*sortSubmenu.mnemonic: t @@ -2511,6 +2554,9 @@ Sort history list by visit count Go Menu - Message Threads !=========================== +*menuBar*nextSubmenu.labelString: Next +*menuBar*prevSubmenu.labelString: Previous + *menuBar*nextMessage.labelString: Next Message *menuBar*nextMessage.mnemonic: N *menuBar*nextMessage.acceleratorText: Alt+Down @@ -2574,6 +2620,9 @@ Go to the previous unread message *previousFlaggedMessage.documentationString: \ Go to the previous flagged message +*menuBar*firstUnreadMessage.labelString: First Unread Message +*menuBar*firstFlaggedMessage.mnemonic: U + *menuBar*firstFlaggedMessage.labelString: First Flagged Message *menuBar*firstFlaggedMessage.mnemonic: F *firstFlaggedMessage.documentationString: \ @@ -2643,6 +2692,9 @@ Forward the selected message *forwardMessageQuoted.documentationString: \ Forward the selected message as quoted text +*menuBar*forwardMessageInLine.labelString: Forward Inline +*menuBar*forwardMessageInLine.mnemonic: l + *menuBar*fileSubmenu.labelString: File Message *menuBar*fileSubmenu.mnemonic: l *fileSubmenu.documentationString: \ @@ -3053,6 +3105,12 @@ Open the address book *menuBar*bookmarksSubmenu.labelString: Bookmarks *menuBar*bookmarksSubmenu.mnemonic: B +*menuBar*toolsSubmenu.labelString: Tools +*menuBar*toolsSubmenu.mnemonic: T + +*menuBar*serverToolsSubmenu.labelString: Server Tools +*menuBar*serverToolsSubmenu.mnemonic: S + ! Communicator/Bookmarks Submenu *addBookmark.labelString: Add Bookmark *addBookmark.mnemonic: A @@ -3108,6 +3166,15 @@ File the current page in a Bookmarks folder *viewSecurity.documentationString: \ Show security information for this page +! Communicator/Server Tools Submenu +*menuBar*manageMailingList.labelString: Mailing Lists +*menuBar*manageMailingList.mnemonic: L + +*menuBar*managePublicFolders.labelString: Public Folders +*menuBar*managePublicFolders.mnemonic: F + +! end Communicator/Bookmarks Submenu + !=========== Help Menu !=========== @@ -3531,6 +3598,8 @@ Insert an arbitrary HTML Tag at the insertion location *popup*abDeleteEntry.mnemonic: D *popup*abDeleteEntry.acceleratorText: Alt+D ! +*popup*abDeleteAllEntries.labelString: Delete From All Lists +! *popup*addToAddressBook.labelString: New Card... *popup*addToAddressBook.mnemonic: w *popup*abNewList.labelString: New List... @@ -5126,6 +5195,7 @@ from the network, or save to a file and then play from the file? @CLASS@*XmLGrid.background: #C0C0C0 !@CLASS@*XmLGrid.selectBackground: #FFFFCC + ! Turn off borders in XmLFolder widgets. @CLASS@*XmLFolder.highlightThickness: 0 @@ -5251,22 +5321,39 @@ from the network, or save to a file and then play from the file? ! These are the fonts used in the outline lists used in Mail, News, Bookmarks, ! and Address Book windows. (Note that there can't be any whitespace after ! the commas.) -*XmLGrid*fontList:\ + +! For non-SUN platforms, user can accept font size to be 10 pt on the message list +@NOTSUN@@CLASS@*XmLGrid*fontList:\ -*-helvetica-medium-r-*-*-*-100-*-*-*-*-iso8859-*,\ -*-helvetica-bold-r-*-*-*-100-*-*-*-*-iso8859-*=BOLD,\ -*-helvetica-medium-o-*-*-*-100-*-*-*-*-iso8859-*=ITALIC +! For SUN platforms, user wants default font size to be 12 pt on the message list to be readable +@ONLYSUN@@CLASS@*XmLGrid*fontList:\ +-*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*, -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*=BOLD, -*-helvetica-medium-o-*-*-*-120-*-*-*-*-iso8859-*=ITALIC + ! Font for the Mail/News banner -*banner*folderDropdown*XmLabel.fontList: -adobe-courier-bold-r-*-*-*-100-*-*-*-*-iso8859-* -*banner*folderDropdown*shadowThickness: 1 -*banner*folderDropdown*.fontList:\ +! For non-SUN platforms, user can accept font size to be 10 pt to be default on the message list +@NOTSUN@@CLASS@*banner*folderDropdown*XmLabel.fontList: -adobe-courier-bold-r-*-*-*-100-*-*-*-*-iso8859-* +@NOTSUN@@CLASS@*banner*folderDropdown*fontList:\ -adobe-courier-medium-r-*-*-*-100-*-*-*-*-iso8859-*,\ -adobe-courier-bold-r-*-*-*-100-*-*-*-*-iso8859-*=BOLD -*banner*title.fontList: -*-helvetica-bold-r-*-*-*-100-*-*-*-*-iso8859-* -*banner*subtitle.fontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-iso8859-* -*banner*info.fontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-iso8859-* +@NOTSUN@@CLASS@*banner*title.fontList: -*-helvetica-bold-r-*-*-*-100-*-*-*-*-iso8859-* +@NOTSUN@@CLASS@*banner*subtitle.fontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-iso8859-* +@NOTSUN@@CLASS@*banner*info.fontList: -*-helvetica-medium-r-*-*-*-100-*-*-*-*-iso8859-* +! For SUN platforms, user wants default font size to be 12 pt on the message list to be readable +@ONLYSUN@@CLASS@*banner*folderDropdown*XmLabel.fontList: -adobe-courier-bold-r-*-*-*-120-*-*-*-*-iso8859-* +@ONLYSUN@@CLASS@*banner*folderDropdown*.fontList:\ +-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*,\ +-adobe-courier-bold-r-*-*-*-120-*-*-*-*-iso8859-*=BOLD + +@ONLYSUN@@CLASS@*banner*title.fontList: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-* +@ONLYSUN@@CLASS@*banner*subtitle.fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-* +@ONLYSUN@@CLASS@*banner*info.fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-* + +*banner*folderDropdown*shadowThickness: 1 ! Font for the Thread window expando flippy label *arrowlabel.fontList: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-* @@ -6052,6 +6139,7 @@ Drag a document here to attach it to this message. ! *prefs*fontList: -*-helvetica-medium-r-normal-*-*-120-*-*-*-*-iso8859-* *prefs_popup.title: @NAME@: Preferences +*pref.category: Category *prefs.form.leftPane.topOffset: 8 *prefs.form.leftPane.leftOffset: 8 @@ -6243,6 +6331,39 @@ rather than via the proxy: *prefsProxiesView*waisPortLabel.labelString: Port: *prefsProxiesView*socksPortLabel.labelString: Port: +! Preferences dialog - Location Independence: General Prefs +*prefs*liGeneral*topTitle.labelString: General Flags +*prefs*liGeneral*enableToggle.labelString: Enable Location Independence +*prefs*liGeneral*syncToggle.labelString: Background synchronize every +*prefs*liGeneral*unitLabel.labelString: minutes. +*prefs*liLoginAdvancedButton.labelString: More Options... + +*prefs*liGeneral*bottomTitle.labelString: User Information +*prefs*liGeneral*userInfoLabel.labelString: Enter your login info to retrieve your network profile. +*prefs*liGeneral*userLabel.labelString: User Name: +*prefs*liGeneral*passwordLabel.labelString: Password: + +! Preferences dialog - Location Independence: Server Prefs +*prefs*liServer*serverLabel.labelString: Enter the parameters necessary to connect to your profile server. +*prefs*liServer*frameLabel.labelString: Server Information +*prefs*liServer*ldapToggle.labelString: LDAP (Netscape Directory Server) +*prefs*liServer*ldapAddrLabel.labelString: Address: +*prefs*liServer*ldapBaseLabel.labelString: Search Base: +*prefs*liServer*httpToggle.labelString: HTTP Server (Netscape Enterprise Server) +*prefs*liServer*httpBaseLabel.labelString: Base URL: + +! Preferences dialog - Location Independence: File Prefs +*prefs*liFiles*fileLabel.labelString: Select which files to transfer by default as part of the startup/shutdown procedure. +*prefs*liFiles*frameLabel.labelString: Files/File Groups +*prefs*liFiles*bookmarkToggle.labelString: Bookmarks +*prefs*liFiles*cookiesToggle.labelString: Cookies +*prefs*liFiles*filterToggle.labelString: Mail Filters +*prefs*liFiles*addrbookToggle.labelString: Address Book +*prefs*liFiles*navcenterToggle.labelString: Nav Center +*prefs*liFiles*prefsToggle.labelString: User Preferences +*prefs*liFiles*javasecToggle.labelString: Java Security Files +*prefs*liFiles*certToggle.labelString: Certificates + ! Preferences dialog - Advanced/Disk space *prefs*diskSpace*allMsgsBoxLabel.labelString: All Messages @@ -6338,52 +6459,25 @@ Reuse message list (thread) window \n\ Reuse message window \n\ (All messages appear in the same window) -! Preferences dialog - Mail News/Composition -*prefs*mailnewsCompose*msgPropLabel.labelString:Message Properties -*prefs*mailnewsCompose*ccLabel.labelString: Copies of Outgoing Messages -*prefs*mailnewsCompose*emailLabel.labelString: Automatically email a copy of outgoing messages to -*prefs*mailnewsCompose*mailMsgLabel.labelString:Mail messages: -*prefs*mailnewsCompose*mEmailSelfToggle.labelString:Self -*prefs*mailnewsCompose*mEmailOtherLabel.labelString:Other address: -*prefs*mailnewsCompose*newsMsgLabel.labelString: Groups messages: -*prefs*mailnewsCompose*nEmailSelfToggle.labelString:Self -*prefs*mailnewsCompose*nEmailOtherLabel.labelString:Other address: -*prefs*mailnewsCompose*fccLabel.labelString: Automatically copy outgoing messages to a folder -*prefs*mailnewsCompose*mailFolderToggle.labelString:Mail messages: -*prefs*mailnewsCompose*newsFolderToggle.labelString:Groups messages -*prefs*mailnewsCompose*autoQuoteToggle.labelString: Automatically quote original message when replying -*prefs*mailnewsCompose*sendHtmlMsgToggle.labelString:By default, send rich text (HTML) messages -*prefs*mailnewsCompose*wrapLabel.labelString: Wrap long lines at -*prefs*mailnewsCompose*charLabel.labelString: characters -*prefs*mailnewsCompose*moreButton.labelString: More Options... - -! Preferences dialog - Mail News/Messages - More - -*prefsMsgMore*fontList: -*-helvetica-medium-r-normal-*-*-120-*-*-*-*-iso8859-* -*prefsMsgMore_popup.title: @NAME@: More Messages Preferences -*prefsMsgMore*addressingLabel.labelString: When addressing messages: -*prefsMsgMore*nameAndNicknamesToggle.labelString: Expand addresses against names and nicknames -*prefsMsgMore*nicknamesOnlyToggle.labelString: Expand addresses against nicknames only -*prefsMsgMore*composeLabel.labelString: Send messages that use 8-bit characters -*prefsMsgMore*8bitToggle.labelString: As is (does not work well with some mail servers) -*prefsMsgMore*qpToggle.labelString: \ -Using the \"quoted printable\" MIME encoding\n\ -(does not work well with some mail or discussion\n\ -groups readers) -*prefsMsgMore*sendLabel.labelString: \ -When sending HTML messages to recipients who are not\n\ -listed as being able to receive HTML messages: -*prefsMsgMore*askToggle.labelString: Always ask me what to do -*prefsMsgMore*sendTextToggle.labelString:\ -Always convert the message into Plain Text\n\ -(may lose some formatting) -*prefsMsgMore*sendHtmlToggle.labelString:\ -Always send the message in HTML anyway\n\ -(may be unreadable to some recipients) -*prefsMsgMore*sendBothToggle.labelString:\ -Always send the message in both Plain Text and HTML\n\ -(may take a lot of disk space for the recipient) +! Preferences dialog - Mail News/Messages +*prefs*mailnewsMessages*replyLabel.labelString: Replying to messages: +*prefs*mailnewsMessages*forwardLabel.labelString: By Default Forward Messages: +*prefs*mailnewsMessages*autoquoteToggle.labelString: Automatically quote the original message when replying +*prefs*mailnewsMessages*autoquoteMyReplyLabel.labelString: Add my reply +*prefs*mailnewsMessages*autoquoteSepLabel.labelString: Seperate reply and quoted text by +*prefs*mailnewsMessages*autoquoteSepLinesLabel.labelString: lines +*prefs*mailnewsMessages*spellLabel.labelString: Spell checking: +*prefs*mailnewsMessages*spellToggle.labelString: Spell check messages before sending +*prefs*mailnewsMessages*wrapLabel.labelString: Message wrapping: +*prefs*mailnewsMessages*wrapToggle.labelString: Wrap incoming, plain text messages to window width +*prefs*mailnewsMessages*wrapLengthLabel.labelString: Wrap outgoing, plain text messages at: +*prefs*mailnewsMessages*wrapLengthAfterLabel.labelString: characters +*prefs*mailnewsMessages*eightbitLabel.labelString: Send messages that use 8-bit charaters: +*prefs*mailnewsMessages*eightbitAsIsToggle.labelString: As is (does not work well with some mail servers) +*prefs*mailnewsMessages*eightbitQuotedToggle.labelString: \ +Using the "quoted printable" MIME encoding \n\ +(does not work well with some mail or news group readers) ! Preferences dialog - Mail News/Identity @@ -6403,31 +6497,106 @@ Reply-to address (only needed if different from email address): ! Preferences dialog - Mail News/Mail Server -*prefs*mailnewsMserver*serverLabel.labelString: \ -The information below is needed before you can receive mail. If you do\n\ -not know the information requested, please contact your system\n\ -administrator or Internet Service Provider. -*prefs*mailnewsMserver*popUserNameLabel.labelString:Mail server user name: -*prefs*mailnewsMserver*outgoingMailServerLabel.labelString:\ +*prefs*mailnewsMserver*iServerFrame*incomingServerLabel.labelString: \ + Incoming mail servers +*prefs*mailnewsMserver*oServerFrame*outgoingServerLabel.labelString: \ +Outgoing mail server +*prefs*mailnewsMserver*localFrame*localMailDirLabel.labelString: \ +Local mail directory +*prefs*mailnewsMserver*iServerFrame*iServerBox*ButtonForm*New.labelString: \ +Add... +*prefs*mailnewsMserver*iServerFrame*iServerBox*ButtonForm*Edit.labelString: \ +Edit... +*prefs*mailnewsMserver*iServerFrame*iServerBox*ButtonForm*Delete.labelString: \ +Delete + +*SubUpgradeDialog*paragraphLabel.labelString: \ +Messenger detects that you have upgraded from a previous version. In order to read your \n\ +mail, Messenger will need to know which folders you would like to subscribe to.\n\ +\n\ +Only folders you subscribe to will appear in your folder view. Any folders you do not\n\ +subscribe to will not be available. (Note: you can always change which folders\n\ +you subscribe to later on by selecting Subscribe from the File menu.) +*SubUpgradeDialog*automaticToggle.labelString: \ +Automatically subscribe to all my folders on "(server)" +*SubUpgradeDialog*customToggle.labelString: \ +Let me choose now which folders are subscribed to + +! Preferences dialog - incoming mail server - new server pop up + +*MailServerInfo.title: Netscape: Mail server info +*MailServerInfo*form1*ServerName.labelString: \ +Server Name: +*MailServerInfo*form1*ServerType.labelString: \ +Server Type: +*MailServerInfo*form1*ServerUser.labelString: \ +User Name: +*MailServerInfo*form1*RememberPass.labelString: \ +Remember password +*MailServerInfo*form1*CheckMail.labelString: \ +Check for mail every +*MailServerInfo*form1*MinuteLabel.labelString: \ +minutes +*MailServerInfo*form1*imapOption.labelString: IMAP +*MailServerInfo*form1*popOption.labelString: POP + +! Imap tab + +*prefs_popup*MailServerInfo*xmlFolder*form2*imapImap.labelString: IMAP +*prefs_popup*MailServerInfo*xmlFolder*form2*deleteLabel.labelString: \ +When I delete a message: +*prefs_popup*MailServerInfo*xmlFolder*form2*trashToggle.labelString: \ +Move it to the Trash folder \n\ +(It will be removed when I select 'Empty Trash') +*prefs_popup*MailServerInfo*xmlFolder*form2*markToggle.labelString: \ +Mark it as deleted \n\ +(It will be removed when I select 'Compact This Folder') +*prefs_popup*MailServerInfo*xmlFolder*form2*removeToggle.labelString: \ +Remove it immediately \n\ +(It can be restored by selecting Undo) + +*prefs_popup*MailServerInfo*xmlFolder*form2*UseSSL.labelString: \ +Use secure connection (SSL) + +! Advanced tab + +*MailServerInfo*form3*PathPrefsLabel.labelString: \ +These preferences specify the different namespaces on your\n\ +IMAP server. +*MailServerInfo*form3*PersonalDir.labelString: \ +Personal Directory +*MailServerInfo*form3*PublicDir.labelString: \ +Public (shared) +*MailServerInfo*form3*OtherUsers.labelString: \ +Other Users +*MailServerInfo*form3*AllowServer.labelString: \ +Allow server to override these namespaces + +! pop server - general tab + +*MailServerInfo*form4*LeaveMessages.labelString: \ +Leave messages on server + +! Preferences dialog - outgoing mail server +*prefs*mailnewsMserver*oServerFrame*oServerBox*oServerLabel.labelString: \ Outgoing mail (SMTP) server: -*prefs*mailnewsMserver*incomingMailServerLabel.labelString: Incoming mail server: -*prefs*mailnewsMserver*serverTypeLabel.labelString: Mail server type: -*prefs*mailnewsMserver*pop3Toggle.labelString: \ -POP3 (messages and folders are kept locally, on the hard disk) -*prefs*mailnewsMserver*leaveMsgToggle.labelString: \ -Leave messages on server after retrieval -*prefs*mailnewsMserver*moveMailToggle.labelString: Movemail application -*prefs*mailnewsMserver*imapToggle.labelString: \ -IMAP4 (messages and folders are kept remotely, on the server) -*prefs*mailnewsMserver*imapLocalCopiesToggle.labelString: \ -By default, copies of folders are kept locally for reading mail offline -*prefs*mailnewsMserver*imapServerSslToggle.labelString: Server supports encrypted connections (SSL) -*prefs*mailnewsMserver*imapDeleteToggle.labelString: Move deleted messages into trash -*prefs*mailnewsMserver*inboxToggle.labelString: System Inbox -*prefs*mailnewsMserver*builtInAppToggle.labelString: Built in -*prefs*mailnewsMserver*externalAppToggle.labelString: External application -*prefs*mailnewsMserver*externalAppBrowse.labelString: Choose... -*prefs*mailnewsMserver*moreButton.labelString: More Options... +*prefs*mailnewsMserver*oServerFrame*oServerBox*serverUsernameLabel.labelString:\ +Mail server user name: +*prefs*mailnewsMserver*oServerFrame*oServerBox*chooseSSLLabel.labelString: \ +Use Secure Socket Layer (SSL) or TLS for outgoing messages: +*prefs*mailnewsMserver*oServerFrame*oServerBox*sslNever.labelString: \ +Never +*prefs*mailnewsMserver*oServerFrame*oServerBox*sslIfPossible.labelString: \ +If Possible +*prefs*mailnewsMserver*oServerFrame*oServerBox*sslAlways.labelString: \ +Always + +! Preferences dialog - mail server - local mail directory + +*prefs*mailnewsMserver*localFrame*localBox*localMailDir.labelString: \ +Directory: +*prefs*mailnewsMserver*localFrame*localBox*chooseButton.labelString: \ +Choose... ! Preferences dialog - Mail News/Mail Server - More @@ -6451,17 +6620,25 @@ Remember my mail password. ! Preferences dialog - Mail News/News Server -*prefs*mailnewsNserver*newsServerLabel.labelString: \ -The information below is needed before you can read discussion\n\ -groups. If you do not know the information requested, please contact \n\ -your system administrator or Internet Service Provider. -*prefs*mailnewsNserver*nntpServerLabel.labelString: Discussion groups (news) server: -*prefs*mailnewsNserver*newsDirLabel.labelString: Discussion groups (news) directory: -*prefs*mailnewsNserver*notify.labelString: Ask me before downloading more than -*prefs*mailnewsNserver*msgLabel.labelString: messages -*prefs*mailnewsNserver*browse.labelString: Choose... -*prefs*mailnewsNserver*portLabel.labelString: Port: -*prefs*mailnewsNserver*secure.labelString: Secure +*prefs*mailnewsNServer*serverLabel.labelString: Newgroup Servers +*prefs*mailnewsNServer*serverAddButton.labelString: Add... +*prefs*mailnewsNServer*serverEditButton.labelString: Edit... +*prefs*mailnewsNServer*serverDeleteButton.labelString: Delete +*prefs*mailnewsNServer*serverDefaultButton.labelString: Set as Default +*prefs*mailnewsNServer*localLabel.labelString: Local News Storage +*prefs*mailnewsNServer*dirLabel.labelString: Discussion group (news) folder: +*prefs*mailnewsNServer*chooseButton.labelString: Choose... +*prefs*mailnewsNServer*sizeLimitToggle.labelString: Ask me before downloading more than +*prefs*mailnewsNServer*sizeLimit2.labelString: messages. + +! Preferences dialog - Mail News/News Server popup + +*NewsServerInfo*serverLabel.labelString: Server: +*NewsServerInfo*portLabel.labelString: Port: +*NewsServerInfo*sslToggle.labelString: \ +Support encrypted connections (SSL) +*NewsServerInfo*passwordToggle.labelString: \ +Always use name and password ! Preferences dialog - Mail News/Address Book @@ -6477,6 +6654,18 @@ these directories in the following order: *prefs*mailnewsAddrBook*firstLastLabel.labelString: (John Smith) *prefs*mailnewsAddrBook*lastFirstLabel.labelString: (Smith, John) +*prefs*mailnewsAddress*messageLabel.labelString: When addressing messages: +*prefs*mailnewsAddress*completeLabel.labelString: Auto-complete names from: +*prefs*mailnewsAddress*completeABToggle.labelString: Address books +*prefs*mailnewsAddress*completeDirToggle.labelString: This Directory: +*prefs*mailnewsAddress*conflictLabel.labelString: If there are two or more matches: +*prefs*mailnewsAddress*conflictShowToggle.labelString: Show me a list of choices +*prefs*mailnewsAddress*conflictAcceptToggle.labelString: Accept what I have typed +*prefs*mailnewsAddress*onlyMatchLabel.labelString: If there is only one match in your personal address books: +*prefs*mailnewsAddress*onlyMatchToggle.labelString: Use the address and do not search in the directory +*prefs*mailnewsAddress*sortLabel.labelString: Sort full names by: +*prefs*mailnewsAddress*sortFirstToggle.labelString: First Name Lastname (John Smith) +*prefs*mailnewsAddress*sortLastToggle.labelString: LastName, First Name (Smith, John) ! Preferences dialog - Mail News/Directory - New/Edit *prefsLdapProp*fontList: -*-helvetica-medium-r-normal-*-*-120-*-*-*-*-iso8859-* @@ -6488,6 +6677,33 @@ these directories in the following order: *prefsLdapProp*numHitLabel.labelString: Maximum Number of Hits: *prefsLdapProp*secure.labelString: Secure *prefsLdapProp*savePasswd.labelString: Save Password +! Preferences dialog - Mail News/Message Copies + +*prefs*mailnewsCopies*newsCopies.labelString: Copy outgoing newsgroup messages to +*prefs*mailnewsCopies*newsOtherToggle.labelString: BCC other addresses: +*prefs*mailnewsCopies*newsChooseButton.labelString: Choose Folder ... +*prefs*mailnewsCopies*newsFccToggle.labelString: Folder %s on %s +*prefs*mailnewsCopies*mailCopies.labelString: Copy outgoing mail messages to +*prefs*mailnewsCopies*mailOtherToggle.labelString: BCC other addresses: +*prefs*mailnewsCopies*mailChooseButton.labelString: Choose Folder ... +*prefs*mailnewsCopies*mailFccToggle.labelString: Folder %s on %s +*prefs*mailnewsCopies*dtCopies.labelString: Storage for Drafts and Templates +*prefs*mailnewsCopies*dSaveToggle.labelString: Keep drafts in '%s' on %s +*prefs*mailnewsCopies*tSaveToggle.labelString: Keep templates in '%s' on %s +*prefs*mailnewsCopies*dFccButton.labelString: Choose Folder ... +*prefs*mailnewsCopies*tFccButton.labelString: Choose Folder ... + +*prefsMailFolderDialog*specificFolder.labelString: Other: + +! Preferences dialog - HTML Formatting +*prefs*mailnewsHTML*useHTML.labelString: Enable HTML message formatting +*prefs*mailnewsHTML*useHTMLToggle.labelString: Use the HTML editor to compose messages +*prefs*mailnewsHTML*noHTML.labelString: When sending HTML messages to recipients who are not\nlisted as being able to recieve them: +*prefs*mailnewsHTML*noHTMLoverride.labelString: You can override these settings in any message through the\noptions panel of the message composition window. +*prefs*mailnewsHTML*noHTMLAsk.labelString: Ask me what to do if the message has HTML formatting,\notherwise send plain text. +*prefs*mailnewsHTML*noHTMLText.labelString: Convert the message into plain text.\n(May loose some formatting) +*prefs*mailnewsHTML*noHTMLHTML.labelString: Send the message in HTML anyway\n(some recipients may not be able to read it) +*prefs*mailnewsHTML*noHTMLBoth.labelString: Send the message in plain text and HTML\n(uses more disk space) ! Preferences dialog - Editor @@ -6502,6 +6718,18 @@ these directories in the following order: *prefs*editor*minutes.labelString: minutes *prefs*editor*browse.labelString: Choose... +! Preferences dialog - Read Receipts +*prefs*mailnewsReceipts*requestReceiptsLabel.labelString: If I request a receipt when sending a message, I want +*prefs*mailnewsReceipts*dsn.labelString: A delivery receipt (DSN) from the receiving server +*prefs*mailnewsReceipts*mdn.labelString: A read receipt (MDN) notify me when receipients display this message +*prefs*mailnewsReceipts*both.labelString: Both types of receipt +*prefs*mailnewsReceipts*receiptsArriveLabel.labelString: When a receipt arrives +*prefs*mailnewsReceipts*inbox.labelString: Leave it in my inbox +*prefs*mailnewsReceipts*sentmail.labelString: Move it to my Sent Mail folder +*prefs*mailnewsReceipts*receiveReceiptsLabel.labelString: When I receive a message and sender requested a receipt (MDN) +*prefs*mailnewsReceipts*never.labelString: Never return a receipt +*prefs*mailnewsReceipts*some.labelString: Return receipts for some messages + ! Preferences dialog - Editor/Publish *prefs*editor*linksAndImagesTitle.labelString: Links and images @@ -6565,20 +6793,26 @@ for download. *pref.applications: Applications *pref.mailNews: Mail & Groups *pref.identity: Identity -*pref.composition: Messages -*pref.mailServer: Mail Server -*pref.newsServer: Groups Server -*pref.addressBook: Directory +*pref.messages: Messages +*pref.mailServer: Mail Servers +*pref.newsServer: Newsgroups Servers +*pref.addressing: Addressing +*pref.copies: Copies and Folders +*pref.htmlmail: Formatting +*pref.readreceipts: Return Receipts +*pref.diskSpace: Disk Space *pref.editor: Composer *pref.editorAppearance: New Page Colors *pref.editorPublish: Publish *pref.offline: Offline *pref.offlineNews: Groups -*pref.diskSpace: Disk Space *pref.helpFiles: Help Files *pref.advanced: Advanced *pref.cache: Cache *pref.proxies: Proxies +*pref.liGeneral: Location Independence +*pref.liServer: Server Info +*pref.liFiles: File Selection *prefDesc.appearance: Change the appearance of the display *prefDesc.fonts: Change the fonts in your display @@ -6589,9 +6823,13 @@ for download. *prefDesc.mailNews: Change appearance settings for Mail & Groups *prefDesc.identity: Set your name, email address, and signature file *prefDesc.composition: Choose settings for outgoing messages -*prefDesc.mailServer: Specify server for incoming mail -*prefDesc.newsServer: Specify server for reading discussion groups +*prefDesc.mailServer: Specify servers for mail +*prefDesc.newsServer: Specify your servers for reading newsgroups *prefDesc.addressBook: Choose directories for searching addresses +*prefDesc.addressing: Choose settings for addressing messages +*prefDesc.copies: Copies, drafts, and templates +*prefDesc.htmlMail: Send HTML formatted messages +*prefDesc.readReceipts: Choose settings for requesting or returning receipts *prefDesc.editor: Set general preferences for authoring Web pages *prefDesc.editorAppearance: Choose default appearance of new Web pages *prefDesc.editorPublish: Designate the default publishing location @@ -6602,6 +6840,9 @@ for download. *prefDesc.advanced: Change preferences that affect the entire product *prefDesc.cache: Designate the size of the cache *prefDesc.proxies: Configure proxies to access the Internet +*prefDesc.liGeneral: Enter your remote server login info +*prefDesc.liServer: Specify the remote server info +*prefDesc.liFiles: Specify which files to store remotely ! Preferences dialog - TODOs @@ -6626,16 +6867,17 @@ for download. ! Subscribe UI *subscribeFolder*fontList: -*-helvetica-medium-r-normal-*-*-120-*-*-*-*-iso8859-* -*subscribeFolder*toggleSubscribe.labelString: Join -*subscribeFolder*expandAll.labelString: Expand All +*subscribeFolder*toggleSubscribe.labelString: Subscribe +*subscribeFolder*unsubscribe.labelString: Unsubscribe +*subscribeFolder*expandAll.labelString: Expand *subscribeFolder*collapseAll.labelString: Collapse All -*subscribeFolder*fetchGroupList.labelString: Get Discussion Groups +*subscribeFolder*fetchGroupList.labelString: Refresh List *subscribeFolder*stopLoading.labelString: Stop *subscribeFolder*getNewGroups.labelString: Get New *subscribeFolder*clearNewGroups.labelString: Clear New *subscribeFolder*search.labelString: Search Now *subscribeFolder*addNewsServer.labelString: Add Server... - +*subscribeFolder*subNewInfoLabel.labelString: This list shows all new discussion groups since you last cleared the list. *subscribeFolder*searchLabel.labelString: Search For: *subscribeFolder*onserverLabel.labelString: On Server: *subscribeFolder*serverLabel.labelString: Server: @@ -6932,6 +7174,7 @@ for download. *toolBar*newFolder.labelString: New Folder *toolBar*addNewsgroup.labelString: Join Groups *toolBar*deleteFolder.labelString: Delete +*toolBar*deleteAny.labelString: Delete *unsubscribeNewsgroupCmdString: Delete Discussion *deleteFolderCmdString: Delete Folder @@ -6958,6 +7201,7 @@ for download. *toolBar*nextUnreadCollection.labelString: Next Unread Collection *toolBar*forwardMessage.labelString: Forward *toolBar*deleteMessage.labelString: Delete +*toolBar*deleteAny.labelString: Delete *toolBar*previousUnreadMessage.labelString: Previous *toolBar*previousMessage.labelString: Previous *previousMessage.tipString: Previous message @@ -7088,6 +7332,9 @@ Edit the list of domains that can receive HTML messages *MailFolderProps*total_label.labelString: Total Messages: *MailFolderProps*wasted_label.labelString: Disk Space Wasted: *MailFolderProps*space_label.labelString: Total Space Used: +*MailFolderProps*sharePrivilegesLabel.labelString: Share this and \ +other folders with network users \n\ +and display and set access privileges ! ! For the news server property dialog @@ -7425,7 +7672,12 @@ when necessary -*AddressOutlinerPopup*fontList:\ +@ONLYSUN@@CLASS@*AddressOutlinerPopup*fontList:\ +-*-helvetica-medium-r-*-*-*-120-*-*-*-*-iso8859-*,\ +-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*=BOLD,\ +-*-helvetica-medium-o-*-*-*-120-*-*-*-*-iso8859-*=ITALIC + +@NOTSUN@@CLASS@*AddressOutlinerPopup*fontList:\ -*-helvetica-medium-r-*-*-*-100-*-*-*-*-iso8859-*,\ -*-helvetica-bold-r-*-*-*-100-*-*-*-*-iso8859-*=BOLD,\ -*-helvetica-medium-o-*-*-*-100-*-*-*-*-iso8859-*=ITALIC diff --git a/mozilla/cmd/xfe/src/AB2PaneView.cpp b/mozilla/cmd/xfe/src/AB2PaneView.cpp index e185e90447d..b393fabbdc1 100644 --- a/mozilla/cmd/xfe/src/AB2PaneView.cpp +++ b/mozilla/cmd/xfe/src/AB2PaneView.cpp @@ -51,8 +51,6 @@ XFE_AB2PaneView::XFE_AB2PaneView(XFE_Component *toplevel_component, xmFormWidgetClass, parent, NULL); - - Widget hpane; hpane = XtVaCreateWidget("hpane", @@ -296,7 +294,14 @@ XFE_AB2PaneView::isCommandEnabled(CommandType command, void *calldata, XFE_CommandInfo* i) { - if (m_focusedView) + if (IS_CONTAINER_PANE_CMD(command)) + return m_dirListView->isCommandEnabled(command, calldata, i); + else if (IS_AB_PANE_CMD(command)) + return m_entriesListView->isCommandEnabled(command, calldata, i); + else if (m_focusedView) + /* + * AB_PropertiesCmd | AB_DeleteCmd | AB_PropertiesCmd | + */ return m_focusedView->isCommandEnabled(command, calldata, i); return FALSE; } @@ -306,7 +311,14 @@ XFE_AB2PaneView::isCommandSelected(CommandType command, void *calldata, XFE_CommandInfo* i) { - if (m_focusedView) + if (IS_CONTAINER_PANE_CMD(command)) + return m_dirListView->isCommandSelected(command, calldata, i); + else if (IS_AB_PANE_CMD(command)) + return m_entriesListView->isCommandSelected(command, calldata, i); + else if (m_focusedView) + /* + * AB_PropertiesCmd | AB_DeleteCmd | AB_PropertiesCmd | + */ return m_focusedView->isCommandSelected(command, calldata, i); return FALSE; } @@ -316,7 +328,14 @@ XFE_AB2PaneView::handlesCommand(CommandType command, void *calldata, XFE_CommandInfo* i) { - if (m_focusedView) + if (IS_CONTAINER_PANE_CMD(command)) + return m_dirListView->handlesCommand(command, calldata, i); + else if (IS_AB_PANE_CMD(command)) + return m_entriesListView->handlesCommand(command, calldata, i); + else if (m_focusedView) + /* + * AB_PropertiesCmd | AB_DeleteCmd | AB_PropertiesCmd | + */ return m_focusedView->handlesCommand(command, calldata, i); return FALSE; } @@ -326,7 +345,14 @@ XFE_AB2PaneView::doCommand(CommandType command, void *calldata, XFE_CommandInfo* i) { - if (m_focusedView) + if (IS_CONTAINER_PANE_CMD(command)) + m_dirListView->doCommand(command, calldata, i); + else if (IS_AB_PANE_CMD(command)) + m_entriesListView->doCommand(command, calldata, i); + else if (m_focusedView) + /* + * AB_PropertiesCmd | AB_DeleteCmd | AB_PropertiesCmd | + */ m_focusedView->doCommand(command, calldata, i); } diff --git a/mozilla/cmd/xfe/src/ABAddrSearchView.cpp b/mozilla/cmd/xfe/src/ABAddrSearchView.cpp index 133ec9ea76b..be847bbc7f5 100644 --- a/mozilla/cmd/xfe/src/ABAddrSearchView.cpp +++ b/mozilla/cmd/xfe/src/ABAddrSearchView.cpp @@ -56,12 +56,6 @@ extern int XFE_AB_HEADER_LOCALITY; #define OUTLINER_GEOMETRY_PREF "addressbook.searchpane.outliner_geometry" -#if !defined(EMPTY_STRVAL) -#define EMPTY_STRVAL(value) \ - (!(value) || !((value)->u.string) || !XP_STRLEN(((value)->u.string))) - -#endif - XFE_AddrSearchView::XFE_AddrSearchView(XFE_Component *toplevel_component, Widget parent /* the form */, XFE_View *parent_view, @@ -151,13 +145,14 @@ XFE_CALLBACK_DEFN(XFE_AddrSearchView, updateCommands)(XFE_NotificationCenter*, !m_bccBtn) return; +#if defined(USE_ABCOM) + uint32 count32 = MSG_GetNumLines(m_pane); + // XtSetSensitive(m_propertyBtn, True); +#else /* properties */ XtSetSensitive(m_propertyBtn, m_dir?True:False); -#if defined(USE_ABCOM) - uint32 count32 = MSG_GetNumLines(m_pane); -#else /* check which is selected */ uint32 count32 = 0; @@ -166,6 +161,7 @@ XFE_CALLBACK_DEFN(XFE_AddrSearchView, updateCommands)(XFE_NotificationCenter*, AB_GetEntryCount (m_dir, m_AddrBook, &count32, (ABID) ABTypeAll, 0); #endif /* USE_ABCOM */ + int count = 0; const int *indices = 0; m_outliner->getSelection(&indices, &count); @@ -192,364 +188,6 @@ XFE_CALLBACK_DEFN(XFE_AddrSearchView, updateCommands)(XFE_NotificationCenter*, }/* else */ } -fe_icon* -XFE_AddrSearchView::getColumnIcon(int column) -{ - fe_icon *myIcon = 0; -#if defined(USE_ABCOM) - switch (column) { - case OUTLINER_COLUMN_TYPE: - { - AB_EntryType type = getType(m_containerInfo, m_entryID); - if (type == AB_Person) - myIcon = &m_personIcon; /* shall call make/initialize icons */ - else if (type == AB_MailingList) - myIcon = &m_listIcon; - } - break; - }/* switch () */ - -#else - switch (column) { - case OUTLINER_COLUMN_TYPE: - { - ABID type; - AB_GetType(m_dir, m_AddrBook, m_entryID, &type); - if (type == ABTypePerson) - myIcon = &m_personIcon; /* shall call make/initialize icons */ - else if (type == ABTypeList) - myIcon = &m_listIcon; - } - break; - }/* switch () */ -#endif /* USE_ABCOM */ - return myIcon; -} - -/* Methods for the outlinable interface. - */ - -/* The Outlinable interface. - */ -char *XFE_AddrSearchView::getCellTipString(int row, int column) -{ - char *tmp = 0; - static char tipstr[128]; - tipstr[0] = '\0'; - - if (row < 0) { - /* header - */ - tmp = getColumnHeaderText(column); - }/* if */ - else { - ABID orgID = m_entryID; - - /* content - */ -#if defined(USE_ABCOM) - int error = AB_GetABIDForIndex(m_pane, - (MSG_ViewIndex) row, - &m_entryID); -#else - m_entryID = AB_GetEntryIDAt((AddressPane *) m_abPane, (uint32) row); -#endif /* USE_ABCOM */ - tmp = getColumnText(column); - - /* reset - */ - m_entryID = orgID; - }/* else */ - if (tmp && - (!m_outliner->isColTextFit(tmp, row, column))) - XP_STRCPY(tipstr,tmp); - return tipstr; -} - -char *XFE_AddrSearchView::getCellDocString(int /* row */, - int /* column */) -{ - return NULL; -} - -/* Returns the text and/or icon to display at the top of the column. - */ -char* -XFE_AddrSearchView::getColumnHeaderText(int column) -{ - char *tmp = 0; - switch (column) { - case OUTLINER_COLUMN_NAME: - tmp = XP_GetString(XFE_AB_HEADER_NAME); - break; - case OUTLINER_COLUMN_EMAIL: - tmp = XP_GetString(XFE_AB_HEADER_EMAIL); - break; - - case OUTLINER_COLUMN_NICKNAME: - tmp = XP_GetString(XFE_AB_HEADER_NICKNAME); - break; - - case OUTLINER_COLUMN_PHONE: - tmp = XP_GetString(XFE_AB_HEADER_PHONE); - break; - - case OUTLINER_COLUMN_COMPANY: - tmp = XP_GetString(XFE_AB_HEADER_COMPANY); - break; - - case OUTLINER_COLUMN_LOCALITY: - tmp = XP_GetString(XFE_AB_HEADER_LOCALITY); - break; - }/* switch */ - return tmp; -} - -char* -XFE_AddrSearchView::getColumnText(int column) -{ - - static char a_line[AB_MAX_STRLEN]; - a_line[0] = '\0'; -#if defined(USE_ABCOM) - AB_AttributeValue *value = 0; - AB_AttribID attrib = AB_attribEntryType; - XP_Bool isPhone = False; - switch (column) { - case OUTLINER_COLUMN_NAME: - attrib = AB_attribFullName; // shall be AB_attribDisplayName; - break; - - case OUTLINER_COLUMN_EMAIL: - attrib = AB_attribEmailAddress; - break; - - case OUTLINER_COLUMN_NICKNAME: - attrib = AB_attribNickName; - break; - - case OUTLINER_COLUMN_PHONE: - isPhone = True; - attrib = AB_attribWorkPhone; - break; - - case OUTLINER_COLUMN_COMPANY: - attrib = AB_attribCompanyName; - break; - - case OUTLINER_COLUMN_LOCALITY: - attrib = AB_attribLocality; - break; - - }/* switch () */ - if (attrib != AB_attribEntryType) { - int error = AB_GetEntryAttribute(m_containerInfo, m_entryID, - attrib, &value); - - if (isPhone && - EMPTY_STRVAL(value)) { - error = AB_GetEntryAttribute(m_containerInfo, m_entryID, - AB_attribHomePhone, &value); - }/* if */ - XP_SAFE_SPRINTF(a_line, sizeof(a_line), - "%s", - EMPTY_STRVAL(value)?"":value->u.string); - - AB_FreeEntryAttributeValue(value); - }/* if */ -#else - switch (column) { - case OUTLINER_COLUMN_NAME: - AB_GetFullName(m_dir, m_AddrBook, m_entryID, a_line); - break; - - case OUTLINER_COLUMN_EMAIL: - AB_GetEmailAddress(m_dir, m_AddrBook, m_entryID, a_line); - break; - - case OUTLINER_COLUMN_NICKNAME: - AB_GetNickname(m_dir, m_AddrBook, m_entryID, a_line); - break; - - case OUTLINER_COLUMN_PHONE: - AB_GetWorkPhone(m_dir, m_AddrBook, m_entryID, a_line); - if (!a_line || !XP_STRLEN(a_line)) { - a_line[0] = '\0'; - AB_GetHomePhone(m_dir, m_AddrBook, m_entryID, a_line); - }/* if */ - break; - - case OUTLINER_COLUMN_COMPANY: - AB_GetCompanyName(m_dir, m_AddrBook, m_entryID, a_line); - break; - - case OUTLINER_COLUMN_LOCALITY: - AB_GetLocality(m_dir, m_AddrBook, m_entryID, a_line); - break; - - }/* switch () */ -#endif /* !USE_ABCOM */ - return a_line; -} - -char* -XFE_AddrSearchView::getColumnName(int column) -{ - switch (column) { - case OUTLINER_COLUMN_NAME: - return XP_GetString(XFE_AB_HEADER_NAME); - - case OUTLINER_COLUMN_EMAIL: - return XP_GetString(XFE_AB_HEADER_EMAIL); - - case OUTLINER_COLUMN_PHONE: - return XP_GetString(XFE_AB_HEADER_PHONE); - case OUTLINER_COLUMN_NICKNAME: - return XP_GetString(XFE_AB_HEADER_NICKNAME); - case OUTLINER_COLUMN_COMPANY: - return XP_GetString(XFE_AB_HEADER_COMPANY); - case OUTLINER_COLUMN_LOCALITY: - return XP_GetString(XFE_AB_HEADER_LOCALITY); - }/* switch () */ - return "unDefined"; -} - -#if defined(USE_ABCOM) -EOutlinerTextStyle XFE_AddrSearchView::getColumnHeaderStyle(int column) -{ - AB_AttribID sortType = AB_attribUnknown; - switch (column) { - case OUTLINER_COLUMN_NAME: - sortType = AB_attribFullName; - break; - - case OUTLINER_COLUMN_EMAIL: - sortType = AB_attribEmailAddress; - break; - - case OUTLINER_COLUMN_NICKNAME: - sortType = AB_attribNickName; - break; - - case OUTLINER_COLUMN_COMPANY: - sortType = AB_attribCompanyName; - break; - - case OUTLINER_COLUMN_LOCALITY: - sortType = AB_attribLocality; - break; - }/* switch */ - - if (sortType == getSortType()) - return OUTLINER_Bold; - else - return OUTLINER_Default; -} - -void XFE_AddrSearchView::clickHeader(const OutlineButtonFuncData *data) -{ - int column = data->column; - int invalid = True; - switch (column) { -#if 0 - case OUTLINER_COLUMN_TYPE: - setSortType(AB_attribEntryType); - break; -#endif - case OUTLINER_COLUMN_NAME: - setSortType(AB_attribFullName); - break; - - case OUTLINER_COLUMN_NICKNAME: - setSortType(AB_attribNickName); - break; - - case OUTLINER_COLUMN_EMAIL: - setSortType(AB_attribEmailAddress); - break; - - case OUTLINER_COLUMN_COMPANY: - setSortType(AB_attribCompanyName); - break; - - case OUTLINER_COLUMN_LOCALITY: - setSortType(AB_attribLocality); - break; - default: - invalid = False; - }/* switch() */ - if (invalid) - m_outliner->invalidate(); -} -#else -EOutlinerTextStyle XFE_AddrSearchView::getColumnHeaderStyle(int column) -{ - ABID sortType = 0; - switch (column) { - case OUTLINER_COLUMN_NAME: - sortType = ABFullName; - break; - - case OUTLINER_COLUMN_EMAIL: - sortType = ABEmailAddress; - break; - - case OUTLINER_COLUMN_NICKNAME: - sortType = ABNickname; - break; - - case OUTLINER_COLUMN_COMPANY: - sortType = ABCompany; - break; - - case OUTLINER_COLUMN_LOCALITY: - sortType = ABLocality; - break; - }/* switch */ - - if (sortType == getSortType()) - return OUTLINER_Bold; - else - return OUTLINER_Default; -} - -void XFE_AddrSearchView::clickHeader(const OutlineButtonFuncData *data) -{ - int column = data->column; - int invalid = True; - switch (column) { -#if 0 - case OUTLINER_COLUMN_TYPE: - setSortType(AB_SortByTypeCmd); - break; -#endif - case OUTLINER_COLUMN_NAME: - setSortType(AB_SortByFullNameCmd); - break; - - case OUTLINER_COLUMN_NICKNAME: - setSortType(AB_SortByNickname); - break; - - case OUTLINER_COLUMN_EMAIL: - setSortType(AB_SortByEmailAddress); - break; - - case OUTLINER_COLUMN_COMPANY: - setSortType(AB_SortByCompanyName); - break; - - case OUTLINER_COLUMN_LOCALITY: - setSortType(AB_SortByLocality); - break; - default: - invalid = False; - }/* switch() */ - if (invalid) - m_outliner->invalidate(); -} -#endif /* USE_ABCOM */ - void XFE_AddrSearchView::doubleClickBody(const OutlineButtonFuncData */* data */) { toCB(NULL, NULL); @@ -592,13 +230,12 @@ XFE_AddrSearchView::makePair(const int ind, SEND_STATUS status) pair->dir = m_dir; pair->id = entry; - uint16 numItems = 4; + uint16 numItems = 2; AB_AttribID *attribs = (AB_AttribID *) XP_CALLOC(numItems, sizeof(AB_AttribID)); attribs[0] = AB_attribEntryType; - attribs[1] = AB_attribEmailAddress; - attribs[2] = AB_attribExpandedName; - attribs[3] = AB_attribFullName; + attribs[1] = AB_attribFullAddress; + AB_AttributeValue *values = NULL; error = @@ -609,32 +246,23 @@ XFE_AddrSearchView::makePair(const int ind, SEND_STATUS status) &numItems); XP_ASSERT(values); - // AB_attribEntryType - int i = 0; - if (values[i].attrib == attribs[i]) - pair->type = values[i].u.entryType; - i++; + int i; + for (i=0; i < numItems; i++) { + switch (values[i].attrib) { + case AB_attribEntryType: + pair->type = values[i].u.entryType; + break; - // AB_attribEmailAddress - if (values[i].attrib == attribs[i]) - pair->emailAddr = values[i].u.string?XP_STRDUP(values[i].u.string) - :NULL; - i++; - - // AB_attribExpandedName - pair->dplyStr = NULL; - if (values[i].attrib == attribs[i]) - pair->dplyStr = values[i].u.string?XP_STRDUP(values[i].u.string) - :NULL; - i++; - - if (!pair->dplyStr) { - // fullname - if (values[i].attrib == attribs[i]) - pair->dplyStr = values[i].u.string?XP_STRDUP(values[i].u.string) - :NULL; - i++; - }/* if */ + case AB_attribFullAddress: + pair->dplyStr = + !EMPTY_STRVAL(&(values[i]))?XP_STRDUP(values[i].u.string) + :(char *)NULL; + break; + default: + XP_ASSERT(0); + break; + }/* switch */ + }/* for i */ return pair; } diff --git a/mozilla/cmd/xfe/src/ABAddrSearchView.h b/mozilla/cmd/xfe/src/ABAddrSearchView.h index a384c9babd9..fb298f6dce5 100644 --- a/mozilla/cmd/xfe/src/ABAddrSearchView.h +++ b/mozilla/cmd/xfe/src/ABAddrSearchView.h @@ -38,8 +38,7 @@ public: XFE_View *parent_view, MWContext *context, XP_List *directories); - ~XFE_AddrSearchView(); - + virtual ~XFE_AddrSearchView(); void setAddressee(XFE_AddresseeView *view) { m_addresseeView = view;} void setAdd2ABBtn(Widget w) {m_addToAddressBtn = w;} void setPropertyBtn(Widget w) {m_propertyBtn = w;} @@ -47,37 +46,7 @@ public: void setCcBtn(Widget w) {m_ccBtn = w;} void setBccBtn(Widget w) {m_bccBtn = w;} - // columns for the Outliner - enum { - OUTLINER_COLUMN_TYPE = 0, - OUTLINER_COLUMN_NAME, - OUTLINER_COLUMN_EMAIL, - OUTLINER_COLUMN_COMPANY, - OUTLINER_COLUMN_PHONE, - OUTLINER_COLUMN_NICKNAME, - OUTLINER_COLUMN_LOCALITY, - OUTLINER_COLUMN_LAST - }; - - // The Outlinable interface. - // - - virtual fe_icon *getColumnIcon(int column); - virtual EOutlinerTextStyle - getColumnHeaderStyle(int column); - virtual char *getColumnHeaderText(int column); - virtual char *getColumnText(int column); - virtual char *getColumnName(int column); - virtual void clickHeader(const OutlineButtonFuncData *data); virtual void doubleClickBody(const OutlineButtonFuncData *data); - - // Get tooltipString & docString; - // returned string shall be freed by the callee - // row < 0 indicates heading row; otherwise it is a content row - // (starting from 0) - // - virtual char *getCellTipString(int /* row */, int /* column */); - virtual char *getCellDocString(int /* row */, int /* column */); // static void toCallback(Widget, XtPointer, XtPointer); static void ccCallback(Widget, XtPointer, XtPointer); diff --git a/mozilla/cmd/xfe/src/ABAddresseeView.h b/mozilla/cmd/xfe/src/ABAddresseeView.h index 7f199c1af08..63295f2abe1 100644 --- a/mozilla/cmd/xfe/src/ABAddresseeView.h +++ b/mozilla/cmd/xfe/src/ABAddresseeView.h @@ -38,8 +38,7 @@ public: Widget parent, XFE_View *parent_view, MWContext *context); - ~XFE_AddresseeView(); - + virtual ~XFE_AddresseeView(); // callbacks static void removeCallback(Widget, XtPointer, XtPointer); static void selectCallback(Widget, XtPointer, XtPointer); diff --git a/mozilla/cmd/xfe/src/ABAddressingDlg.cpp b/mozilla/cmd/xfe/src/ABAddressingDlg.cpp index 5cde78ea927..4ddf8c6c725 100644 --- a/mozilla/cmd/xfe/src/ABAddressingDlg.cpp +++ b/mozilla/cmd/xfe/src/ABAddressingDlg.cpp @@ -54,6 +54,14 @@ XFE_ABAddressingDlg::XFE_ABAddressingDlg(Widget parent, void *callData, Boolean modal, MWContext *context): +#if defined(GLUE_COMPO_CONTEXT) + XFE_ViewDashBDlg(parent, name, context, + True, /* ok */ + True, /* cancel */ + True, /* help */ + False, /* apply; remove */ + modal), +#else XFE_ViewDialog((XFE_View *) 0, parent, name, context, True, /* ok */ @@ -62,6 +70,7 @@ XFE_ABAddressingDlg::XFE_ABAddressingDlg(Widget parent, False, /* apply; remove */ False, /* separator */ modal), +#endif /* GLUE_COMPO_CONTEXT */ m_cbProc(proc), m_callData(callData) { @@ -77,12 +86,23 @@ XFE_ABAddressingDlg::XFE_ABAddressingDlg(Widget parent, XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg (av [ac], XmNresizePolicy, XmRESIZE_NONE); ac++; Widget form = XmCreateForm (m_chrome, "addrMsgForm", av, ac); +#if defined(GLUE_COMPO_CONTEXT) + m_aboveButtonArea = form; +#endif /* GLUE_COMPO_CONTEXT */ + XtManageChild (form); XtVaSetValues(m_chrome, /* the dialog */ // XmNallowShellResize, FALSE, // XmNnoResize, False, XmNdefaultButton, NULL, NULL); +#if defined(DEBUG_tao) + //hack!! + fe_HackTranslations(context, m_chrome); + if (context) + printf("\n---XFE_ABAddressingDlg:context->type=%d, w=0x%x\n", + context->type, m_chrome); +#endif /* DEBUG_tao */ /* 2 sub forms */ @@ -156,7 +176,15 @@ XFE_ABAddressingDlg::XFE_ABAddressingDlg(Widget parent, m_searchContext = XP_NewContext(); if (!m_searchContext) return; - +#if defined(GLUE_COMPO_CONTEXT) + fe_ContextData *fec = XP_NEW_ZAP (fe_ContextData); + XP_ASSERT(fec); + CONTEXT_DATA(m_searchContext) = fec; + m_searchContext->funcs = fe_BuildDisplayFunctionTable(); + fe_InitRemoteServer (XtDisplay (m_widget)); +#else + /* use view + */ XFE_Frame *f = ViewGlue_getFrame(context); fe_ContextData *fec = XP_NEW_ZAP (fe_ContextData); XP_ASSERT(fec); @@ -165,6 +193,7 @@ XFE_ABAddressingDlg::XFE_ABAddressingDlg(Widget parent, m_searchContext->funcs = fe_BuildDisplayFunctionTable(); CONTEXT_WIDGET(m_searchContext) = CONTEXT_WIDGET(m_context); fe_InitRemoteServer (XtDisplay (m_widget)); +#endif /* GLUE_COMPO_CONTEXT */ /* 2 pane */ @@ -180,6 +209,16 @@ XFE_ABAddressingDlg::XFE_ABAddressingDlg(Widget parent, m_addrSearchView = (XFE_AddrSearchView *) TwoPaneView->getEntriesListView(); +#if defined(GLUE_COMPO_CONTEXT) + /* use view + */ + ViewGlue_addMappingForCompo(m_addrSearchView, (void *)m_searchContext); + if (m_dashboard && m_addrSearchView) + m_dashboard->connect2Dashboard(m_addrSearchView); + + CONTEXT_WIDGET(m_searchContext) = m_addrSearchView->getBaseWidget(); +#endif + /* cmd group */ ac = 0; @@ -260,7 +299,7 @@ XFE_ABAddressingDlg::XFE_ABAddressingDlg(Widget parent, /* Properties */ ac = 0; - XtSetArg(av[ac], XtNsensitive, False), ac++; + //XtSetArg(av[ac], XtNsensitive, False), ac++; Widget propertiesBtn = XmCreatePushButton(dummy2, "propertiesBtn", av, @@ -314,9 +353,14 @@ XFE_ABAddressingDlg::XFE_ABAddressingDlg(Widget parent, new XFE_AddresseeView(this, workForms[AB_ADDRESSEE_VIEW], NULL, m_context); +#if defined(GLUE_COMPO_CONTEXT) + XtSetSensitive(m_okBtn, False); + m_addresseeView->setOKBtn(m_okBtn); +#else Widget okBtn = XmSelectionBoxGetChild(m_chrome, XmDIALOG_OK_BUTTON); - XtSetSensitive(okBtn, False); + XtSetSensitive(okBtn, False); m_addresseeView->setOKBtn(okBtn); +#endif /* GLUE_COMPO_CONTEXT */ m_addrSearchView->setAddressee(m_addresseeView); if (callData) { @@ -326,16 +370,26 @@ XFE_ABAddressingDlg::XFE_ABAddressingDlg(Widget parent, ((XFE_AddressFolderView *)callData)->exportAddressees(); addAddressees(clientData); }/* if */ +#if defined(GLUE_COMPO_CONTEXT) + // + attachView(); +#endif /* GLUE_COMPO_CONTEXT */ } XFE_ABAddressingDlg::~XFE_ABAddressingDlg() { +#if defined(GLUE_COMPO_CONTEXT) + if (m_addrSearchView && m_dashboard) + m_dashboard->disconnectFromDashboard(m_addrSearchView); +#endif } void XFE_ABAddressingDlg::cancel() { +#if !defined(GLUE_COMPO_CONTEXT) XFE_ABListSearchView *searchView = (XFE_ABListSearchView *) m_view; searchView->unRegisterInterested(); +#endif hide(); } diff --git a/mozilla/cmd/xfe/src/ABAddressingDlg.h b/mozilla/cmd/xfe/src/ABAddressingDlg.h index 8fa97494ab5..028ba63b8ee 100644 --- a/mozilla/cmd/xfe/src/ABAddressingDlg.h +++ b/mozilla/cmd/xfe/src/ABAddressingDlg.h @@ -23,7 +23,11 @@ #ifndef _ABADDRESSINGDLG_H_ #define _ABADDRESSINGDLG_H_ +#if defined(GLUE_COMPO_CONTEXT) +#include "ViewDashBDlg.h" +#else #include "ViewDialog.h" +#endif /* GLUE_COMPO_CONTEXT */ #include "addrbook.h" @@ -35,19 +39,23 @@ class XFE_AddrSearchView; class XFE_AddresseeView; // +#if defined(GLUE_COMPO_CONTEXT) +class XFE_ABAddressingDlg: public XFE_ViewDashBDlg +#else class XFE_ABAddressingDlg: public XFE_ViewDialog +#endif /* GLUE_COMPO_CONTEXT */ { public: XFE_ABAddressingDlg(Widget parent, - char *name, - ABAddrMsgCBProc proc, - void *callData, - Boolean modal, - MWContext *context); + char *name, + ABAddrMsgCBProc proc, + void *callData, + Boolean modal, + MWContext *context); - ~XFE_ABAddressingDlg(); + virtual ~XFE_ABAddressingDlg(); enum { AB_SEARCH_VIEW = 0, AB_ADDRESSEE_VIEW, @@ -69,6 +77,7 @@ private: void *m_callData; MWContext *m_searchContext; + }; #endif /* _ABADDRESSINGDLG_H_ */ diff --git a/mozilla/cmd/xfe/src/ABDirGenTabView.cpp b/mozilla/cmd/xfe/src/ABDirGenTabView.cpp index 8a7e51279a2..66f9e4051f1 100644 --- a/mozilla/cmd/xfe/src/ABDirGenTabView.cpp +++ b/mozilla/cmd/xfe/src/ABDirGenTabView.cpp @@ -239,31 +239,66 @@ XFE_ABDirGenTabView::setDlgValues() */ fe_SetTextField(m_textFs[ABDIR_DESCRIPTION], dir->description?dir->description:""); - fe_SetTextField(m_textFs[ABDIR_LDAPSERVER], - dir->serverName?dir->serverName:""); - fe_SetTextField(m_textFs[ABDIR_SEARCHROOT], - dir->searchBase?dir->searchBase:""); - char tmp[16]; - XP_SAFE_SPRINTF(tmp, sizeof(tmp), - "%d", - dir->port); - fe_SetTextField(m_textFs[ABDIR_PORTNUMBER], - tmp); + if (dir->dirType == PABDirectory) { +#if 1 + int i = 0; + for (i=ABDIR_LDAPSERVER; i < ABDIR_LAST; i++) { + fe_SetTextField(m_textFs[i], ""); + XtSetSensitive(m_textFs[i], False); + XtSetSensitive(m_labels[i], False); + }/* for i */ + for (i = ABDIR_SECUR; i < ABDIR_SECLAST; i++) { + XmToggleButtonSetState(m_toggles[i], False, FALSE); + XtSetSensitive(m_toggles[i], False); + }/* for i */ +#else + fe_SetTextField(m_textFs[ABDIR_LDAPSERVER], + ""); + fe_SetTextField(m_textFs[ABDIR_SEARCHROOT], + ""); + fe_SetTextField(m_textFs[ABDIR_PORTNUMBER], + ""); + fe_SetTextField(m_textFs[ABDIR_MAXHITS], + ""); + XtSetSensitive(m_textFs[ABDIR_LDAPSERVER], False); + XtSetSensitive(m_textFs[ABDIR_SEARCHROOT], False); + XtSetSensitive(m_textFs[ABDIR_PORTNUMBER], False); + XtSetSensitive(m_textFs[ABDIR_MAXHITS], False); + XmToggleButtonSetState(m_toggles[ABDIR_SECUR], False, FALSE); + XtSetSensitive(m_toggles[ABDIR_SECUR], False); + XmToggleButtonSetState(m_toggles[ABDIR_SAVEPASSWD], False, FALSE); + XtSetSensitive(m_toggles[ABDIR_SAVEPASSWD], False); + + XmToggleButtonSetState(m_toggles[ABDIR_USEPASSWD], False, TRUE); + XtSetSensitive(m_toggles[ABDIR_USEPASSWD], False); +#endif + } + else { + fe_SetTextField(m_textFs[ABDIR_LDAPSERVER], + dir->serverName?dir->serverName:""); + fe_SetTextField(m_textFs[ABDIR_SEARCHROOT], + dir->searchBase?dir->searchBase:""); + char tmp[16]; + XP_SAFE_SPRINTF(tmp, sizeof(tmp), + "%d", + dir->port); + fe_SetTextField(m_textFs[ABDIR_PORTNUMBER], + tmp); - XP_SAFE_SPRINTF(tmp, sizeof(tmp), - "%d", - dir->maxHits); - fe_SetTextField(m_textFs[ABDIR_MAXHITS], - tmp); - - XmToggleButtonSetState(m_toggles[ABDIR_SECUR], dir->isSecure, - FALSE); - XmToggleButtonSetState(m_toggles[ABDIR_SAVEPASSWD], dir->savePassword, - FALSE); - XmToggleButtonSetState(m_toggles[ABDIR_USEPASSWD], dir->enableAuth, - TRUE); - XtSetSensitive(m_toggles[ABDIR_SAVEPASSWD], dir->enableAuth); - + XP_SAFE_SPRINTF(tmp, sizeof(tmp), + "%d", + dir->maxHits); + fe_SetTextField(m_textFs[ABDIR_MAXHITS], + tmp); + + XmToggleButtonSetState(m_toggles[ABDIR_SECUR], dir->isSecure, + FALSE); + XmToggleButtonSetState(m_toggles[ABDIR_SAVEPASSWD], dir->savePassword, + FALSE); + XmToggleButtonSetState(m_toggles[ABDIR_USEPASSWD], dir->enableAuth, + TRUE); + XtSetSensitive(m_toggles[ABDIR_SAVEPASSWD], dir->enableAuth); + } }/* if */ else { /* clear diff --git a/mozilla/cmd/xfe/src/ABDirGenTabView.h b/mozilla/cmd/xfe/src/ABDirGenTabView.h index 57ce2d01966..2dbb32ac5b6 100644 --- a/mozilla/cmd/xfe/src/ABDirGenTabView.h +++ b/mozilla/cmd/xfe/src/ABDirGenTabView.h @@ -64,7 +64,11 @@ private: */ Widget m_textFs[ABDIR_LAST+1]; Widget m_labels[ABDIR_LAST+1]; +#if defined(MOZ_MAIL_NEWS) + Widget m_toggles[ABDIR_SECLAST]; +#else Widget m_toggles[3]; +#endif /* MOZ_MAIL_NEWS */ }; /* XFE_ABDirGenTabView */ #endif /* _ABDIRGENTABVIEW_H_ */ diff --git a/mozilla/cmd/xfe/src/ABDirListView.cpp b/mozilla/cmd/xfe/src/ABDirListView.cpp index c3970bedca7..2b260cef6d6 100644 --- a/mozilla/cmd/xfe/src/ABDirListView.cpp +++ b/mozilla/cmd/xfe/src/ABDirListView.cpp @@ -68,7 +68,8 @@ XFE_ABDirListView::XFE_ABDirListView(XFE_Component *toplevel_component, m_directories(directories) #else m_containerLine(NULL), - m_activeContainer(NULL) + m_activeContainer(NULL), + m_dataIndex(MSG_VIEWINDEXNONE) #endif /* USE_ABCOM */ { /* initialize @@ -135,6 +136,8 @@ XFE_ABDirListView::XFE_ABDirListView(XFE_Component *toplevel_component, }/* if */ #endif /* USE_ABCOM */ + setPane(m_pane); + m_outliner->change(0, m_nDirs, m_nDirs); m_outliner->show(); if (m_nDirs) @@ -272,6 +275,9 @@ XFE_ABDirListView::isCommandEnabled(CommandType command, void * /* calldata */, XFE_CommandInfo* /* i */) { +#if defined(DEBUG_tao_) + printf("\nXFE_ABDirListView::isCommandEnabled:%s\n", Command::getString(command)); +#endif AB_CommandType abCmd = (AB_CommandType)~0; if (command == xfeCmdABNewPAB) abCmd = AB_NewAddressBook; @@ -279,7 +285,8 @@ XFE_ABDirListView::isCommandEnabled(CommandType command, abCmd = AB_NewLDAPDirectory; else if (command == xfeCmdABDelete) abCmd = AB_DeleteCmd; - else if (command == xfeCmdABProperties) + else if ((command == xfeCmdABProperties) || + (command == xfeCmdABEditEntry)) abCmd = AB_PropertiesCmd; else return FALSE; @@ -300,6 +307,11 @@ XFE_ABDirListView::isCommandEnabled(CommandType command, NULL, NULL); #endif /* USE_ABCOM */ + +#if defined(DEBUG_tao_) + printf("\nXFE_ABDirListView::isCommandEnabled,cmd=%s, selectable_p=%d\n", + Command::getString(command), selectable_p); +#endif return selectable_p; } @@ -316,10 +328,12 @@ XFE_ABDirListView::handlesCommand(CommandType command, void * /* calldata */, XFE_CommandInfo* /* i */) { - if (command == xfeCmdABNewPAB || - command == xfeCmdABNewLDAPDirectory || - command == xfeCmdABDelete || - command == xfeCmdABProperties) +#if defined(DEBUG_tao_) + printf("\nXFE_ABDirListView::handlesCommand:%s\n", Command::getString(command)); +#endif + if (IS_CONTAINER_PANE_CMD(command) || + IS_2_PANE_CMD(command)) + return True; else return FALSE; @@ -337,7 +351,8 @@ XFE_ABDirListView::doCommand(CommandType command, abCmd = AB_NewLDAPDirectory; else if (command == xfeCmdABDelete) abCmd = AB_DeleteCmd; - else if (command == xfeCmdABProperties) + else if (command == xfeCmdABProperties || + command == xfeCmdABEditEntry) abCmd = AB_PropertiesCmd; else return; @@ -510,7 +525,7 @@ XFE_ABDirListView::getTreeInfo(XP_Bool *expandable, /* is_line_expanded ? */ if (is_line_expandable) { - int32 delta = MSG_ExpansionDelta(m_pane, value->u.number); + int32 delta = MSG_ExpansionDelta(m_pane, m_dataIndex); if (delta < 0) is_line_expanded = True; }/* if */ @@ -631,6 +646,13 @@ XFE_ABDirListView::propertiesCB() int count = 0; const int *indices = 0; m_outliner->getSelection(&indices, &count); +#if defined(USE_ABCOM) + int error = + AB_CommandAB2(m_pane, + AB_PropertiesCmd, + (MSG_ViewIndex *) indices, + (int32) count); +#else if (count > 0 && indices) { DIR_Server *dir = (DIR_Server *) XP_ListGetObjectNum(m_directories, @@ -641,6 +663,7 @@ XFE_ABDirListView::propertiesCB() &(XFE_ABDirListView::propertyCallback), this); }/* if */ +#endif /* USE_ABCOM */ } void XFE_ABDirListView::propertyCallback(DIR_Server *dir, void *callData) @@ -779,8 +802,39 @@ void XFE_ABDirListView::Buttonfunc(const OutlineButtonFuncData *data) } -void XFE_ABDirListView::Flippyfunc(const OutlineFlippyFuncData */* data */) +void XFE_ABDirListView::Flippyfunc(const OutlineFlippyFuncData *data) { +#if defined(DEBUG_tao) + printf("\n XFE_ABDirListView::Flippyfunc \n"); +#endif /* DEBUG_tao */ + int row = data->row; +#if defined(USE_ABCOM) + XP_Bool selection_needs_bubbling = False; + + int delta = MSG_ExpansionDelta(m_pane, row); + + if (delta == 0) + return; + + /* we're not selected and we're being collapsed. + check if any of our children are selected, and if + so we select this row. */ + if (!m_outliner->isSelected(row) && delta < 0) { + int num_children = -1 * delta; + int i; + + for (i = row + 1; i <= row + num_children; i ++) + if (m_outliner->isSelected(i)) { + selection_needs_bubbling = True; + } + } + MSG_ToggleExpansion(m_pane, row, NULL); + + if (selection_needs_bubbling) + m_outliner->selectItem(row); + + getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); +#endif /*USE_ABCOM */ } // @@ -797,7 +851,7 @@ void *XFE_ABDirListView::acquireLineData(int line) !m_outliner || line >= m_outliner->getTotalLines()) return 0; - + m_dataIndex = line; AB_ContainerAttribValue *value = NULL; int error = AB_GetContainerAttributeForPane(m_pane, line, @@ -822,7 +876,7 @@ void *XFE_ABDirListView::acquireLineData(int line) #endif AB_FreeContainerAttribValue(value); if (depth) - m_ancestorInfo = new OutlinerAncestorInfo[depth]; + m_ancestorInfo = new OutlinerAncestorInfo[depth+1]; else m_ancestorInfo = new OutlinerAncestorInfo[1]; @@ -1220,7 +1274,11 @@ XFE_ABDirListView::dirListDropCallback(Widget, void *cd, fe_dnd_Event type, fe_dnd_Source *source, +#if defined(USE_ABCOM) + XEvent *event) +#else XEvent */* event */) +#endif /* USE_ABCOM */ { XFE_ABDirListView *ad = (XFE_ABDirListView *)cd; @@ -1277,7 +1335,7 @@ XFE_ABDirListView::dirListDropCB(fe_dnd_Source *source, XEvent *event) XFE_Outliner *outliner = listView->getOutliner(); const int *indices = NULL; int32 numIndices = 0; - outliner->getSelection(&indices, &numIndices); + outliner->getSelection(&indices, (int *) &numIndices); MSG_Pane *srcPane = listView->getPane(); AB_DragEffect effect = AB_DragEntriesIntoContainerStatus(srcPane, diff --git a/mozilla/cmd/xfe/src/ABDirListView.h b/mozilla/cmd/xfe/src/ABDirListView.h index ab169e5c3aa..ff713fe431a 100644 --- a/mozilla/cmd/xfe/src/ABDirListView.h +++ b/mozilla/cmd/xfe/src/ABDirListView.h @@ -36,9 +36,9 @@ public: XP_List *directories); virtual ~XFE_ABDirListView(); - void paneChanged(XP_Bool asynchronous, - MSG_PANE_CHANGED_NOTIFY_CODE notify_code, - int32 value); + virtual void paneChanged(XP_Bool asynchronous, + MSG_PANE_CHANGED_NOTIFY_CODE notify_code, + int32 value); /* used by toplevel to see which view can handle a command. Returns true @@ -196,7 +196,12 @@ private: AB_ContainerInfo *m_containerLine; AB_ContainerInfo *m_activeContainer; int32 m_numLines; + +#if defined(MOZ_MAIL_NEWS) + MSG_ViewIndex m_dataIndex; +#endif /* MOZ_MAIL_NEWS */ #endif /* USE_ABCOM */ }; + #endif /* _XFE_ABDIRLISTVIEW_H */ diff --git a/mozilla/cmd/xfe/src/ABListSearchView.cpp b/mozilla/cmd/xfe/src/ABListSearchView.cpp index f63567a8d3a..abf5ae20bc8 100644 --- a/mozilla/cmd/xfe/src/ABListSearchView.cpp +++ b/mozilla/cmd/xfe/src/ABListSearchView.cpp @@ -20,6 +20,7 @@ Created: Tao Cheng , 17-dec-96 */ +#include "rosetta.h" #include "Frame.h" #include "ViewGlue.h" #include "ABListSearchView.h" @@ -33,10 +34,8 @@ #endif /* USE_MOTIF_DND */ -#ifdef MOZ_MAIL_NEWS #include "ABSearchDlg.h" #include "MNView.h" -#endif #include "Xfe/Xfe.h" #include @@ -71,7 +70,16 @@ const char *XFE_ABListSearchView::dirSelect = // icons fe_icon XFE_ABListSearchView::m_personIcon = { 0 }; fe_icon XFE_ABListSearchView::m_listIcon = { 0 }; -fe_icon XFE_ABListSearchView::m_securityIcon = { 0 }; +HG28190 + +extern int XFE_AB_HEADER_NAME; +extern int XFE_AB_HEADER_CERTIFICATE; +extern int XFE_AB_HEADER_EMAIL; +extern int XFE_AB_HEADER_NICKNAME; +extern int XFE_AB_HEADER_EMAIL; +extern int XFE_AB_HEADER_COMPANY; +extern int XFE_AB_HEADER_PHONE; +extern int XFE_AB_HEADER_LOCALITY; extern int XFE_AB_SEARCH_DLG; extern int XFE_AB_SEARCH; @@ -94,11 +102,16 @@ MenuSpec XFE_ABListSearchView::view_popup_spec[] = { { xfeCmdComposeMessage, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdABDeleteEntry,PUSHBUTTON }, +#if defined(USE_ABCOM) + { xfeCmdABDeleteAllEntries,PUSHBUTTON }, +#endif /* USE_ABCOM */ MENU_SEPARATOR, { xfeCmdViewProperties, PUSHBUTTON }, { NULL } }; +static char a_line[AB_MAX_STRLEN]; + XFE_ABListSearchView::XFE_ABListSearchView(XFE_Component *toplevel_component, Widget /* parent */, XFE_View *parent_view, @@ -116,11 +129,19 @@ XFE_ABListSearchView::XFE_ABListSearchView(XFE_Component *toplevel_component, #if defined(USE_ABCOM) m_containerInfo = 0; m_abContainerPane = 0; + // TODO: what is the default?? m_sortType = AB_attribFullName; + m_pageSize = 0; + + m_numAttribs = 0; + // m_attribIDs = 0; #else m_sortType = AB_SortByFullNameCmd; #endif /* USE_ABCOM */ + m_dataIndex = MSG_VIEWINDEXNONE; + m_typeDownIndex = MSG_VIEWINDEXNONE; + m_expandBtn = 0; m_ldapDisabled = False; @@ -166,6 +187,8 @@ XFE_ABListSearchView::XFE_ABListSearchView(XFE_Component *toplevel_component, error = AB_SetShowPropertySheetForEntryFunc((MSG_Pane *) m_abPane, &XFE_ABListSearchView::ShowPropertySheetForEntryFunc); + + m_pane = (MSG_Pane *) m_abPane; #else m_AddrBook = fe_GetABook(0); m_directories = directories; @@ -190,7 +213,11 @@ XFE_ABListSearchView::XFE_ABListSearchView(XFE_Component *toplevel_component, */ setPane((MSG_Pane *)m_abPane); - /* Tao_17dec96 +#if !defined(GLUE_COMPO_CONTEXT) + registerInterest(XFE_View::allConnectionsCompleteCallback, + this, + (XFE_FunctionNotification)allConnectionsComplete_cb); + /* Tao_17dec96 * register interest in getting allconnectionsComplete */ MWContext *top = XP_GetNonGridContext (context); @@ -199,17 +226,28 @@ XFE_ABListSearchView::XFE_ABListSearchView(XFE_Component *toplevel_component, f->registerInterest(XFE_Frame::allConnectionsCompleteCallback, this, (XFE_FunctionNotification)allConnectionsComplete_cb); - +#endif /* GLUE_COMPO_CONTEXT */ } XFE_ABListSearchView::~XFE_ABListSearchView() { - if (m_abPane) + if (m_abPane) { #if defined(USE_ABCOM) + MSG_SetFEData(m_pane, 0); AB_ClosePane(m_pane); #else AB_CloseAddressBookPane(&m_abPane); #endif /* USE_ABCOM */ + }/* if */ + + /* unregister + */ + if (m_outliner) + XtRemoveCallback(m_outliner->getBaseWidget(), XmNresizeCallback, + XFE_ABListSearchView::resizeCallback, + (XtPointer) this); + +#if !defined(GLUE_COMPO_CONTEXT) /* Tao_17dec96 * register interest ingetting allconnectionsComplete */ @@ -219,6 +257,7 @@ XFE_ABListSearchView::~XFE_ABListSearchView() f->unregisterInterest(XFE_Frame::allConnectionsCompleteCallback, this, (XFE_FunctionNotification)allConnectionsComplete_cb); +#endif /* GLUE_COMPO_CONTEXT */ // if (m_popup) @@ -295,8 +334,7 @@ void XFE_ABListSearchView::idToPerson(DIR_Server *pDir, DIR_Server *dir = pDir; ABook *aBook = m_AddrBook; - char a_line[AB_MAX_STRLEN]; - + char a_line[AB_MAX_STRLEN]; pPerson->WinCSID = m_contextData->fe.data->xfe_doc_csid; a_line[0] = '\0'; @@ -373,7 +411,7 @@ void XFE_ABListSearchView::idToPerson(DIR_Server *pDir, if (AB_GetDistName(dir, aBook, entry, a_line) != MSG_VIEWINDEXNONE) pPerson->pDistName = XP_STRDUP(a_line); #endif - AB_GetSecurity(dir, aBook, entry, &pPerson->Security); + HG87291 a_line[0] = '\0'; if (AB_GetCoolAddress(dir, aBook, entry, a_line) != MSG_VIEWINDEXNONE) @@ -401,6 +439,11 @@ XFE_ABListSearchView::isCommandEnabled(CommandType cmd, else if (cmd == xfeCmdABNewList) abCmd = AB_AddMailingListCmd; + else if (cmd == xfeCmdABNewPAB) + abCmd = AB_NewAddressBook; + else if (cmd == xfeCmdABNewLDAPDirectory) + abCmd = AB_NewLDAPDirectory; + else if (cmd == xfeCmdImport) abCmd = AB_ImportCmd; else if (cmd == xfeCmdSaveAs) @@ -414,6 +457,8 @@ XFE_ABListSearchView::isCommandEnabled(CommandType cmd, abCmd = AB_RedoCmd; else if (cmd == xfeCmdABDeleteEntry) abCmd = AB_DeleteCmd; + else if (cmd == xfeCmdABDeleteAllEntries) + abCmd = AB_DeleteAllCmd; else if (cmd == xfeCmdABSearchEntry) abCmd = AB_LDAPSearchCmd; else if (cmd == xfeCmdViewProperties @@ -446,6 +491,9 @@ XFE_ABListSearchView::isCommandEnabled(CommandType cmd, MSG_COMMAND_CHECK_STATE sState = MSG_NotUsed; XP_Bool enable = FALSE, plural = FALSE; +#if defined(DEBUG_tao_) + printf("\nXFE_ABListSearchView::isCommandEnabled:%s\n", Command::getString(cmd)); +#endif if (abCmd != ((AB_CommandType)~0)) #if defined(USE_ABCOM) AB_CommandStatusAB2(m_pane, abCmd, @@ -456,7 +504,7 @@ XFE_ABListSearchView::isCommandEnabled(CommandType cmd, &enable, &sState, NULL, &plural); #endif /* USE_ABCOM */ return enable; -}/* XFE_AddrBookView::isCommandEnabled() */ +}/* XFE_ABListSearchView::isCommandEnabled() */ /* used by toplevel to see which view can handle a command. Returns true * if we can handle it. @@ -466,28 +514,13 @@ XFE_ABListSearchView::handlesCommand(CommandType cmd, void * /* calldata */, XFE_CommandInfo* /* i */) { +#if defined(DEBUG_tao_) + printf("\nXFE_ABListSearchView::handlesCommand:%s\n", Command::getString(cmd)); +#endif // handle view specific command - if (cmd == xfeCmdShowPopup - || cmd == xfeCmdImport - || cmd == xfeCmdSaveAs - || cmd == xfeCmdUndo - || cmd == xfeCmdRedo - || cmd == xfeCmdABDeleteEntry - || cmd == xfeCmdFindInObject - || cmd == xfeCmdFindAgain - || cmd == xfeCmdSearchAddress - || cmd == xfeCmdEditPreferences - || cmd == xfeCmdABByType - || cmd == xfeCmdABByName - || cmd == xfeCmdABByEmailAddress - || cmd == xfeCmdABByCompany - || cmd == xfeCmdABByLocality - || cmd == xfeCmdABByNickName - || cmd == xfeCmdSortAscending - || cmd == xfeCmdSortDescending - || cmd == xfeCmdAddToAddressBook - || cmd == xfeCmdABNewList - || cmd == xfeCmdViewProperties + if (IS_AB_PANE_CMD(cmd) + || IS_2_PANE_CMD(cmd) + || cmd == xfeCmdDisplayHTMLDomainsDialog || cmd == xfeCmdABEditEntry || cmd == xfeCmdABDeleteEntry @@ -520,9 +553,10 @@ XFE_ABListSearchView::doCommand(CommandType cmd, if (m_popup) delete m_popup; - m_popup = new XFE_PopupMenu("popup",(XFE_Frame *) getToplevel(), - XfeAncestorFindApplicationShell(getToplevel()-> - getBaseWidget())); + m_popup = + new XFE_PopupMenu("popup",(XFE_Frame *) getToplevel(), + XfeAncestorFindApplicationShell(getToplevel()-> + getBaseWidget())); m_popup->addMenuSpec(view_popup_spec); m_popup->position (event); m_popup->show(); @@ -530,7 +564,73 @@ XFE_ABListSearchView::doCommand(CommandType cmd, }/* if */ else if (cmd == xfeCmdSelectAll) m_outliner->selectAllItems(); +#if defined(USE_ABCOM) + else { + AB_CommandType abCmd = (AB_CommandType)~0; + if (cmd == xfeCmdComposeMessage) + abCmd = AB_NewMessageCmd; + else if (cmd == xfeCmdAddToAddressBook) + abCmd = AB_AddUserCmd; + else if (cmd == xfeCmdABNewList) + abCmd = AB_AddMailingListCmd; + + else if (cmd == xfeCmdABNewPAB) + abCmd = AB_NewAddressBook; + else if (cmd == xfeCmdABNewLDAPDirectory) + abCmd = AB_NewLDAPDirectory; + + else if (cmd == xfeCmdImport) + abCmd = AB_ImportCmd; + else if (cmd == xfeCmdSaveAs) + abCmd = AB_SaveCmd; + else if (cmd == xfeCmdClose) + abCmd = AB_CloseCmd; + + else if (cmd == xfeCmdUndo) + abCmd = AB_UndoCmd; + else if (cmd == xfeCmdRedo) + abCmd = AB_RedoCmd; + else if (cmd == xfeCmdABDeleteEntry) + abCmd = AB_DeleteCmd; + else if (cmd == xfeCmdABDeleteAllEntries) + abCmd = AB_DeleteAllCmd; + else if (cmd == xfeCmdABSearchEntry) + abCmd = AB_LDAPSearchCmd; + else if (cmd == xfeCmdViewProperties + || cmd == xfeCmdABEditEntry) + abCmd = AB_PropertiesCmd; + else if (cmd == xfeCmdABByType) + abCmd = AB_SortByTypeCmd; + else if (cmd == xfeCmdABByName) + abCmd = AB_SortByFullNameCmd; + else if (cmd == xfeCmdABByEmailAddress) + abCmd = AB_SortByEmailAddress; + else if (cmd == xfeCmdABByCompany) + abCmd = AB_SortByCompanyName; + else if (cmd == xfeCmdABByLocality) + abCmd = AB_SortByLocality; + else if (cmd == xfeCmdABByNickName) + abCmd = AB_SortByNickname; + else if (cmd == xfeCmdSortAscending) + abCmd = AB_SortAscending; + else if (cmd == xfeCmdSortDescending) + abCmd = AB_SortDescending; + + else if (cmd == xfeCmdABCall) + abCmd = AB_CallCmd; + + int32 count = 0; + const int *indices = 0; + + m_outliner->getSelection(&indices, (int *) &count); + int error = AB_CommandAB2(m_pane, + abCmd, + (MSG_ViewIndex *) indices, + count); + + }/* else */ +#endif } /* @@ -559,7 +659,7 @@ XFE_ABListSearchView::newList() } void -XFE_ABListSearchView::delUser() +XFE_ABListSearchView::abDelete() { /* check which is selected */ @@ -582,16 +682,17 @@ XFE_ABListSearchView::delUser() AB_CommandAB2(m_pane, AB_DeleteCmd, (MSG_ViewIndex *)indices, count); + count = MSG_GetNumLines(m_pane); #else AB_Command((ABPane *) m_abPane, AB_DeleteCmd, (MSG_ViewIndex *)indices, count); -#endif /* USE_ABCOM */ /* Tao_04dec96: use XFE_MNListView ??? */ AB_GetEntryCount (m_dir, m_AddrBook, &count, (ABID) ABTypeAll, 0); +#endif /* USE_ABCOM */ #if 0 m_outliner->change(0, count, count); #endif @@ -605,6 +706,36 @@ XFE_ABListSearchView::delUser() }/* if */ } +void +XFE_ABListSearchView::abDeleteAllEntries() +{ + /* check which is selected + */ + uint32 count = 0; + const int *indices = 0; + + m_outliner->getSelection(&indices, (int *) &count); + if (count > 0 && indices) { + int first = indices[0]; + /* int AB_Command (ABPane* pane, AB_CommandType command, + * MSG_ViewIndex* indices, int32 numindices); + */ +#if defined(USE_ABCOM) + AB_CommandAB2(m_pane, + AB_DeleteAllCmd, + (MSG_ViewIndex *)indices, count); + count = MSG_GetNumLines(m_pane); +#endif /* USE_ABCOM */ + if (count) { + + int pos = (first <= (count-1))?first:(count-1); + m_outliner->selectItemExclusive(pos); + m_outliner->makeVisible(pos); + }/* if */ + getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); + }/* if */ +} + void XFE_ABListSearchView::undo() { @@ -700,7 +831,7 @@ XFE_ABListSearchView::popupUserPropertyWindow(ABID entry, XP_Bool newuser, getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); }/* else */ #endif /* USE_ABCOM */ -}/* XFE_AddrBookView::popupUserPropertyWindow() */ +}/* XFE_ABListSearchView::popupUserPropertyWindow() */ void XFE_ABListSearchView::popupListPropertyWindow(ABID entry, XP_Bool newuser, @@ -827,6 +958,43 @@ int XFE_ABListSearchView::addToAddressBook() return TRUE; } +void +XFE_ABListSearchView::listChangeFinished(XP_Bool /* asynchronous */, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, + int32 num) +{ + switch (notify) { + case MSG_NotifyLDAPTotalContentChanged: + { +#if defined(DEBUG_tao) + printf("\nXFE_ABListSearchView::MSG_NotifyLDAPTotalContentChanged, where=%d, num=%d", where, num); +#endif + m_outliner->change(0, num, num); + m_outliner->scroll2Item((int) where); + } + break; + + case MSG_NotifyInsertOrDelete: + if (m_searchingDir) +#if defined(USE_ABCOM) + { + int error = AB_LDAPSearchResultsAB2(m_pane, + where, num); +#if 1 + //fe_UpdateGraph(m_contextData, True); +#else + notifyInterested(XFE_Component::progressBarCylonTick); +#endif + } +#else + AB_LDAPSearchResults((ABPane*)m_pane, where, num); +#endif /* USE_ABCOM */ + break; + + }/* notify */ +} + void XFE_ABListSearchView::paneChanged(XP_Bool asynchronous, MSG_PANE_CHANGED_NOTIFY_CODE notify_code, @@ -841,6 +1009,63 @@ XFE_ABListSearchView::paneChanged(XP_Bool asynchronous, m_typeDownTimer = 0; }/* if */ + switch (notify_code) { + case MSG_PaneDirectoriesChanged: + dirChanged(value); + break; + + case MSG_PaneChanged: + break; + + case MSG_PaneClose: + break; + + case MSG_PaneNotifyStartSearching: + m_searchingDir = True; +#if 1 + //fe_UpdateGraph(m_contextData, True); +#else + notifyInterested(XFE_Component::progressBarCylonStart); +#endif + break; + + case MSG_PaneNotifyStopSearching: +#if 1 + //fe_StopProgressGraph(m_contextData); +#else + notifyInterested(XFE_Component::progressBarCylonStop); +#endif + m_searchingDir = False; + break; + + case MSG_PaneNotifyTypeDownCompleted: + { +#if defined(DEBUG_tao) + printf("\nMSG_PaneNotifyTypeDownCompleted\n"); +#endif + m_typeDownIndex = (MSG_ViewIndex) value; + + /* Steal from SubAllView.cpp + */ + if (m_typeDownIndex == MSG_VIEWINDEXNONE) { + m_outliner->deselectAllItems(); + }/* if */ + else { + m_outliner->selectItemExclusive(m_typeDownIndex); + m_outliner->makeVisible(m_typeDownIndex); + }/* else */ + getToplevel()-> + notifyInterested(XFE_View::chromeNeedsUpdating); + } + break; + + }/* notify_code */ +} + +void +XFE_ABListSearchView::dirChanged(int32 /* value */) +{ + #if defined(USE_ABCOM) // rewrite with new APIs XP_ASSERT(0); @@ -1283,9 +1508,22 @@ void XFE_ABListSearchView::layout() XFE_CALLBACK_DEFN(XFE_ABListSearchView, allConnectionsComplete)(XFE_NotificationCenter */*obj*/, void */*clientData*/, - void */* callData */) + void *callData) { - stopSearch(); + MWContext *c = (MWContext *) callData; + if (c == m_contextData) + stopSearch(); +} + +void +XFE_ABListSearchView::allConnectionsComplete(MWContext *context) +{ +#if defined(DEBUG_tao) + printf("\n**XFE_ABListSearchView::allConnectionsComplete\n"); +#endif + XFE_View::allConnectionsComplete(context); + if (context == m_contextData) + stopSearch(); } void @@ -1413,6 +1651,9 @@ void XFE_ABListSearchView::stopSearch() m_outliner->getTotalLines(), count); #endif +#if 0 + /* become annoying in tyepdown + */ if (!count) { char tmp[128]; XP_SAFE_SPRINTF(tmp, sizeof(tmp), @@ -1420,6 +1661,8 @@ void XFE_ABListSearchView::stopSearch() XP_GetString(XFE_SEARCH_NO_MATCHES)); fe_Alert_2(getBaseWidget(), tmp); }/* if */ +#endif /* 0 */ + getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); }/* */ @@ -1520,14 +1763,336 @@ XFE_ABListSearchView::ConvToIndex(void */*item*/) return 0; } +/* Methods for the outlinable interface. + */ char * -XFE_ABListSearchView::getColumnName(int /*column*/) +XFE_ABListSearchView::getCellTipString(int row, int column) { - return 0; + char *tmp = 0; + if (row < 0) { + /* header + */ + tmp = getColumnHeaderText(column); + }/* if */ + else { + ABID orgID = m_entryID; + MSG_ViewIndex orgIndex = m_dataIndex; + + /* content + */ + m_dataIndex = row; +#if defined(USE_ABCOM) +#if 0 + int error = AB_GetABIDForIndex(m_pane, + (MSG_ViewIndex) row, + &m_entryID); +#endif + +#else + m_entryID = AB_GetEntryIDAt((AddressPane *) m_abPane, (uint32) row); +#endif /* USE_ABCOM */ + tmp = getColumnText(column); + + /* reset + */ + m_dataIndex = orgIndex; + m_entryID = orgID; + }/* else */ + + if (tmp && + (!m_outliner->isColTextFit(tmp, row, column))) + return tmp; + + return NULL; } -/* This method acquires one line of data: entryID is set for getColumnText +char * +XFE_ABListSearchView::getCellDocString(int /* row */, int /* column */) +{ + return NULL; +} + +char* +XFE_ABListSearchView::getColumnName(int column) +{ + switch (column) { + case OUTLINER_COLUMN_TYPE: + return XP_GetString(XFE_AB_HEADER_NAME); + case OUTLINER_COLUMN_NAME: + return XP_GetString(XFE_AB_HEADER_NAME); + case OUTLINER_COLUMN_EMAIL: + return XP_GetString(XFE_AB_HEADER_EMAIL); + case OUTLINER_COLUMN_PHONE: + return XP_GetString(XFE_AB_HEADER_PHONE); + case OUTLINER_COLUMN_NICKNAME: + return XP_GetString(XFE_AB_HEADER_NICKNAME); + case OUTLINER_COLUMN_COMPANY: + return XP_GetString(XFE_AB_HEADER_COMPANY); + case OUTLINER_COLUMN_LOCALITY: + return XP_GetString(XFE_AB_HEADER_LOCALITY); + default: + XP_ASSERT(0); + return 0; + } +} + +EOutlinerTextStyle +XFE_ABListSearchView::getColumnHeaderStyle(int column) +{ +#if defined(USE_ABCOM) + AB_AttribID sortType = AB_attribUnknown; + if (column >= 0 && + column < m_numAttribs) { + AB_ColumnInfo *cInfo = AB_GetColumnInfo(m_containerInfo, + (AB_ColumnID) column); + if (cInfo) { + sortType = cInfo->sortable?cInfo->attribID:AB_attribUnknown; + AB_FreeColumnInfo(cInfo); + }/* if */ + }/* if */ +#else + ABID sortType = 0; + switch (column) { + case OUTLINER_COLUMN_TYPE: + sortType = ABTypeEntry; + break; + + case OUTLINER_COLUMN_NAME: + sortType = ABFullName; + break; + + case OUTLINER_COLUMN_EMAIL: + sortType = ABEmailAddress; + break; + + case OUTLINER_COLUMN_NICKNAME: + sortType = ABNickname; + break; + + case OUTLINER_COLUMN_COMPANY: + sortType = ABCompany; + break; + + case OUTLINER_COLUMN_LOCALITY: + sortType = ABLocality; + break; + }/* switch */ +#endif /* USE_ABCOM */ + + if (sortType == getSortType()) + return OUTLINER_Bold; + else + return OUTLINER_Default; +} + +/* Returns the text and/or icon to display at the top of the column. */ +char* +XFE_ABListSearchView::getColumnHeaderText(int column) +{ + +#if defined(USE_ABCOM) + a_line[0] = '\0'; + if (column >= 0 && + column < m_numAttribs) { + AB_ColumnInfo *cInfo = AB_GetColumnInfo(m_containerInfo, + (AB_ColumnID) column); + if (cInfo) { + XP_SAFE_SPRINTF(a_line, sizeof(a_line), + "%s", + cInfo->displayString?cInfo->displayString:""); + AB_FreeColumnInfo(cInfo); + }/* if */ + }/* if */ + return a_line; +#else + char *tmp = 0; + switch (column) { + case OUTLINER_COLUMN_TYPE: + tmp = XP_STRDUP(" "); + break; + + case OUTLINER_COLUMN_NAME: + tmp = XP_GetString(XFE_AB_HEADER_NAME); + break; + + case OUTLINER_COLUMN_NICKNAME: + tmp = XP_GetString(XFE_AB_HEADER_NICKNAME); + break; + + case OUTLINER_COLUMN_EMAIL: + tmp = XP_GetString(XFE_AB_HEADER_EMAIL); + break; + + case OUTLINER_COLUMN_PHONE: + tmp = XP_GetString(XFE_AB_HEADER_PHONE); + break; + + case OUTLINER_COLUMN_COMPANY: + tmp = XP_GetString(XFE_AB_HEADER_COMPANY); + break; + + case OUTLINER_COLUMN_LOCALITY: + tmp = XP_GetString(XFE_AB_HEADER_LOCALITY); + break; + + }/* switch () */ + + return tmp; +#endif /* USE_ABCOM */ +} + +char* +XFE_ABListSearchView::getColumnText(int column) +{ + char *loc; + + a_line[0] = '\0'; +#if defined(USE_ABCOM) + AB_AttributeValue *value = 0; + AB_AttribID attrib = AB_attribEntryType; + XP_Bool isPhone = False; +#if 1 + if (column >= 0 && + column < m_numAttribs) { + AB_ColumnInfo *cInfo = AB_GetColumnInfo(m_containerInfo, + (AB_ColumnID) column); + if (cInfo) { + attrib = cInfo->attribID; + AB_FreeColumnInfo(cInfo); + }/* if */ + }/* if */ +#else + switch (column) { + case OUTLINER_COLUMN_TYPE: + break; + + case OUTLINER_COLUMN_NAME: + attrib = AB_attribDisplayName; // shall be AB_attribDisplayName; + break; + + case OUTLINER_COLUMN_NICKNAME: + attrib = AB_attribNickName; + break; + + case OUTLINER_COLUMN_EMAIL: + attrib = AB_attribEmailAddress; + break; + + case OUTLINER_COLUMN_PHONE: + isPhone = True; + attrib = AB_attribWorkPhone; + break; + + case OUTLINER_COLUMN_COMPANY: + attrib = AB_attribCompanyName; + break; + + case OUTLINER_COLUMN_LOCALITY: + attrib = AB_attribLocality; + break; + + }/* switch () */ +#endif + if (attrib != AB_attribEntryType) { +#if 1 + int error = AB_GetEntryAttributeForPane(m_pane, + m_dataIndex, + attrib, + &value); + + if (isPhone && + EMPTY_STRVAL(value)) { + error = AB_GetEntryAttributeForPane(m_pane, + m_dataIndex, + AB_attribHomePhone, + &value); + }/* if */ +#else + int error = AB_GetEntryAttribute(m_containerInfo, m_entryID, + attrib, &value); + + if (isPhone && + EMPTY_STRVAL(value)) { + error = AB_GetEntryAttribute(m_containerInfo, m_entryID, + AB_attribHomePhone, &value); + }/* if */ +#endif + XP_SAFE_SPRINTF(a_line, sizeof(a_line), + "%s", + EMPTY_STRVAL(value)?"":value->u.string); + + AB_FreeEntryAttributeValue(value); + }/* if */ +#else + switch (column) { + case OUTLINER_COLUMN_TYPE: + break; + + case OUTLINER_COLUMN_NAME: + AB_GetFullName(m_dir, m_AddrBook, m_entryID, a_line); + INTL_CONVERT_BUF_TO_LOCALE(a_line, loc); + break; + + case OUTLINER_COLUMN_NICKNAME: + AB_GetNickname(m_dir, m_AddrBook, m_entryID, a_line); + INTL_CONVERT_BUF_TO_LOCALE(a_line, loc); + break; + + case OUTLINER_COLUMN_EMAIL: + AB_GetEmailAddress(m_dir, m_AddrBook, m_entryID, a_line); + break; + + case OUTLINER_COLUMN_PHONE: + AB_GetWorkPhone(m_dir, m_AddrBook, m_entryID, a_line); + if (!a_line || !XP_STRLEN(a_line)) { + a_line[0] = '\0'; + AB_GetHomePhone(m_dir, m_AddrBook, m_entryID, a_line); + }/* if */ + break; + + case OUTLINER_COLUMN_COMPANY: + AB_GetCompanyName(m_dir, m_AddrBook, m_entryID, a_line); + INTL_CONVERT_BUF_TO_LOCALE(a_line, loc); + break; + + case OUTLINER_COLUMN_LOCALITY: + AB_GetLocality(m_dir, m_AddrBook, m_entryID, a_line); + INTL_CONVERT_BUF_TO_LOCALE(a_line, loc); + break; + + }/* switch () */ +#endif /* !USE_ABCOM */ + return a_line; +} + +fe_icon* +XFE_ABListSearchView::getColumnIcon(int column) +{ + fe_icon *myIcon = 0; + switch (column) { + case OUTLINER_COLUMN_TYPE: + { +#if defined(USE_ABCOM) + AB_EntryType type = getType(m_pane, m_dataIndex); + if (type == AB_Person) + myIcon = &m_personIcon; /* shall call make/initialize icons */ + else if (type == AB_MailingList) + myIcon = &m_listIcon; +#else + ABID type; + AB_GetType(m_dir, m_AddrBook, m_entryID, &type); + if (type == ABTypePerson) + myIcon = &m_personIcon; /* shall call make/initialize icons */ + else if (type == ABTypeList) + myIcon = &m_listIcon; +#endif /* USE_ABCOM */ + } + break; + }/* switch () */ + return myIcon; +} + /* This method acquires one line of data: entryID is set for getColumnText */ void* @@ -1537,6 +2102,9 @@ XFE_ABListSearchView::acquireLineData(int line) int error = AB_GetABIDForIndex(m_pane, (MSG_ViewIndex) line, &m_entryID); + + m_dataIndex = (error == AB_SUCCESS)?line:MSG_VIEWINDEXNONE; + #else m_entryID = AB_GetEntryIDAt((AddressPane *) m_abPane, (uint32) line); #endif /* USE_ABCOM */ @@ -1555,12 +2123,6 @@ XFE_ABListSearchView::getColumnHeaderIcon(int /*column*/) } // Returns the text and/or icon to display at the top of the column. -EOutlinerTextStyle -XFE_ABListSearchView::getColumnHeaderStyle(int /*column*/) -{ - return OUTLINER_Default; -} - /* * The following 4 requests deal with the currently acquired line. */ @@ -1582,6 +2144,85 @@ XFE_ABListSearchView::getTreeInfo(XP_Bool */*expandable*/, depth = 0; } +void +XFE_ABListSearchView::clickHeader(const OutlineButtonFuncData *data) +{ + int column = data->column; + int invalid = True; +#if defined(USE_ABCOM) +#if 1 + if (column >= 0 && + column < m_numAttribs) { + AB_ColumnInfo *cInfo = AB_GetColumnInfo(m_containerInfo, + (AB_ColumnID) column); + if (cInfo) { + setSortType(cInfo->attribID); + AB_FreeColumnInfo(cInfo); + }/* if */ + }/* if */ +#else + switch (column) { + case OUTLINER_COLUMN_TYPE: + setSortType(AB_attribEntryType); + break; + + case OUTLINER_COLUMN_NAME: + setSortType(AB_attribFullName); + break; + + case OUTLINER_COLUMN_NICKNAME: + setSortType(AB_attribNickName); + break; + + case OUTLINER_COLUMN_EMAIL: + setSortType(AB_attribEmailAddress); + break; + + case OUTLINER_COLUMN_COMPANY: + setSortType(AB_attribCompanyName); + break; + + case OUTLINER_COLUMN_LOCALITY: + setSortType(AB_attribLocality); + break; + default: + invalid = False; + }/* switch() */ +#endif +#else + switch (column) { + case OUTLINER_COLUMN_TYPE: + setSortType(AB_SortByTypeCmd); + break; + + case OUTLINER_COLUMN_NAME: + setSortType(AB_SortByFullNameCmd); + break; + + case OUTLINER_COLUMN_NICKNAME: + setSortType(AB_SortByNickname); + break; + + case OUTLINER_COLUMN_EMAIL: + setSortType(AB_SortByEmailAddress); + break; + + case OUTLINER_COLUMN_COMPANY: + setSortType(AB_SortByCompanyName); + break; + + case OUTLINER_COLUMN_LOCALITY: + setSortType(AB_SortByLocality); + break; + default: + invalid = False; + }/* switch() */ +#endif /* USE_ABCOM */ + + if (invalid) + m_outliner->invalidate(); +} + // void XFE_ABListSearchView::Buttonfunc(const OutlineButtonFuncData* data) @@ -1765,15 +2406,21 @@ XFE_ABListSearchView::typeDownCB(Widget w, m_typeDownTimer = 0; }/* if */ - const char *str; - str = fe_GetTextField(w); - - m_searchStr = XP_STRDUP(str); + if (w) { + const char *str; + str = fe_GetTextField(w); + + m_searchStr = XP_STRDUP(str); + }/* if w */ if (!m_dir) return; if (m_dir->dirType == LDAPDirectory) { + /* for PAB + */ + m_typeDownIndex = MSG_VIEWINDEXNONE; + /* stop any search */ stopSearch(); @@ -1781,7 +2428,7 @@ XFE_ABListSearchView::typeDownCB(Widget w, /* add a timer */ unsigned long interval = 900; - PREF_GetIntPref("ldap_1.autoCompleteInterval", (int *) &interval); + PREF_GetIntPref("ldap_1.autoCompleteInterval", (int32 *) &interval); #if defined(DEBUG_tao) printf("\nldap_1.autoCompleteInterval=%d\n", interval); #endif @@ -1792,35 +2439,28 @@ XFE_ABListSearchView::typeDownCB(Widget w, else if (m_dir->dirType == PABDirectory) { /* Do type down */ - Widget outlinerW = m_outliner->getBaseWidget(); - MSG_ViewIndex startIndex = 0; +#if defined(USE_ABCOM) + if (m_searchStr && !XP_STRLEN(m_searchStr)) + m_typeDownIndex = MSG_VIEWINDEXNONE; + + int error = AB_TypedownSearch(m_pane, + m_searchStr, + m_typeDownIndex); +#else + MSG_ViewIndex startIndex = 0; int i; startIndex = 0; -#if 1 int count = 0; const int *indices = 0; m_outliner->getSelection(&indices, &count); if (count != 0) startIndex = *indices; -#else - MSG_ViewIndex *indices = 0; - uint count = 0; - count = XmLGridGetSelectedRowCount(outlinerW); - if (count != 0) { - indices = (MSG_ViewIndex *) malloc (sizeof(MSG_ViewIndex) * count); - XmLGridGetSelectedRows(outlinerW, (int *) indices, count); - - /* use the first one selected - */ - startIndex = *indices; - free (indices); - }/* if */ -#endif /* Get the first matching row */ MSG_ViewIndex index = 0; - i = AB_GetIndexMatchingTypedown(m_abPane, &index, str, startIndex); + i = AB_GetIndexMatchingTypedown(m_abPane, + &index, m_searchStr, startIndex); /* Steal from SubAllView.cpp */ if (index == MSG_VIEWINDEXNONE) { @@ -1831,6 +2471,7 @@ XFE_ABListSearchView::typeDownCB(Widget w, m_outliner->makeVisible(index); }/* else */ getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); +#endif /* USE_ABCOM */ }/* if */ }/* XFE_ABListSearchView::typeDownCB() */ @@ -1889,7 +2530,6 @@ void XFE_ABListSearchView::selectContainer(AB_ContainerInfo *containerInfo) m_typeDownTimer = 0; }/* if */ - /* refresh chrome as well */ int error = -1; @@ -1897,12 +2537,45 @@ void XFE_ABListSearchView::selectContainer(AB_ContainerInfo *containerInfo) error = AB_ChangeABContainer(m_pane, containerInfo); }/* if */ - else + else { error = AB_InitializeABPane(m_pane, containerInfo); + // add callback here + XP_ASSERT(m_outliner); + if (m_outliner) { + int32 nRows = 0; + int first = 0, last = 0; + nRows = m_outliner->visibleRows(first, last); + if (nRows < 10) + nRows = 10; + int error = AB_SetFEPageSizeForPane(m_pane, nRows); + XtAddCallback(m_outliner->getBaseWidget(), XmNresizeCallback, + XFE_ABListSearchView::resizeCallback, + (XtPointer) this); + }/* m_outliner */ + }/* else */ m_containerInfo = containerInfo; + // get info on the fly + int num_columns = AB_GetNumColumnsForContainer(m_containerInfo); + AB_AttribID *attribIDs = (AB_AttribID *) XP_CALLOC(num_columns, + sizeof(AB_AttribID)); + m_numAttribs = num_columns; + error = AB_GetColumnAttribIDs(m_containerInfo, + attribIDs, + &m_numAttribs); +#if defined(DEBUG_tao_) + AB_ColumnInfo *cInfo = 0; + for (AB_ColumnID i=AB_ColumnID0; i < num_columns; i++) { + cInfo = AB_GetColumnInfo(m_containerInfo, i); + if (cInfo) { + printf("\nID=%d, attribID=%d, displayString=%s, sortable=%d\n", + i, cInfo->attribID, cInfo->displayString, cInfo->sortable); + AB_FreeColumnInfo(cInfo); + }/* if */ + }/* for i */ +#endif // TODO: take out this once BE support Notification changeEntryCount(); @@ -1932,6 +2605,11 @@ void XFE_ABListSearchView::selectContainer(AB_ContainerInfo *containerInfo) }/* if */ }/* if */ getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); + + /* restart a new search when necessary + */ + m_typeDownIndex = MSG_VIEWINDEXNONE; + typeDownCB(NULL, NULL); } #endif /* USE_ABCOM */ @@ -1946,6 +2624,14 @@ void XFE_ABListSearchView::selectDir(DIR_Server* dir) if (dir == m_dir) return; + if (!m_dir) { + XP_ASSERT(m_outliner); + if (m_outliner) + XtAddCallback(m_outliner->getBaseWidget(), XmNresizeCallback, + XFE_ABListSearchView::resizeCallback, + (XtPointer) this); + }/* if */ + // remove the timer if (m_typeDownTimer) { XtRemoveTimeOut(m_typeDownTimer); @@ -1962,7 +2648,13 @@ void XFE_ABListSearchView::selectDir(DIR_Server* dir) else { XtSetSensitive(m_filterSearchBtn, True); }/* else */ - getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); + + getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); + + /* restart a new search when necessary + */ + m_typeDownIndex = MSG_VIEWINDEXNONE; + typeDownCB(NULL, NULL); } void @@ -2018,10 +2710,15 @@ XFE_ABListSearchView::startSearch(ABSearchInfo_t *info) m_searchingDir = True; +#if 0 + /* Don't do this! + */ /* change label to Stop */ fe_SetString(m_filterSearchBtn, XmNlabelString, XP_GetString(XFE_AB_STOP)); +#endif + #if defined(USE_ABCOM) AB_SearchDirectoryAB2(m_pane, NULL); #else @@ -2043,6 +2740,47 @@ ABAddrMsgCBProcStruc* XFE_ABListSearchView::getSelections() (ABAddrMsgCBProcStruc *) XP_CALLOC(1, sizeof(ABAddrMsgCBProcStruc)); pairs->m_pairs = (StatusID_t **) XP_CALLOC(count, sizeof(StatusID_t*)); for (int i=0; i < count; i++) { +#if defined(USE_ABCOM) + + StatusID_t *pair; + pair = (StatusID_t *) XP_CALLOC(1, sizeof(StatusID_t)); + pair->status = ::TO; + pair->dir = 0; + pair->id = MSG_VIEWINDEXNONE; + + // type, fulladdress + uint16 numItems = 2; + AB_AttribID *attribs = (AB_AttribID *) XP_CALLOC(numItems, + sizeof(AB_AttribID)); + attribs[0] = AB_attribEntryType; + attribs[1] = AB_attribFullAddress; + AB_AttributeValue *values = NULL; + + int error = + AB_GetEntryAttributesForPane(m_pane, + (MSG_ViewIndex) indices[i], + attribs, + &values, + &numItems); + XP_ASSERT(values); + for (int i=0; i < numItems; i++) { + switch (values[i].attrib) { + case AB_attribEntryType: + pair->type = values[i].u.entryType; + break; + + case AB_attribFullAddress: + pair->dplyStr = + !EMPTY_STRVAL(&(values[i]))?XP_STRDUP(values[i].u.string) + :NULL; + break; + default: + XP_ASSERT(0); + break; + }/* switch */ + }/* for i */ + XP_FREEIF(attribs); +#else ABID entry; entry = AB_GetEntryIDAt((AddressPane *) m_abPane, (uint32) indices[i]); if (entry == MSG_VIEWINDEXNONE) @@ -2074,6 +2812,7 @@ ABAddrMsgCBProcStruc* XFE_ABListSearchView::getSelections() AB_GetFullName(m_dir, m_AddrBook, entry, a_line); pair->dplyStr = XP_STRDUP(a_line); }/* if */ +#endif /* USE_ABCOM */ pairs->m_pairs[pairs->m_count] = pair; (pairs->m_count)++; @@ -2081,6 +2820,40 @@ ABAddrMsgCBProcStruc* XFE_ABListSearchView::getSelections() return pairs; }/* XFE_ABListSearchView::getSelections() */ +void +XFE_ABListSearchView::resizeCallback(Widget w, + XtPointer clientData, + XtPointer callData) +{ + XFE_ABListSearchView *obj = (XFE_ABListSearchView *) clientData; + obj->resizeCB(w, callData); +} + +void +XFE_ABListSearchView::resizeCB(Widget /* w */, XtPointer callData) +{ + XmLGridCallbackStruct *cData = (XmLGridCallbackStruct *) callData; + + switch (cData->reason) { + case XmCR_RESIZE_GRID: + { + int32 nRows = 0; + int first = 0, last = 0; + nRows = m_outliner->visibleRows(first, last); +#if defined(DEBUG_tao) + printf("\nXFE_ABListSearchView::resizeCB: nRows=%d, first=%d, last=%d\n", nRows, first, last); +#endif /* DEBUG_tao */ + if (nRows < 10) + nRows = 10; +#if defined(USE_ABCOM) + int error = AB_SetFEPageSizeForPane(m_pane, nRows); +#endif /* USE_ABCOM */ + } + break; + + }/* cData->reason */ +} + #if defined(USE_MOTIF_DND) fe_icon_data* @@ -2320,7 +3093,11 @@ XFE_ABListSearchView::entryListDropCallback(Widget, void* cd, fe_dnd_Event type, fe_dnd_Source *source, +#if defined(USE_ABCOM) + XEvent* event) +#else XEvent* /* event */) +#endif /* USE_ABCOM */ { XFE_ABListSearchView *ad = (XFE_ABListSearchView *)cd; if (type == FE_DND_DROP && @@ -2374,7 +3151,7 @@ XFE_ABListSearchView::entryListDropCB(fe_dnd_Source *source, XEvent *event) XFE_Outliner *outliner = listView->getOutliner(); const int *indices = NULL; int32 numIndices = 0; - outliner->getSelection(&indices, &numIndices); + outliner->getSelection(&indices, (int *) &numIndices); MSG_Pane *srcPane = listView->getPane(); AB_DragEffect effect = AB_DragEntriesIntoContainerStatus(srcPane, diff --git a/mozilla/cmd/xfe/src/ABListSearchView.h b/mozilla/cmd/xfe/src/ABListSearchView.h index fc3d5b5e582..2bcb8e4b1b5 100644 --- a/mozilla/cmd/xfe/src/ABListSearchView.h +++ b/mozilla/cmd/xfe/src/ABListSearchView.h @@ -23,6 +23,7 @@ #ifndef _ABLISTSEARCHVIEW_H_ #define _ABLISTSEARCHVIEW_H_ +#include "rosetta.h" #include "MNListView.h" #include "ABSearchView.h" #include "PopupMenu.h" @@ -50,17 +51,26 @@ public: // user/list functions void undo(); void redo(); - void delUser(); + void abDelete(); + void abDeleteAllEntries(); void newUser(); void newList(); // Get and pack selection ABAddrMsgCBProcStruc* getSelections(); + // + virtual void listChangeFinished(XP_Bool asynchronous, + MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, int32 num); + virtual void paneChanged(XP_Bool asynchronous, MSG_PANE_CHANGED_NOTIFY_CODE notify_code, int32 value); + void dirChanged(int32 value); + + // void changeEntryCount(); XFE_Outliner *getOutliner() { return m_outliner;} @@ -122,16 +132,40 @@ public: virtual void *ConvFromIndex(int index); virtual int ConvToIndex(void *item); + // columns for the Outliner + enum { + OUTLINER_COLUMN_TYPE = 0, + OUTLINER_COLUMN_NAME, + OUTLINER_COLUMN_EMAIL, + OUTLINER_COLUMN_COMPANY, + OUTLINER_COLUMN_PHONE, + OUTLINER_COLUMN_NICKNAME, + OUTLINER_COLUMN_LOCALITY, + OUTLINER_COLUMN_LAST + }; + + // Get tooltipString & docString; + // returned string shall be freed by the callee + // row < 0 indicates heading row; otherwise it is a content row + // (starting from 0) + // + virtual char *getCellTipString(int /* row */, int /* column */); + virtual char *getCellDocString(int /* row */, int /* column */); + + // + // The Outlinable interface. // - virtual char *getColumnName(int column); - virtual char *getColumnHeaderText(int /* column */){ return 0;}; - virtual fe_icon *getColumnHeaderIcon(int column); virtual EOutlinerTextStyle getColumnHeaderStyle(int column); + virtual char *getColumnName(int column); + virtual char *getColumnHeaderText(int column); + virtual char *getColumnText(int column); + virtual fe_icon *getColumnIcon(int column); + + // + virtual fe_icon *getColumnHeaderIcon(int column); virtual EOutlinerTextStyle getColumnStyle(int column); - virtual char *getColumnText(int /* column */){ return 0;}; - virtual fe_icon *getColumnIcon(int /* column */){ return 0;}; // virtual void getTreeInfo(XP_Bool *expandable, @@ -157,6 +191,8 @@ public: // callbacks + static void resizeCallback(Widget, XtPointer, XtPointer); + static void typeDownTimerCallback(XtPointer closure, XtIntervalId *); static void typeActivateCallback(Widget, XtPointer, XtPointer); static void typeDownCallback(Widget, XtPointer, XtPointer); @@ -169,6 +205,8 @@ public: // // callback to be notified when allconnectionsComplete // + virtual void allConnectionsComplete(MWContext *context); + void unRegisterInterested(); XFE_CALLBACK_DECL(allConnectionsComplete) @@ -181,7 +219,7 @@ public: // icons for the outliner static fe_icon m_personIcon; static fe_icon m_listIcon; - static fe_icon m_securityIcon; + HG82719 #if defined(USE_MOTIF_DND) /* motif drag and drop interface. @@ -232,6 +270,7 @@ protected: #endif /* USE_ABCOM */ #endif + void resizeCB(Widget, XtPointer); void startSearch(ABSearchInfo_t *clientData); int addToAddressBook(); @@ -240,7 +279,7 @@ protected: XP_Bool m_ldapDisabled; // - virtual void clickHeader(const OutlineButtonFuncData *){}; + virtual void clickHeader(const OutlineButtonFuncData *); virtual void clickBody(const OutlineButtonFuncData *){}; virtual void clickShiftBody(const OutlineButtonFuncData *){}; virtual void doubleClickBody(const OutlineButtonFuncData *){}; @@ -272,12 +311,16 @@ protected: #if defined(USE_ABCOM) AB_ContainerInfo *m_containerInfo; MSG_Pane *m_abContainerPane; + uint32 *m_pageSize; + + int m_numAttribs; #endif /* USE_ABCOM */ ABook *m_AddrBook; ABPane *m_abPane; ABID m_entryID; /* entryID for current line */ + MSG_ViewIndex m_dataIndex; #if defined(USE_ABCOM) AB_AttribID m_sortType; @@ -295,8 +338,9 @@ private: /* trigger search when time elapse */ XtIntervalId m_typeDownTimer; - + MSG_ViewIndex m_typeDownIndex; XFE_PopupMenu *m_popup; static MenuSpec view_popup_spec[]; }; + #endif diff --git a/mozilla/cmd/xfe/src/ABMListDlg.cpp b/mozilla/cmd/xfe/src/ABMListDlg.cpp index 45f9bc06dad..070b729d088 100644 --- a/mozilla/cmd/xfe/src/ABMListDlg.cpp +++ b/mozilla/cmd/xfe/src/ABMListDlg.cpp @@ -26,6 +26,14 @@ #include "ABMListView.h" #include "MNView.h" +#if defined(USE_ABCOM) +#include "abcom.h" +#endif /* USE_ABCOM */ + +/* to be taken out after USE_ABCOM turned on + */ +#include "AddrBookView.h" + #include #include #include @@ -81,18 +89,30 @@ XFE_ABMListDlg::XFE_ABMListDlg(MSG_Pane *pane, True, /* help */ True, /* apply ; remove */ False, /* separator */ - True), + False), m_pane(pane) { - /* + m_fullName = 0; + m_nickName = 0; + m_info = 0; + + /* initialize the pane */ - createUI(); + XP_ASSERT(pane); + int error = AB_InitializeMailingListPaneAB2(pane); + XP_ASSERT(error == AB_SUCCESS); + + /* UI + */ + createUI(); } #endif /* USE_ABCOM */ XFE_ABMListDlg::~XFE_ABMListDlg() { +#if !defined(USE_ABCOM) m_mailListEntry.CleanUp(); +#endif /* USE_ABCOM */ }/* XFE_ABMListDlg() */ void @@ -215,13 +235,20 @@ XFE_ABMListDlg::createUI() /* mailing list view */ +#if defined(USE_ABCOM) + XFE_ABMListView *listView = new XFE_ABMListView((XFE_Component *)this, + stripForm[i], + m_pane, + m_context); +#else XFE_ABMListView *listView = new XFE_ABMListView((XFE_Component *)this, - stripForm[i], - m_abView->getDir(), - m_abView->getAddrBook(), - NULL, - m_abView->getContext(), - fe_getMNMaster()); + stripForm[i], + m_abView->getDir(), + m_abView->getAddrBook(), + NULL, + m_abView->getContext(), + fe_getMNMaster()); +#endif /* USE_ABCOM */ XtVaSetValues(listView->getBaseWidget(), XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_WIDGET, @@ -294,7 +321,38 @@ void XFE_ABMListDlg::apply() void XFE_ABMListDlg::ok() { getDlgValues(); +#if defined(USE_ABCOM) + // set attribs here + uint16 numItems = 3; + AB_AttributeValue *valuesArray = + (AB_AttributeValue *) XP_CALLOC(numItems, + sizeof(AB_AttributeValue)); + valuesArray[0].attrib = AB_attribFullName; + valuesArray[0].u.string = m_fullName; + valuesArray[1].attrib = AB_attribNickName; + valuesArray[1].u.string = m_nickName; + + valuesArray[2].attrib = AB_attribInfo; + valuesArray[2].u.string = m_info; + + int error = AB_SetMailingListAttributes(m_pane, + valuesArray, + numItems); + + + if (error == AB_SUCCESS) { + m_okToDestroy = TRUE; + cancel(); + }/* if */ + XP_FREEIF(valuesArray); + int err = AB_CommitChanges(m_pane); +#if defined(DEBUG_tao) + if (AB_SUCCESS != err) + printf("\nXFE_ABMListDlg:AB_CommitChanges err=%d\n", err); +#endif + +#else if (!(((XFE_ABMListView *)m_view)->apply(m_mailListEntry.pNickName, m_mailListEntry.pFullName, m_mailListEntry.pInfo))) { @@ -302,12 +360,64 @@ void XFE_ABMListDlg::ok() m_okToDestroy = TRUE; cancel(); }/* if */ +#endif m_okToDestroy = FALSE; } void XFE_ABMListDlg::setDlgValues() { +#if defined(USE_ABCOM) + uint16 numItems = 3; + AB_AttribID *attribs = (AB_AttribID *) XP_CALLOC(numItems, + sizeof(AB_AttribID)); + attribs[0] = AB_attribFullName; + attribs[1] = AB_attribNickName; + attribs[2] = AB_attribInfo; + //attribs[3] = AB_attribDistName; + + AB_AttributeValue *values = 0; + int error = AB_GetMailingListAttributes(m_pane, + attribs, + &values, + &numItems); + for (int i=0; i < numItems; i++) { + switch (values[i].attrib) { + case AB_attribFullName: + fe_SetTextField(m_textFs[0], + !EMPTY_STRVAL(&(values[i]))? + values[i].u.string: + ""); + m_fullName = + !EMPTY_STRVAL(&(values[i]))?XP_STRDUP(values[i].u.string): + 0; + break; + + case AB_attribNickName: + fe_SetTextField(m_textFs[1], + !EMPTY_STRVAL(&(values[i]))? + values[i].u.string: + ""); + m_nickName = + !EMPTY_STRVAL(&(values[i]))?XP_STRDUP(values[i].u.string): + 0; + break; + + case AB_attribInfo: + fe_SetTextField(m_textFs[2], + !EMPTY_STRVAL(&(values[i]))? + values[i].u.string: + ""); + + m_info = + !EMPTY_STRVAL(&(values[i]))?XP_STRDUP(values[i].u.string): + 0; + break; + }/* switch */ + + //AB_FreeEntryAttributeValues(values, numItems); + }/* for i */ +#endif /* USE_ABCOM */ } void XFE_ABMListDlg::setDlgValues(ABID entry, Boolean newList) @@ -356,6 +466,11 @@ void XFE_ABMListDlg::setDlgValues(ABID entry, Boolean newList) void XFE_ABMListDlg::getDlgValues() { +#if defined(USE_ABCOM) + m_fullName = fe_GetTextField(m_textFs[0]); + m_nickName = fe_GetTextField(m_textFs[1]); + m_info = fe_GetTextField(m_textFs[2]); +#else char *tmp; tmp = fe_GetTextField(m_textFs[0]); if (tmp && strlen(tmp)) @@ -374,6 +489,7 @@ void XFE_ABMListDlg::getDlgValues() m_mailListEntry.pInfo = tmp; else m_mailListEntry.pInfo = XP_STRDUP(""); +#endif /* USE_ABCOM */ } void XFE_ABMListDlg::Initialize() diff --git a/mozilla/cmd/xfe/src/ABMListDlg.h b/mozilla/cmd/xfe/src/ABMListDlg.h index c35226098e2..4413731a6ac 100644 --- a/mozilla/cmd/xfe/src/ABMListDlg.h +++ b/mozilla/cmd/xfe/src/ABMListDlg.h @@ -46,7 +46,7 @@ public: virtual void setDlgValues(); - ~XFE_ABMListDlg(); + virtual ~XFE_ABMListDlg(); // void createUI(); @@ -80,6 +80,10 @@ private: DIR_Server *m_dir; #if defined(USE_ABCOM) MSG_Pane *m_pane; + + char *m_fullName; + char *m_nickName; + char *m_info; #endif /* USE_ABCOM */ MLPane *m_mListPane; ABook *m_AddrBook; diff --git a/mozilla/cmd/xfe/src/ABMListView.cpp b/mozilla/cmd/xfe/src/ABMListView.cpp index aba3d71d256..79536910a44 100644 --- a/mozilla/cmd/xfe/src/ABMListView.cpp +++ b/mozilla/cmd/xfe/src/ABMListView.cpp @@ -67,6 +67,24 @@ static XtActionsRec actions[] = { {"TableTraverse", TableTraverse },}; extern XtAppContext fe_XtAppContext; + +// +static char a_line[AB_MAX_STRLEN]; + +#if defined(USE_ABCOM) + +/* C API + */ +extern "C" XFE_ABComplPickerDlg* +fe_showComplPickerDlg(Widget toplevel, + MWContext *context, + MSG_Pane *pane, + MWContext *pickerContext, + NCPickerExitFunc func, + void *callData); + +#endif /* USE_ABCOM */ + // XFE_ABMListView::XFE_ABMListView(XFE_Component *toplevel_component, Widget parent, @@ -75,8 +93,13 @@ XFE_ABMListView::XFE_ABMListView(XFE_Component *toplevel_component, XFE_View *parent_view, MWContext *context, MSG_Master *master): +#if defined(USE_ABCOM) + XFE_MNListView(toplevel_component, parent_view, context, + (MSG_Pane *)NULL), +#else XFE_MNView(toplevel_component, parent_view, context, (MSG_Pane *)NULL), +#endif /* USE_ABCOM */ m_master(master), m_dir(dir), @@ -179,15 +202,287 @@ XFE_ABMListView::XFE_ABMListView(XFE_Component *toplevel_component, } } +#if defined(USE_ABCOM) +XFE_ABMListView::XFE_ABMListView(XFE_Component *toplevel_component, + Widget parent, + MSG_Pane *pane, + MWContext *context): + XFE_MNListView(toplevel_component, + NULL, + context, + (MSG_Pane *)pane), + m_count(0), + m_textF(0) +{ + /* initialize m_directroies + */ + m_lastPos = 0; + m_curPos = 0; + m_curName = 0; + m_textStr = 0; + m_pickerPane = 0; + m_pickerContext = + XFE_ABComplPickerDlg::cloneCntxtNcreatePane(context, + &m_pickerPane); + m_pickerDlg = 0; + m_rtnIsPicker = False; + + m_valChgedByMe = False; + m_numResults = 0; + m_ncCookie = 0; + + m_index = MSG_VIEWINDEXNONE; + m_preStr[0] = '\0'; + + setPane(pane); + + // Add actions + XtAppAddActions( fe_XtAppContext, actions, XtNumber(actions)); + + /* For outliner + */ + int num_columns = 2; + static int column_widths[] = {6, 50}; + + m_outliner = new XFE_Outliner("mailingList", + this, + toplevel_component, + parent, + False, // constantSize + False, //hasHeadings + num_columns, + num_columns, + column_widths, + OUTLINER_GEOMETRY_PREF); + /* BEGIN_3P: XmLGrid + */ + XtVaSetValues(m_outliner->getBaseWidget(), + XtVaTypedArg, XmNblankBackground, XmRString, "white", 6, + XmNselectionPolicy, XmSELECT_MULTIPLE_ROW, + XmNvisibleRows, 10, + NULL); + XtVaSetValues(m_outliner->getBaseWidget(), + XmNcellDefaults, True, + XtVaTypedArg, XmNcellBackground, XmRString, "white", 6, + NULL); + // editable + XtVaSetValues(m_outliner->getBaseWidget(), + XmNcellDefaults, True, + XmNcolumn, 1, + XmNcellEditable, True, + NULL); + /* END_3P: XmLGrid + */ + + // create drop site for internal drop + fe_dnd_CreateDrop(m_outliner->getBaseWidget(),AddressDropCb,this); + + + /* XFE_Outliner constructor does not allocate any content row + * XFE_Outliner::change(int first, int length, int newnumrows) + */ + m_outliner->show(); + setBaseWidget(m_outliner->getBaseWidget()); + m_count = MSG_GetNumLines(m_pane); + m_outliner->change(0, m_count, m_count); + + // initialize the icons if they haven't already been + { + Pixel bg_pixel; + + XtVaGetValues(m_outliner->getBaseWidget(), XmNbackground, &bg_pixel, 0); + if (!m_personIcon.pixmap) + fe_NewMakeIcon(getToplevel()->getBaseWidget(), + /* umm. fix me + */ + BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())), + bg_pixel, + &m_personIcon, + NULL, + MN_Person.width, + MN_Person.height, + MN_Person.mono_bits, + MN_Person.color_bits, + MN_Person.mask_bits, + FALSE); + + if (!m_listIcon.pixmap) + fe_NewMakeIcon(getToplevel()->getBaseWidget(), + /* umm. fix me + */ + BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())), + bg_pixel, + &m_listIcon, + NULL, + MN_People.width, + MN_People.height, + MN_People.mono_bits, + MN_People.color_bits, + MN_People.mask_bits, + FALSE); + + } +} +#endif /* USE_ABCOM */ + XFE_ABMListView::~XFE_ABMListView() { /* close the pane */ +#if defined(USE_ABCOM) + if (m_pickerPane) { + MSG_SetFEData(m_pickerPane, 0); + AB_ClosePane(m_pickerPane); + }/* if */ + if (m_pane) { + MSG_SetFEData(m_pane, 0); + AB_ClosePane(m_pane); + }/* if */ + + if (m_pickerDlg) { + delete m_pickerDlg; + m_pickerDlg = 0; + }/* if */ +#else if (m_mListPane) AB_CloseMailingListPane(&m_mListPane); +#endif /* USE_ABCOM */ } +#if defined(USE_ABCOM) +void +XFE_ABMListView::fillNameCompletionStr(char *completeName, + XP_Bool completed) +{ + /* put completeName into textF and hilight auto-completed portion + */ + int lastPos = completeName?XP_STRLEN(completeName):0; + int curPos = m_curPos; + + /* set flag for artificial valchg + */ + m_valChgedByMe = True; + + fe_SetTextFieldAndCallBack(m_textF, completeName); + XP_STRCPY(m_preStr, completeName); + if (!completed) { + /* set selection + */ + if (curPos > 0 && lastPos > m_curPos) { + Time time = XtLastTimestampProcessed(XtDisplay(m_textF)); +#if defined(DEBUG_tao) + printf("\nfillNameCompletionStr:%s, curPos=%d, m_curPos=%d, lastPos=%d\n", + completeName, curPos, m_curPos, lastPos); +#endif + XmTextFieldSetSelection(m_textF, curPos, lastPos, time); + /* set cursor position + */ + }/* if */ + XmTextFieldSetCursorPosition(m_textF, curPos); + m_curPos = curPos; + }/* if */ + XmUpdateDisplay(m_textF); +} + +void +XFE_ABMListView::nameCPickerExitFunc(void *clientData, void *callData) +{ + XFE_ABMListView *obj = (XFE_ABMListView *) callData; + obj->nameCPickerCB(clientData); +} + +void +XFE_ABMListView::nameCPickerCB(void *clientData) +{ + AB_NameCompletionCookie *cookie = (AB_NameCompletionCookie *) clientData; +#if 1 + /* push it down to the list + */ + int error = AB_AddNCEntryToMailingList(m_pane, + MSG_VIEWINDEXNONE, // for new + cookie, + False); + // if not the same,need to free as well. + m_ncCookie = 0; + AB_FreeNameCompletionCookie(cookie); +#else + char *completeName = AB_GetNameCompletionDisplayString(cookie); + if (completeName && XP_STRLEN(completeName)) { + + fillNameCompletionStr(completeName, True); + + + XP_FREE(completeName); + }/* if */ +#endif + + /* reset the flag && .. + */ + fe_SetTextFieldAndCallBack(m_textF, ""); + m_numResults = 0; + m_rtnIsPicker = False; +} + +int +XFE_ABMListView::nameCompletionExitFunc(AB_NameCompletionCookie *cookie, + int numResults, + void *FEcookie) +{ + XFE_ABMListView *obj = (XFE_ABMListView *) FEcookie; + return obj->nameCompletionCB(cookie, numResults); +} + +int +XFE_ABMListView::nameCompletionCB(AB_NameCompletionCookie *cookie, + int numResults) +{ +#if defined(DEBUG_tao) + printf("\n** nameCompletionCB,numResults=%d\n", numResults); +#endif + XP_ASSERT(m_pickerPane && m_pickerContext); + m_numResults = numResults; + if (numResults > 1) { + /* set the flag + */ + m_rtnIsPicker = True; + + /* 1. assemble the hint + */ + AB_AttribID attrib = AB_attribDisplayName; + AB_ColumnInfo *cInfo = + AB_GetColumnInfoForPane(m_pickerPane, + (AB_ColumnID) 1); + if (cInfo) { + attrib = cInfo->attribID; + AB_FreeColumnInfo(cInfo); + + AB_AttributeValue *value = 0; + int error = + AB_GetEntryAttributeForPane(m_pickerPane, + 0, + attrib, &value); + a_line[0] = '\0'; + XP_SAFE_SPRINTF(a_line, sizeof(a_line), + "%s ", + EMPTY_STRVAL(value)?m_curName:value->u.string); + fillNameCompletionStr(a_line, False); + AB_FreeEntryAttributeValue(value); + }/* if */ + }/* if */ + else if (numResults == 1){ + char *completeName = AB_GetNameCompletionDisplayString(cookie); + m_ncCookie = cookie; + if (completeName && XP_STRLEN(completeName)) { + fillNameCompletionStr(completeName, False); + XP_FREE(completeName); + }/* if */ + + }/* else */ + return numResults; +} +#endif /* USE_ABCOM */ + ABID XFE_ABMListView::setValues(ABID listID) { m_listID = listID; @@ -232,6 +527,12 @@ char *XFE_ABMListView::getCellTipString(int row, int column) tmp = getColumnHeaderText(column); }/* if */ else { +#if defined(USE_ABCOM) + MSG_ViewIndex orgInd = m_index; + m_index = row; + tmp = getColumnText(column); + m_index = orgInd; +#else ABID orgID = m_entryID; /* content @@ -243,6 +544,7 @@ char *XFE_ABMListView::getCellTipString(int row, int column) /* reset */ m_entryID = orgID; +#endif /* USE_ABCOM */ }/* else */ if (tmp && (!m_outliner->isColTextFit(tmp, row, column))) @@ -276,11 +578,17 @@ XFE_ABMListView::ConvToIndex(void */*item*/) void* XFE_ABMListView::acquireLineData(int line) { + +#if defined(USE_ABCOM) + m_index = line; + return (void *) &m_index; // a non-zero val +#else m_entryID = AB_GetEntryIDAt((AddressPane *) m_mListPane, (uint32) line); static char tmp[8]; tmp[0] = '\0'; return tmp; +#endif /* USE_ABCOM */ } /* The Outlinable interface. @@ -290,10 +598,10 @@ char* XFE_ABMListView::getColumnName(int column) { switch (column) { - case XFE_AddrBookView::OUTLINER_COLUMN_TYPE: + case OUTLINER_COLUMN_TYPE: return XP_GetString(XFE_AB_NAME_CONTACT_TAB); - case XFE_AddrBookView::OUTLINER_COLUMN_NAME: + case OUTLINER_COLUMN_NAME: return XP_GetString(XFE_AB_NAME_GENERAL_TAB); }/* switch */ @@ -336,19 +644,43 @@ XFE_ABMListView::getColumnStyle(int /*column*/) char* XFE_ABMListView::getColumnText(int column) { - static char a_line[AB_MAX_STRLEN]; + a_line[0] = '\0'; switch (column) { +#if defined(USE_ABCOM) + case OUTLINER_COLUMN_TYPE: + break; + + case OUTLINER_COLUMN_NAME: +#else case XFE_AddrBookView::OUTLINER_COLUMN_TYPE: break; case XFE_AddrBookView::OUTLINER_COLUMN_NAME: +#endif /* USE_ABCOM */ { +#if defined(USE_ABCOM) + AB_AttribID *attribs = + (AB_AttribID *) XP_CALLOC(1,sizeof(AB_AttribID)); + attribs[0] = AB_attribFullAddress; + + AB_AttributeValue *values = 0; + uint16 numItems = 1; + int error = + AB_GetMailingListEntryAttributes(m_pane, + m_index, + attribs, + &values, + &numItems); + XP_ASSERT(numItems == 1 && values[0].attrib == AB_attribFullAddress); + XP_STRCPY(a_line, !EMPTY_STRVAL(&(values[0]))?values[0].u.string:""); +#else char *expandedName = NULL; AB_GetExpandedName(m_dir, m_AddrBook, m_entryID, &expandedName); if (expandedName) XP_STRCPY(a_line, expandedName); - } +#endif /* USE_ABCOM */ + } break; }/* switch () */ @@ -362,12 +694,39 @@ XFE_ABMListView::getColumnIcon(int column) switch (column) { case OUTLINER_COLUMN_TYPE: { +#if defined(USE_ABCOM) + AB_AttribID *attribs = + (AB_AttribID *) XP_CALLOC(1,sizeof(AB_AttribID)); + attribs[0] = AB_attribEntryType; + + AB_AttributeValue *values = 0; + uint16 numItems = 1; + int error = + AB_GetMailingListEntryAttributes(m_pane, + m_index, + attribs, + &values, + &numItems); + XP_ASSERT(numItems == 1 && values[0].attrib == AB_attribEntryType); + switch (values[0].u.entryType) { + case AB_MailingList: + myIcon = &m_listIcon; + break; + + case AB_Person: + myIcon = &m_personIcon; + break; + + }/* switch */ +#else + ABID type; AB_GetType(m_dir, m_AddrBook, m_entryID, &type); if (type == ABTypePerson) myIcon = &m_personIcon; /* shall call make/initialize icons */ else if (type == ABTypeList) myIcon = &m_listIcon; +#endif /* USE_ABCOM */ } break; }/* switch () */ @@ -396,23 +755,18 @@ XFE_ABMListView::Buttonfunc(const OutlineButtonFuncData *data) } else { /* content row - */ - ABID type; - ABID entry; - - entry = AB_GetEntryIDAt((AddressPane *) m_mListPane, (uint32) row); - - if (entry == MSG_VIEWINDEXNONE) - return; - - AB_GetType(m_dir, m_AddrBook, entry, &type); - - if (clicks == 2) { + */ + if (clicks == 2) { m_outliner->selectItemExclusive(data->row); }/* clicks == 2 */ else if (clicks == 1) { #if MULTI_SELECT_ON - if (data->shift) { +#if defined(USE_ABCOM) + if (data->ctrl) + m_outliner->toggleSelected(data->row); + else +#endif /* USE_ABCOM */ + if (data->shift) { // select the range. const int *selected; int count; @@ -493,6 +847,34 @@ XFE_ABMListView::entryTTYActivateCB(Widget w, XtPointer /* callData */) if (!str || XP_STRLEN(str) == 0) return; +#if defined(USE_ABCOM) + if (m_rtnIsPicker) { + /* pop up picker + */ + if (m_pickerDlg) { + m_pickerDlg->show(); + m_pickerDlg->selectItem(1); + }/* if */ + return; + }/* if m_rtnIsPicker */ + else if (m_numResults == 1) { + int error = AB_AddNCEntryToMailingList(m_pane, + MSG_VIEWINDEXNONE, // for new + m_ncCookie, + False); + // if not the same,need to free as well. + AB_FreeNameCompletionCookie(m_ncCookie); + m_ncCookie = 0; + + }/* m_numResults == 1 */ + else if (m_numResults == 0) { + int error = + AB_AddNakedEntryToMailingList(m_pane, + MSG_VIEWINDEXNONE, + str, + False); + }/* m_numResults == 0 */ +#else /* if the name does not match/get expanded: * we break down every token */ @@ -542,6 +924,7 @@ XFE_ABMListView::entryTTYActivateCB(Widget w, XtPointer /* callData */) /* reset */ m_memberID = MSG_VIEWINDEXNONE; +#endif /* USE_ABCOM */ XP_FREE((void *)str); fe_SetTextFieldAndCallBack(w, ""); } @@ -558,20 +941,62 @@ void XFE_ABMListView::entryTTYValChgCB(Widget w, XtPointer /* callData */) { +#if defined(USE_ABCOM) + if (m_valChgedByMe) { + /* reset flag for artificial valchg + */ + m_valChgedByMe = False; + return; + }/* if */ +#endif /* USE_ABCOM */ + m_textF = w; const char *str; str = fe_GetTextField(w); - int curPos = XmTextFieldGetCursorPosition(w); - if (m_preStr && XP_STRCMP(str, (const char*)m_preStr) == 0) return; + int curPos = XmTextFieldGetCursorPosition(w); + +#if defined(USE_ABCOM) +#if defined(DEBUG_tao) + printf("\n-->entryTTYValChgCB,m_pickerPane=0x%x, str=%s,curPos=%d,m_preStr=%s **\n", + m_pickerPane, str, curPos, m_preStr); +#endif + if (m_curPos == curPos) + return; + + m_curPos = curPos; + m_curName = str?XP_STRDUP(str):0; + + /* get name compl + */ + if (!m_pickerDlg) + m_pickerDlg = + fe_showComplPickerDlg(getToplevel()->getBaseWidget(), + m_contextData, + m_pickerPane, + m_pickerContext, + &nameCPickerExitFunc, + this); + int error = + AB_NameCompletionSearch(m_pickerPane, + (const char *) str, + &nameCompletionExitFunc, +#ifdef FE_IMPLEMENTS_VISIBLE_NC + True, // for now +#endif + (void *) this); + +#else + + XP_Bool setV = False; + ABID entryID; ABID field; - XP_Bool setV = False; -#if 1 + DIR_Server* pab = NULL; DIR_GetComposeNameCompletionAddressBook(m_directories, &pab); if (pab && @@ -580,14 +1005,6 @@ XFE_ABMListView::entryTTYValChgCB(Widget w, XtPointer /* callData */) &entryID, &field, str) != MSG_VIEWINDEXNONE) { -#else - if (AB_GetIDForNameCompletion(m_AddrBook, - m_dir, - &entryID, - &field, - str) != MSG_VIEWINDEXNONE) { -#endif - char a_line[AB_MAX_STRLEN]; a_line[0] = '\0'; if (field == ABNickname) { @@ -619,6 +1036,7 @@ XFE_ABMListView::entryTTYValChgCB(Widget w, XtPointer /* callData */) m_memberID = MSG_VIEWINDEXNONE; strcpy(m_preStr, str); }/* else */ + if (setV) { int lastPos = m_preStr?XP_STRLEN(m_preStr):0; @@ -638,6 +1056,7 @@ XFE_ABMListView::entryTTYValChgCB(Widget w, XtPointer /* callData */) }/* if */ XmTextFieldSetCursorPosition(w, curPos); }/* if */ +#endif /* USE_ABCOM */ } void XFE_ABMListView::remove() @@ -648,6 +1067,12 @@ void XFE_ABMListView::remove() const int *indices = 0; m_outliner->getSelection(&indices, (int *) &num); if (num > 0 && indices) { +#if defined(USE_ABCOM) + int error = AB_CommandAB2(m_pane, + AB_DeleteCmd, + (MSG_ViewIndex *) indices, + num); +#else int curInd = indices[0]; #if MULTI_SELECT_ON /* indices is an internal buffer and @@ -676,6 +1101,7 @@ void XFE_ABMListView::remove() m_outliner->makeVisible(curInd); }/* if */ }/* if m_count */ +#endif /* USE_ABCOM */ }/* if num > 0 && indices */ }/* remove() */ @@ -828,6 +1254,61 @@ XFE_ABMListView::AddressDropCb(Widget,void* cd, void XFE_ABMListView::addressDropCb(fe_dnd_Source *source) { +#if defined(USE_ABCOM) + switch (source->type) { + + case FE_DND_ADDRESSBOOK: + case FE_DND_BOOKS_DIRECTORIES: + { +#if defined(DEBUG_tao) + printf("\nXFE_ABMListView::addressDropCb:%d\n",source->type); +#endif + + // + XFE_MNListView* listView = (XFE_MNListView *) source->closure; + XFE_Outliner *outliner = listView->getOutliner(); + const int *indices = NULL; + int32 numIndices = 0; + outliner->getSelection(&indices, (int *) &numIndices); + MSG_Pane *srcPane = listView->getPane(); + AB_ContainerInfo *destContainer = + AB_GetContainerForMailingList(m_pane); + + AB_DragEffect effect = + AB_DragEntriesIntoContainerStatus(srcPane, + (const MSG_ViewIndex *) indices, + (int32) numIndices, + destContainer, + AB_Default_Drag); +#if defined(DEBUG_tao) + printf("\nXFE_ABMListView::addressDropCb:effect=%d\n", + effect); + +#endif + int error = 0; + if (effect == AB_Drag_Not_Allowed) + return; + else + error = + AB_DragEntriesIntoContainer(srcPane, + (const MSG_ViewIndex *) indices, + (int32) numIndices, + destContainer, + effect); + +#if defined(DEBUG_tao) + printf("\nXFE_ABMListView::AB_DragEntriesIntoContainer:error=%d\n", + error); + +#endif + // + break; + } + default: + break; + } + +#else switch (source->type) { case FE_DND_ADDRESSBOOK: @@ -852,6 +1333,7 @@ XFE_ABMListView::addressDropCb(fe_dnd_Source *source) default: break; } +#endif /* USE_ABCOM */ } void @@ -879,7 +1361,6 @@ XFE_ABMListView::processAddressBookDrop(XFE_Outliner *outliner, /* check if email address exist */ - char a_line[AB_MAX_STRLEN]; a_line[0] = '\0'; AB_GetEmailAddress(m_dir, m_AddrBook, entry, a_line); if (!a_line || diff --git a/mozilla/cmd/xfe/src/ABMListView.h b/mozilla/cmd/xfe/src/ABMListView.h index f41bf52193d..5ecd87c3868 100644 --- a/mozilla/cmd/xfe/src/ABMListView.h +++ b/mozilla/cmd/xfe/src/ABMListView.h @@ -23,25 +23,48 @@ #ifndef _ABMLISTVIEW_H_ #define _ABMLISTVIEW_H_ +#if defined(USE_ABCOM) +#include "MNListView.h" +#else #include "MNView.h" +#endif /* USE_ABCOM */ + #include "Outliner.h" #include "Outlinable.h" +#if defined(USE_ABCOM) +#include "ABComplPickerDlg.h" +#include "abcom.h" +#endif /* USE_ABCOM */ + +/* to be taken out when USE_ABCOM is on +*/ #include "addrbook.h" class XFE_AddrBookView; +#if defined(USE_ABCOM) +class XFE_ABMListView : public XFE_MNListView +#else class XFE_ABMListView : public XFE_MNView, public XFE_Outlinable +#endif /* USE_ABCOM */ { public: XFE_ABMListView(XFE_Component *toplevel_component, - Widget parent, - DIR_Server *dir, - ABook *pABook, - XFE_View *parent_view, - MWContext *context, - MSG_Master* master); - ~XFE_ABMListView(); + Widget parent, + DIR_Server *dir, + ABook *pABook, + XFE_View *parent_view, + MWContext *context, + MSG_Master* master); +#if defined(USE_ABCOM) + XFE_ABMListView(XFE_Component *toplevel_component, + Widget parent, + MSG_Pane *pane, + MWContext *context); +#endif /* USE_ABCOM */ + + virtual ~XFE_ABMListView(); // The Outlinable interface. @@ -85,10 +108,6 @@ public: // columns for the Outliner enum {OUTLINER_COLUMN_TYPE = 0, OUTLINER_COLUMN_NAME, - OUTLINER_COLUMN_NICKNAME, - OUTLINER_COLUMN_EMAIL, - OUTLINER_COLUMN_COMPANY, - OUTLINER_COLUMN_LOCALITY, OUTLINER_COLUMN_LAST }; @@ -112,8 +131,38 @@ public: String *params, Cardinal *nparam); +#if defined(USE_ABCOM) + static int nameCompletionExitFunc(AB_NameCompletionCookie *cookie, + int numResults, + void *FEcookie); + static void nameCPickerExitFunc(void *clientData, void *callData); +#endif /* USE_ABCOM */ + protected: +#if defined(USE_ABCOM) + int nameCompletionCB(AB_NameCompletionCookie *cookie, + int numResults); + void nameCPickerCB(void *clientData); + void fillNameCompletionStr(char *completeName, + XP_Bool completed = False); + + MSG_ViewIndex m_index; + + MSG_Pane *m_pickerPane; + MWContext *m_pickerContext; + XFE_ABComplPickerDlg *m_pickerDlg; + + XmTextPosition m_lastPos; + XmTextPosition m_curPos; + char *m_curName; /* name token */ + char *m_textStr; /* whatever string in text field */ + XP_Bool m_rtnIsPicker; + XP_Bool m_valChgedByMe; + int m_numResults; + AB_NameCompletionCookie *m_ncCookie; +#endif /* USE_ABCOM */ + XFE_Outliner *m_outliner; // @@ -143,6 +192,7 @@ private: Widget m_textF; void doBackSpace(XEvent *event); + }; #endif /* _ABMLISTVIEW_H_ */ diff --git a/mozilla/cmd/xfe/src/ABNameCTalkTab.cpp b/mozilla/cmd/xfe/src/ABNameCTalkTab.cpp index b28a098ef7e..4bed1512649 100644 --- a/mozilla/cmd/xfe/src/ABNameCTalkTab.cpp +++ b/mozilla/cmd/xfe/src/ABNameCTalkTab.cpp @@ -322,6 +322,10 @@ void XFE_ABNameCTalkTabView::setDlgValues() case AB_attribCoolAddress: tmp = values[i].u.string; break; + + default: + XP_ASSERT(0); + break; }/* switch */ }/* for i */ diff --git a/mozilla/cmd/xfe/src/ABNameConTab.cpp b/mozilla/cmd/xfe/src/ABNameConTab.cpp index 18bcdd14b97..962064ff091 100644 --- a/mozilla/cmd/xfe/src/ABNameConTab.cpp +++ b/mozilla/cmd/xfe/src/ABNameConTab.cpp @@ -281,6 +281,10 @@ void XFE_ABNameConTabView::setDlgValues() fe_SetTextField(m_textFs[AB_CELLULAR], tmp?tmp:""); break; + + default: + XP_ASSERT(0); + break; }/* switch */ }/* for i */ diff --git a/mozilla/cmd/xfe/src/ABNameFolderDlg.cpp b/mozilla/cmd/xfe/src/ABNameFolderDlg.cpp index 004b1c5760b..fd3397cfdbf 100644 --- a/mozilla/cmd/xfe/src/ABNameFolderDlg.cpp +++ b/mozilla/cmd/xfe/src/ABNameFolderDlg.cpp @@ -131,7 +131,9 @@ XFE_ABNameFolderDlg::XFE_ABNameFolderDlg(MSG_Pane *personPane, XFE_ABNameFolderDlg::~XFE_ABNameFolderDlg() { #if defined(USE_ABCOM) - int error = AB_ClosePane(((XFE_MNView *) m_view)->getPane()); + MSG_Pane *pane = ((XFE_MNView *) m_view)->getPane(); + MSG_SetFEData(pane, 0); + int error = AB_ClosePane(pane); #else m_personEntry.CleanUp(); @@ -213,7 +215,7 @@ void XFE_ABNameFolderDlg::setDlgValues(ABID entry, PersonEntry* pPerson, if (pPerson->pHomePhone) m_personEntry.pHomePhone = XP_STRDUP(pPerson->pHomePhone); - m_personEntry.Security = pPerson->Security; + HG17211 if (pPerson->pCoolAddress) m_personEntry.pCoolAddress = XP_STRDUP(pPerson->pCoolAddress); @@ -327,7 +329,7 @@ void XFE_ABNameFolderDlg::setDlgValues(ABID entry, Boolean newUser) if (AB_GetDistName(dir, aBook, entry, a_line) != MSG_VIEWINDEXNONE) m_personEntry.pDistName = XP_STRDUP(a_line); #endif - AB_GetSecurity(dir, aBook, entry, &m_personEntry.Security); + HG01019 a_line[0] = '\0'; if (AB_GetCoolAddress(dir, aBook, entry, a_line) != MSG_VIEWINDEXNONE) @@ -450,9 +452,31 @@ char* XFE_ABNameFolderDlg::getFullname() attribs, &values, &numItems); - char *tmp0 = values[0].u.string, - *tmp1 = values[1].u.string, - *tmp2 = values[2].u.string; + + char *tmp0 = 0, + *tmp1 = 0, + *tmp2 = 0; + + for (int i=0; i < numItems; i++) { + switch (values[i].attrib) { + case AB_attribGivenName: + tmp0 = values[i].u.string; + break; + + case AB_attribFamilyName: + tmp1 = values[i].u.string; + break; + + case AB_attribFullName: + tmp2 = values[i].u.string; + break; + + default: + XP_ASSERT(0); + break; + + }/* switch */ + }/* for i */ if (!changed && (firstName && tmp0 && XP_STRCMP(firstName, tmp0)) || (lastName && tmp1 && XP_STRCMP(lastName, tmp1))) @@ -474,8 +498,8 @@ char* XFE_ABNameFolderDlg::getFullname() tmp1:""); }/* if */ }/* if FullName */ - firstName = tmp0; - lastName = tmp1; + firstName = tmp0?XP_STRDUP(tmp0):0; + lastName = tmp1?XP_STRDUP(tmp1):0; // free XP_FREEIF(attribs); diff --git a/mozilla/cmd/xfe/src/ABNameGenTab.cpp b/mozilla/cmd/xfe/src/ABNameGenTab.cpp index 8c9cd02fc62..8dd02a09c7f 100644 --- a/mozilla/cmd/xfe/src/ABNameGenTab.cpp +++ b/mozilla/cmd/xfe/src/ABNameGenTab.cpp @@ -54,6 +54,7 @@ XFE_ABNameGenTabView::XFE_ABNameGenTabView(XFE_Component *top, XFE_View *view): XFE_PropertyTabView(top, view, XFE_AB_NAME_GENERAL_TAB) { + m_userDefined = False; int ac, numForms = AB_LAST+2; Arg av[20]; @@ -106,9 +107,18 @@ XFE_ABNameGenTabView::XFE_ABNameGenTabView(XFE_Component *top, /* TextF */ ac = 0; + XtSetArg(av[ac], XmNuserData, i); ac++; m_textFs[i] = fe_CreateTextField(stripForm[i], (char *) genTabLabels[i], av, ac); + if (i <= AB_DISPLAY_NAME) { + XtAddCallback(m_textFs[i], + XmNvalueChangedCallback, + XFE_ABNameGenTabView::textFValChgCallback, + this); + + }/* if */ + XtVaSetValues(m_textFs[i], XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, label, @@ -186,6 +196,56 @@ XFE_ABNameGenTabView::~XFE_ABNameGenTabView() { } +void +XFE_ABNameGenTabView::textFValChgCallback(Widget w, + XtPointer clientData, + XtPointer callData) +{ + XFE_ABNameGenTabView *obj = (XFE_ABNameGenTabView *) clientData; + obj->textFValChgCB(w, callData); +} + +void +XFE_ABNameGenTabView::textFValChgCB(Widget w, XtPointer /* callData */) +{ + if (m_userDefined) + // shall we remove CB ?? + return; + + int which = -1; + XtVaGetValues(w, + XmNuserData, &which, + 0); + if (which == AB_DISPLAY_NAME) { + Widget focusW = XmGetFocusWidget(getBaseWidget()); + if (w == focusW) { + char *tmp = fe_GetTextField(m_textFs[AB_DISPLAY_NAME]); + if (tmp && XP_STRLEN(tmp)) + m_userDefined = True; + }/* if */ +#if defined(DEBUG_tao_) + printf("\n--XFE_ABNameGenTabView::textFValChgCB--%d,%x,%x\n", + which, w, focusW); +#endif /* */ + return; + }/* if */ + + char *firstName = fe_GetTextField(m_textFs[AB_FIRST_NAME]), + *lastName = fe_GetTextField(m_textFs[AB_LAST_NAME]), + *dplyName = NULL; + +#if defined(USE_ABCOM) + int error = AB_GenerateDefaultDisplayName(firstName, + lastName, + &dplyName); + fe_SetTextField(m_textFs[AB_DISPLAY_NAME], + dplyName?dplyName:""); + XP_FREEIF(dplyName); +#endif /* USE_ABCOM */ + XmUpdateDisplay(w); + +} + void XFE_ABNameGenTabView::setDlgValues() { /* Get mode, entryid, and ab_view @@ -232,6 +292,10 @@ void XFE_ABNameGenTabView::setDlgValues() tmp = values[i].u.string; fe_SetTextField(m_textFs[AB_DISPLAY_NAME], tmp?tmp:""); + if (tmp && XP_STRLEN(tmp)) + m_userDefined = True; + else + m_userDefined = False; break; case AB_attribEmailAddress: @@ -270,6 +334,10 @@ void XFE_ABNameGenTabView::setDlgValues() values[i].u.boolValue, FALSE); break; + default: + XP_ASSERT(0); + break; + }/* switch */ }/* for i */ @@ -325,9 +393,10 @@ void XFE_ABNameGenTabView::getDlgValues() else values[AB_LAST_NAME].u.string = XP_STRDUP(""); - // AB_attribInfo - tmp = fe_GetTextField(m_notesTxt); - values[AB_DISPLAY_NAME].attrib = AB_attribInfo; + // AB_attribDisplayName; + + tmp = fe_GetTextField(m_textFs[AB_DISPLAY_NAME]); + values[AB_DISPLAY_NAME].attrib = AB_attribDisplayName; if (tmp && strlen(tmp)) values[AB_DISPLAY_NAME].u.string = tmp; else @@ -365,6 +434,13 @@ void XFE_ABNameGenTabView::getDlgValues() else values[AB_COMPANY_NAME].u.string = XP_STRDUP(""); + tmp = fe_GetTextField(m_notesTxt); + values[AB_LAST].attrib = AB_attribInfo; + if (tmp && strlen(tmp)) + values[AB_LAST].u.string = tmp; + else + values[AB_LAST].u.string = XP_STRDUP(""); + // values[AB_LAST].u.boolValue = XmToggleButtonGetState(m_prefHTMLTog); values[AB_LAST].attrib = AB_attribHTMLMail; diff --git a/mozilla/cmd/xfe/src/ABNameGenTab.h b/mozilla/cmd/xfe/src/ABNameGenTab.h index 2fd172fb4de..3cd638b32b0 100644 --- a/mozilla/cmd/xfe/src/ABNameGenTab.h +++ b/mozilla/cmd/xfe/src/ABNameGenTab.h @@ -53,7 +53,12 @@ public: AB_LAST } GEN_TEXTF; #endif + + static void textFValChgCallback(Widget, XtPointer, XtPointer); + protected: + virtual void textFValChgCB(Widget, XtPointer); + virtual void apply(){}; virtual void getDlgValues(); @@ -68,6 +73,8 @@ private: Widget m_notesTxt; Widget m_prefHTMLTog; + XP_Bool m_userDefined; + }; /* XFE_ABNameGenTabView */ #endif /* _xfe_abnamegentabview_h */ diff --git a/mozilla/cmd/xfe/src/ABNameSecuTab.cpp b/mozilla/cmd/xfe/src/ABNameSecuTab.cpp index aacb28a94e0..dd93d9a848e 100644 --- a/mozilla/cmd/xfe/src/ABNameSecuTab.cpp +++ b/mozilla/cmd/xfe/src/ABNameSecuTab.cpp @@ -20,6 +20,7 @@ Created: Tao Cheng , 12-nov-96 */ +#include "rosetta.h" #include "ABNameSecuTab.h" #include @@ -45,67 +46,7 @@ XFE_ABNameSecuTabView::XFE_ABNameSecuTabView(XFE_Component *top, XFE_View *view): XFE_PropertyTabView(top, view, XFE_AB_NAME_SECURITY_TAB) { - Widget topForm = getBaseWidget(); - - /* m_securityLabel - */ - m_securLabel = XtVaCreateManagedWidget("securLabel", - xmLabelGadgetClass, topForm, - XmNalignment, XmALIGNMENT_BEGINNING, - NULL); - XmString info = XmStringCreateLtoR(XP_GetString(XFE_AB_SECUR_YES), - XmFONTLIST_DEFAULT_TAG); - - XtVaSetValues(m_securLabel, - XmNlabelString, info, - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - XmNtopOffset, 10, - XmNrightOffset, 10, - XmNbottomOffset, 10, - XmNleftOffset, 10, - 0); - - /* Show Certificate button - */ - Arg av[20]; - int ac = 0; - - XtSetArg (av[ac], XmNwidth, 120); ac++; - //XtSetArg (av[ac], XmNrecomputeSize, False); ac++; - m_showCertiBtn = XmCreatePushButton(topForm, - "showSecurBtn", - av, ac); - fe_SetString(m_showCertiBtn, - XmNlabelString, XP_GetString(XFE_AB_SECUR_SHOW)); - - Dimension widthF; - XtVaGetValues(m_securLabel, - XmNwidth, &widthF, - 0); - Dimension widthp; - XtVaGetValues(m_showCertiBtn, - XmNwidth, &widthp, - 0); - - int leftoffset = (widthF-widthp)/2; - XtVaSetValues(m_showCertiBtn, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, leftoffset, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_securLabel, - XmNtopOffset, 50, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - XtManageChild(m_showCertiBtn); - - XtAddCallback(m_showCertiBtn, - XmNactivateCallback, - XFE_ABNameSecuTabView::showCallback, - this); + } XFE_ABNameSecuTabView::~XFE_ABNameSecuTabView() diff --git a/mozilla/cmd/xfe/src/ABSearchDlg.h b/mozilla/cmd/xfe/src/ABSearchDlg.h index 6c162e26b2c..4768de01b60 100644 --- a/mozilla/cmd/xfe/src/ABSearchDlg.h +++ b/mozilla/cmd/xfe/src/ABSearchDlg.h @@ -37,8 +37,8 @@ public: MWContext *context, ABSearchInfo_t *info); - ~XFE_ABSearchDlg(); - + virtual ~XFE_ABSearchDlg(); + void setParams(ABSearchInfo_t *info); virtual void cancel(); diff --git a/mozilla/cmd/xfe/src/ABSearchView.cpp b/mozilla/cmd/xfe/src/ABSearchView.cpp index 578c62bf58c..7d14b96f5b5 100644 --- a/mozilla/cmd/xfe/src/ABSearchView.cpp +++ b/mozilla/cmd/xfe/src/ABSearchView.cpp @@ -292,8 +292,8 @@ XFE_ABSearchView::rebuildOptChildren(Widget popupParent, XmNchildren, &childrenList, XmNnumChildren, &numChildren, NULL); - - for (int i = 0; i < numChildren; i++) { + int i; + for (i = 0; i < numChildren; i++) { /* free user data */ @@ -561,7 +561,8 @@ void XFE_ABSearchView::add1Rule(MSG_SearchAttribute attrib, (ABSearchUIHint_t *) XP_CALLOC(m_nAttribItems, sizeof(ABSearchUIHint_t)); XP_Bool validAttrib = False; - for (int i=0; i < m_nAttribItems; i++) { + int i; + for (i=0; i < m_nAttribItems; i++) { hint[i].m_th = m_nRules; hint[i].m_type = AB_SEARCH_ATTRIB; hint[i].m_menuItem = &(m_attrItems[i]); @@ -583,7 +584,8 @@ void XFE_ABSearchView::add1Rule(MSG_SearchAttribute attrib, if (!validAttrib) { /* correct */ - attrib = (MSG_SearchAttribute) m_attrItems[m_nRules].attrib; + attrib = (MSG_SearchAttribute) + m_attrItems[m_nRules%m_nAttribItems].attrib; }/* if */ m_params[m_nRules].m_attribNval.attribute = attrib; @@ -875,7 +877,8 @@ void XFE_ABSearchView::toggleSearchMode(ABSearchInfo_t *info) sizeof(ABSearchUIHint_t)); /* and, or */ - for (int i=0; i < 2; i++) { + int i; + for (i=0; i < 2; i++) { hint[i].m_th = -1; hint[i].m_type = AB_SEARCH_CONNECTOR; hint[i].m_menuItem = diff --git a/mozilla/cmd/xfe/src/ABSearchView.h b/mozilla/cmd/xfe/src/ABSearchView.h index 9bde68dfa0b..3b65e8211ef 100644 --- a/mozilla/cmd/xfe/src/ABSearchView.h +++ b/mozilla/cmd/xfe/src/ABSearchView.h @@ -84,7 +84,7 @@ public: Widget parent, MWContext *context, ABSearchInfo_t *info); - ~XFE_ABSearchView(); + virtual ~XFE_ABSearchView(); void setParams(ABSearchInfo_t *info); diff --git a/mozilla/cmd/xfe/src/AddrBookFrame.cpp b/mozilla/cmd/xfe/src/AddrBookFrame.cpp index 8557d08d2f1..a77d1fc1b1e 100644 --- a/mozilla/cmd/xfe/src/AddrBookFrame.cpp +++ b/mozilla/cmd/xfe/src/AddrBookFrame.cpp @@ -21,6 +21,7 @@ Revised: Tao Cheng , 01-nov-96 */ +#include "rosetta.h" #include "AddrBookFrame.h" #include "LdapSearchFrame.h" @@ -52,20 +53,55 @@ extern "C" { XP_List* FE_GetDirServers(); }; -MenuSpec XFE_AddrBookFrame::file_menu_spec[] = { - { "newSubmenu", CASCADEBUTTON, - (MenuSpec*)&XFE_Frame::new_menu_spec }, +#if defined(USE_ABCOM) +MenuSpec XFE_AddrBookFrame::new_sub_menu_spec[] = { + { xfeCmdOpenBrowser, PUSHBUTTON }, + { xfeCmdComposeMessage, PUSHBUTTON }, + MENU_PUSHBUTTON(xfeCmdNewBlank), + MENU_SEPARATOR, { xfeCmdAddToAddressBook, PUSHBUTTON }, { xfeCmdABNewList, PUSHBUTTON }, - { xfeCmdImport, PUSHBUTTON }, + { xfeCmdABNewPAB, PUSHBUTTON }, + { xfeCmdABNewLDAPDirectory, PUSHBUTTON }, + { NULL } +}; + +MenuSpec XFE_AddrBookFrame::file_menu_spec[] = { + { "newSubmenu", CASCADEBUTTON, + (MenuSpec*)&new_sub_menu_spec }, MENU_SEPARATOR, + { xfeCmdImport, PUSHBUTTON }, { xfeCmdSaveAs, PUSHBUTTON }, + MENU_SEPARATOR, { xfeCmdABCall, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdClose, PUSHBUTTON }, { xfeCmdExit, PUSHBUTTON }, { NULL } }; +#else +MenuSpec XFE_AddrBookFrame::file_menu_spec[] = { + { "newSubmenu", CASCADEBUTTON, + (MenuSpec*)&XFE_Frame::new_menu_spec }, + { xfeCmdAddToAddressBook, PUSHBUTTON }, + { xfeCmdABNewList, PUSHBUTTON }, +#if defined(USE_ABCOM) + { xfeCmdABNewPAB, PUSHBUTTON }, + { xfeCmdABNewLDAPDirectory, PUSHBUTTON }, +#else + { xfeCmdImport, PUSHBUTTON }, +#endif /* USE_ABCOM */ + MENU_SEPARATOR, + { xfeCmdImport, PUSHBUTTON }, + { xfeCmdSaveAs, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdABCall, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdClose, PUSHBUTTON }, + { xfeCmdExit, PUSHBUTTON }, + { NULL } +}; +#endif /* USE_ABCOM */ MenuSpec XFE_AddrBookFrame::edit_menu_spec[] = { { xfeCmdUndo, PUSHBUTTON }, @@ -78,10 +114,11 @@ MenuSpec XFE_AddrBookFrame::edit_menu_spec[] = { { xfeCmdPaste, PUSHBUTTON }, #endif { xfeCmdABDeleteEntry,PUSHBUTTON }, +#if defined(USE_ABCOM) + { xfeCmdABDeleteAllEntries,PUSHBUTTON }, +#endif /* USE_ABCOM */ { xfeCmdSelectAll, PUSHBUTTON }, MENU_SEPARATOR, - { xfeCmdSearchAddress, PUSHBUTTON }, - MENU_SEPARATOR, { xfeCmdDisplayHTMLDomainsDialog, PUSHBUTTON }, { xfeCmdViewProperties, PUSHBUTTON }, { xfeCmdEditPreferences, PUSHBUTTON }, @@ -141,7 +178,6 @@ ToolbarSpec XFE_AddrBookFrame::toolbar_spec[] = { XFE_TOOLBAR_DELAY_LONG // Popup delay }, - { xfeCmdSearchAddress, PUSHBUTTON, &MNC_Directory_group}, { xfeCmdABCall, PUSHBUTTON, &MNAB_Call_group}, { xfeCmdABDeleteEntry, PUSHBUTTON, &MNTB_Trash_group}, { xfeCmdStopLoading, PUSHBUTTON, &TB_Stop_group }, @@ -195,6 +231,15 @@ XFE_AddrBookFrame::XFE_AddrBookFrame(Widget toplevel, AB_BOOK); m_abView = (XFE_AddrBookView *) view->getEntriesListView(); + /* Attachment + */ + XtVaSetValues(view->getBaseWidget(), + XmNleftAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + NULL); + setView(view); setMenubar(menu_bar_spec); @@ -211,7 +256,7 @@ XFE_AddrBookFrame::XFE_AddrBookFrame(Widget toplevel, m_dashboard->setShowStatusBar(True); m_dashboard->setShowProgressBar(True); // - m_dashboard->setShowSecurityIcon(True); + HG01283 // Configure the toolbox for the first time configureToolbox(); @@ -226,13 +271,20 @@ XP_Bool XFE_AddrBookFrame::handlesCommand(CommandType cmd, void */* calldata */, XFE_CommandInfo* /* info */) { +#if defined(USE_ABCOM) + if (cmd == xfeCmdShowPopup + || cmd == xfeCmdStopLoading + || cmd == xfeCmdDisplayHTMLDomainsDialog + || cmd == xfeCmdEditPreferences + ) + return TRUE; +#else if (cmd == xfeCmdShowPopup || cmd == xfeCmdImport || cmd == xfeCmdSaveAs || cmd == xfeCmdStopLoading || cmd == xfeCmdUndo || cmd == xfeCmdRedo - || cmd == xfeCmdABDeleteEntry || cmd == xfeCmdFindInObject || cmd == xfeCmdFindAgain || cmd == xfeCmdSearchAddress @@ -247,13 +299,17 @@ XP_Bool XFE_AddrBookFrame::handlesCommand(CommandType cmd, || cmd == xfeCmdSortDescending || cmd == xfeCmdAddToAddressBook || cmd == xfeCmdABNewList + || cmd == xfeCmdABNewPAB + || cmd == xfeCmdABNewLDAPDirectory || cmd == xfeCmdViewProperties || cmd == xfeCmdDisplayHTMLDomainsDialog || cmd == xfeCmdABEditEntry || cmd == xfeCmdABDeleteEntry + || cmd == xfeCmdABDeleteAllEntries || cmd == xfeCmdABCall || cmd == xfeCmdABvCard) return TRUE; +#endif /* USE_ABCOM */ else /* Default */ @@ -291,7 +347,6 @@ XFE_AddrBookFrame::isCommandEnabled(CommandType cmd, void *, XFE_CommandInfo*) || cmd == xfeCmdOpenNewsgroups || cmd == xfeCmdOpenFolders - || cmd == xfeCmdSearchAddress || cmd == xfeCmdEditPreferences || cmd == xfeCmdOpenBookmarks @@ -301,7 +356,13 @@ XFE_AddrBookFrame::isCommandEnabled(CommandType cmd, void *, XFE_CommandInfo*) #endif /* JAVA */ || cmd == xfeCmdSelectAll + +#if !defined(USE_ABCOM) + || cmd == xfeCmdSearchAddress || cmd == xfeCmdABvCard +#else + || cmd == xfeCmdABvCard +#endif /* USE_ABCOM */ || cmd == xfeCmdDisplayHTMLDomainsDialog) { return TRUE; @@ -335,11 +396,9 @@ char *XFE_AddrBookFrame::getTipString(CommandType /* cmd */) void XFE_AddrBookFrame::doCommand(CommandType cmd, void *calldata, XFE_CommandInfo* info) { +#if defined(USE_ABCOM) /* first we handle the commands we know about. */ - - /* file_menu_spec xfeCmdClose - */ if (cmd == xfeCmdComposeMessage) composeMessage(); else if (cmd == xfeCmdStopLoading) @@ -356,8 +415,54 @@ void XFE_AddrBookFrame::doCommand(CommandType cmd, (fe_globalPrefs.send_html_msg == True); composeMessage(); } - else if (cmd == xfeCmdImport) - import(); + else if (cmd == xfeCmdShowPopup) { + // Finish up the popup + XEvent *event = info->event; + + if (m_popup) + delete m_popup; + + m_popup = + new XFE_PopupMenu("popup",(XFE_Frame *) this, + XfeAncestorFindApplicationShell(getBaseWidget())); + m_popup->addMenuSpec(frame_popup_spec); + m_popup->position (event); + m_popup->show(); + }/* else if */ + else if (cmd == xfeCmdEditPreferences) + fe_showMailNewsPreferences(this, (MWContext*)m_view->getContext()); + + else if (cmd == xfeCmdDisplayHTMLDomainsDialog) + + MSG_DisplayHTMLDomainsDialog((MWContext*)m_view->getContext()); + /* ToolBar + */ + else + /* Default + */ + XFE_Frame::doCommand(cmd, calldata, info); +#else + /* first we handle the commands we know about. + */ + if (cmd == xfeCmdComposeMessage) + composeMessage(); + else if (cmd == xfeCmdStopLoading) + m_abView->stopSearch(); + else if (cmd == xfeCmdComposeMessageHTML) + { + CONTEXT_DATA(m_context)->stealth_cmd = + (fe_globalPrefs.send_html_msg == False); + composeMessage(); + } + else if ( cmd == xfeCmdComposeMessagePlain) + { + CONTEXT_DATA(m_context)->stealth_cmd = + (fe_globalPrefs.send_html_msg == True); + composeMessage(); + } + else if (cmd == xfeCmdImport) { + import(); + } else if (cmd == xfeCmdSaveAs) saveAs(); /* edit_menu_spec @@ -368,6 +473,8 @@ void XFE_AddrBookFrame::doCommand(CommandType cmd, redo(); else if (cmd == xfeCmdABDeleteEntry) abDelete(); + else if (cmd == xfeCmdABDeleteAllEntries) + abDeleteAllEntries(); else if (cmd == xfeCmdFindInObject) printf("\n %s", xfeCmdComposeMessage); else if (cmd == xfeCmdFindAgain) @@ -380,26 +487,6 @@ void XFE_AddrBookFrame::doCommand(CommandType cmd, /* view_menu_spec */ -#if defined(USE_ABCOM) - else if (cmd == xfeCmdABByType) { - m_abView->setSortType(AB_attribEntryType); - } - else if (cmd == xfeCmdABByName) { - m_abView->setSortType(AB_attribFullName); - } - else if (cmd == xfeCmdABByEmailAddress) { - m_abView->setSortType(AB_attribEmailAddress); - } - else if (cmd == xfeCmdABByCompany) { - m_abView->setSortType(AB_attribCompanyName); - } - else if (cmd == xfeCmdABByLocality) { - m_abView->setSortType(AB_attribLocality); - } - else if (cmd == xfeCmdABByNickName) { - m_abView->setSortType(AB_attribNickName); - } -#else else if (cmd == xfeCmdABByType) { m_abView->setSortType(AB_SortByTypeCmd); } @@ -418,7 +505,6 @@ void XFE_AddrBookFrame::doCommand(CommandType cmd, else if (cmd == xfeCmdABByNickName) { m_abView->setSortType(AB_SortByNickname); } -#endif /* USE_ABCOM */ else if (cmd == xfeCmdSortAscending) { m_abView->setAscending(True); } @@ -472,6 +558,7 @@ void XFE_AddrBookFrame::doCommand(CommandType cmd, /* Default */ XFE_Frame::doCommand(cmd, calldata, info); +#endif /* USE_ABCOM */ }/* XFE_AddrBookFrame::doCommand() */ @@ -538,7 +625,11 @@ void XFE_AddrBookFrame::redo() { } void XFE_AddrBookFrame::abDelete() { - m_abView->delUser(); + m_abView->abDelete(); +} + +void XFE_AddrBookFrame::abDeleteAllEntries() { + m_abView->abDeleteAllEntries(); } void XFE_AddrBookFrame::addToAddressBook() { diff --git a/mozilla/cmd/xfe/src/AddrBookFrame.h b/mozilla/cmd/xfe/src/AddrBookFrame.h index 443ab5ed91a..81c6312d55e 100644 --- a/mozilla/cmd/xfe/src/AddrBookFrame.h +++ b/mozilla/cmd/xfe/src/AddrBookFrame.h @@ -69,6 +69,7 @@ protected: virtual void undo(); virtual void redo(); virtual void abDelete(); + virtual void abDeleteAllEntries(); virtual void addToAddressBook(); virtual void newList(); @@ -84,7 +85,9 @@ private: */ static MenuSpec menu_bar_spec[]; static ToolbarSpec toolbar_spec[]; - +#if defined(USE_ABCOM) + static MenuSpec new_sub_menu_spec[]; +#endif /* USE_ABCOM */ static MenuSpec file_menu_spec[]; static MenuSpec edit_menu_spec[]; static MenuSpec view_menu_spec[]; diff --git a/mozilla/cmd/xfe/src/AddrBookView.cpp b/mozilla/cmd/xfe/src/AddrBookView.cpp index cb0b2f9a183..11edab74e44 100644 --- a/mozilla/cmd/xfe/src/AddrBookView.cpp +++ b/mozilla/cmd/xfe/src/AddrBookView.cpp @@ -27,9 +27,16 @@ #include "Xfe/Xfe.h" #include "xpassert.h" +#include "felocale.h" /* Bug Fixing by bstell on r.1.77.6.3 */ extern char *fe_conference_path; +#if defined(DEBUG_tao_) +#define TRACE(str) printf("%s,%s", __FILE__, __LINE__) +#else +#define TRACE(str) +#endif + extern "C" { #include "xfe.h" #include "outline.h" @@ -44,6 +51,9 @@ extern "C" void fe_showABCardPropertyDlg(Widget parent, MWContext *context, ABID entry, XP_Bool newuser); +extern "C" void fe_showConference(Widget w, char *email, + short use, char *coolAddr); + #include "xpgetstr.h" extern int XFE_AB_HEADER_NAME; @@ -61,12 +71,6 @@ extern int XFE_SEND_MSG_TO; #define ADDRESS_OUTLINER_GEOMETRY_PREF "addressbook.outliner_geometry" -#if !defined(EMPTY_STRVAL) -#define EMPTY_STRVAL(value) \ - (!(value) || !((value)->u.string) || !XP_STRLEN(((value)->u.string))) - -#endif - // constructor XFE_AddrBookView::XFE_AddrBookView(XFE_Component *toplevel_component, Widget parent, @@ -123,8 +127,8 @@ XFE_AddrBookView::XFE_AddrBookView(XFE_Component *toplevel_component, XFE_AddrBookView::~XFE_AddrBookView() { } -// +// // tooltips and doc string char *XFE_AddrBookView::getDocString(CommandType cmd) { @@ -225,332 +229,6 @@ Boolean XFE_AddrBookView::isCommandSelected(CommandType cmd, return False; } -/* Methods for the outlinable interface. - */ -char *XFE_AddrBookView::getCellTipString(int row, int column) -{ - char *tmp = 0; - if (row < 0) { - /* header - */ - tmp = getColumnHeaderText(column); - }/* if */ - else { - ABID orgID = m_entryID; - - /* content - */ -#if defined(USE_ABCOM) - int error = AB_GetABIDForIndex(m_pane, - (MSG_ViewIndex) row, - &m_entryID); -#else - m_entryID = AB_GetEntryIDAt((AddressPane *) m_abPane, (uint32) row); -#endif /* USE_ABCOM */ - tmp = getColumnText(column); - - /* reset - */ - m_entryID = orgID; - }/* else */ - - if (tmp && - (!m_outliner->isColTextFit(tmp, row, column))) - return tmp; - - return NULL; -} - -char *XFE_AddrBookView::getCellDocString(int /* row */, int /* column */) -{ - return NULL; -} - -char* -XFE_AddrBookView::getColumnName(int column) -{ - switch (column) { - case OUTLINER_COLUMN_TYPE: - return XP_GetString(XFE_AB_HEADER_NAME); - case OUTLINER_COLUMN_NAME: - return XP_GetString(XFE_AB_HEADER_NAME); - case OUTLINER_COLUMN_EMAIL: - return XP_GetString(XFE_AB_HEADER_EMAIL); - case OUTLINER_COLUMN_PHONE: - return XP_GetString(XFE_AB_HEADER_PHONE); - case OUTLINER_COLUMN_NICKNAME: - return XP_GetString(XFE_AB_HEADER_NICKNAME); - case OUTLINER_COLUMN_COMPANY: - return XP_GetString(XFE_AB_HEADER_COMPANY); - case OUTLINER_COLUMN_LOCALITY: - return XP_GetString(XFE_AB_HEADER_LOCALITY); - default: - XP_ASSERT(0); - return 0; - } -} - -EOutlinerTextStyle XFE_AddrBookView::getColumnHeaderStyle(int column) -{ - ABID sortType = 0; - switch (column) { - case OUTLINER_COLUMN_TYPE: - sortType = ABTypeEntry; - break; - - case OUTLINER_COLUMN_NAME: - sortType = ABFullName; - break; - - case OUTLINER_COLUMN_EMAIL: - sortType = ABEmailAddress; - break; - - case OUTLINER_COLUMN_NICKNAME: - sortType = ABNickname; - break; - - case OUTLINER_COLUMN_COMPANY: - sortType = ABCompany; - break; - - case OUTLINER_COLUMN_LOCALITY: - sortType = ABLocality; - break; - }/* switch */ - - if (sortType == getSortType()) - return OUTLINER_Bold; - else - return OUTLINER_Default; -} - -/* Returns the text and/or icon to display at the top of the column. - */ -char* -XFE_AddrBookView::getColumnHeaderText(int column) -{ - - char *tmp = 0; - switch (column) { - case OUTLINER_COLUMN_TYPE: - tmp = XP_STRDUP(" "); - break; - - case OUTLINER_COLUMN_NAME: - tmp = XP_GetString(XFE_AB_HEADER_NAME); - break; - - case OUTLINER_COLUMN_NICKNAME: - tmp = XP_GetString(XFE_AB_HEADER_NICKNAME); - break; - - case OUTLINER_COLUMN_EMAIL: - tmp = XP_GetString(XFE_AB_HEADER_EMAIL); - break; - - case OUTLINER_COLUMN_PHONE: - tmp = XP_GetString(XFE_AB_HEADER_PHONE); - break; - - case OUTLINER_COLUMN_COMPANY: - tmp = XP_GetString(XFE_AB_HEADER_COMPANY); - break; - - case OUTLINER_COLUMN_LOCALITY: - tmp = XP_GetString(XFE_AB_HEADER_LOCALITY); - break; - - }/* switch () */ - - return tmp; -} - -char* -XFE_AddrBookView::getColumnText(int column) -{ - static char a_line[AB_MAX_STRLEN]; - a_line[0] = '\0'; -#if defined(USE_ABCOM) - AB_AttributeValue *value = 0; - AB_AttribID attrib = AB_attribEntryType; - XP_Bool isPhone = False; - switch (column) { - case OUTLINER_COLUMN_TYPE: - break; - - case OUTLINER_COLUMN_NAME: - attrib = AB_attribFullName; // shall be AB_attribDisplayName; - break; - - case OUTLINER_COLUMN_NICKNAME: - attrib = AB_attribNickName; - break; - - case OUTLINER_COLUMN_EMAIL: - attrib = AB_attribEmailAddress; - break; - - case OUTLINER_COLUMN_PHONE: - isPhone = True; - attrib = AB_attribWorkPhone; - break; - - case OUTLINER_COLUMN_COMPANY: - attrib = AB_attribCompanyName; - break; - - case OUTLINER_COLUMN_LOCALITY: - attrib = AB_attribLocality; - break; - - }/* switch () */ - if (attrib != AB_attribEntryType) { - int error = AB_GetEntryAttribute(m_containerInfo, m_entryID, - attrib, &value); - - if (isPhone && - EMPTY_STRVAL(value)) { - error = AB_GetEntryAttribute(m_containerInfo, m_entryID, - AB_attribHomePhone, &value); - }/* if */ - XP_SAFE_SPRINTF(a_line, sizeof(a_line), - "%s", - EMPTY_STRVAL(value)?"":value->u.string); - - AB_FreeEntryAttributeValue(value); - }/* if */ -#else - switch (column) { - case OUTLINER_COLUMN_TYPE: - break; - - case OUTLINER_COLUMN_NAME: - AB_GetFullName(m_dir, m_AddrBook, m_entryID, a_line); - break; - - case OUTLINER_COLUMN_NICKNAME: - AB_GetNickname(m_dir, m_AddrBook, m_entryID, a_line); - break; - - case OUTLINER_COLUMN_EMAIL: - AB_GetEmailAddress(m_dir, m_AddrBook, m_entryID, a_line); - break; - - case OUTLINER_COLUMN_PHONE: - AB_GetWorkPhone(m_dir, m_AddrBook, m_entryID, a_line); - if (!a_line || !XP_STRLEN(a_line)) { - a_line[0] = '\0'; - AB_GetHomePhone(m_dir, m_AddrBook, m_entryID, a_line); - }/* if */ - break; - - case OUTLINER_COLUMN_COMPANY: - AB_GetCompanyName(m_dir, m_AddrBook, m_entryID, a_line); - break; - - case OUTLINER_COLUMN_LOCALITY: - AB_GetLocality(m_dir, m_AddrBook, m_entryID, a_line); - break; - - }/* switch () */ -#endif /* !USE_ABCOM */ - return a_line; -} - -fe_icon* -XFE_AddrBookView::getColumnIcon(int column) -{ - fe_icon *myIcon = 0; - switch (column) { - case OUTLINER_COLUMN_TYPE: - { -#if defined(USE_ABCOM) - AB_EntryType type = getType(m_containerInfo, m_entryID); - if (type == AB_Person) - myIcon = &m_personIcon; /* shall call make/initialize icons */ - else if (type == AB_MailingList) - myIcon = &m_listIcon; -#else - ABID type; - AB_GetType(m_dir, m_AddrBook, m_entryID, &type); - if (type == ABTypePerson) - myIcon = &m_personIcon; /* shall call make/initialize icons */ - else if (type == ABTypeList) - myIcon = &m_listIcon; -#endif /* USE_ABCOM */ - } - break; - }/* switch () */ - return myIcon; -} - -void XFE_AddrBookView::clickHeader(const OutlineButtonFuncData *data) -{ - int column = data->column; - int invalid = True; -#if defined(USE_ABCOM) - switch (column) { - case OUTLINER_COLUMN_TYPE: - setSortType(AB_attribEntryType); - break; - - case OUTLINER_COLUMN_NAME: - setSortType(AB_attribFullName); - break; - - case OUTLINER_COLUMN_NICKNAME: - setSortType(AB_attribNickName); - break; - - case OUTLINER_COLUMN_EMAIL: - setSortType(AB_attribEmailAddress); - break; - - case OUTLINER_COLUMN_COMPANY: - setSortType(AB_attribCompanyName); - break; - - case OUTLINER_COLUMN_LOCALITY: - setSortType(AB_attribLocality); - break; - default: - invalid = False; - }/* switch() */ -#else - switch (column) { - case OUTLINER_COLUMN_TYPE: - setSortType(AB_SortByTypeCmd); - break; - - case OUTLINER_COLUMN_NAME: - setSortType(AB_SortByFullNameCmd); - break; - - case OUTLINER_COLUMN_NICKNAME: - setSortType(AB_SortByNickname); - break; - - case OUTLINER_COLUMN_EMAIL: - setSortType(AB_SortByEmailAddress); - break; - - case OUTLINER_COLUMN_COMPANY: - setSortType(AB_SortByCompanyName); - break; - - case OUTLINER_COLUMN_LOCALITY: - setSortType(AB_SortByLocality); - break; - default: - invalid = False; - }/* switch() */ -#endif /* USE_ABCOM */ - - if (invalid) - m_outliner->invalidate(); -} - void XFE_AddrBookView::doubleClickBody(const OutlineButtonFuncData *data) { #if defined(USE_ABCOM) @@ -567,7 +245,7 @@ void XFE_AddrBookView::doubleClickBody(const OutlineButtonFuncData *data) AB_GetType(m_dir, m_AddrBook, entry, &type); if (type == ABTypePerson) - /* Send tothis user + /* Send to this user */ popupUserPropertyWindow(entry, False, False); else @@ -577,7 +255,6 @@ void XFE_AddrBookView::doubleClickBody(const OutlineButtonFuncData *data) #endif /* USE_ABCOM */ } - void XFE_AddrBookView::abCall() { int count = 0; @@ -686,17 +363,6 @@ void XFE_AddrBookView::abVCard() } -extern "C" void fe_AB_AllConnectionsComplete(MWContext *context) -{ - ABPane* pABookPane = context->fe.data->abdata->abpane; - if (pABookPane) { - AB_FinishSearch(pABookPane, context); - XFE_MNListView *list_view = - (XFE_MNListView*) MSG_GetFEData((MSG_Pane *)pABookPane); - ((XFE_ABListSearchView *)list_view)->stopSearch(); - }/* if */ -} - // extern "C" void fe_showConference(Widget w, char *email, short use, char *coolAddr) diff --git a/mozilla/cmd/xfe/src/AddrBookView.h b/mozilla/cmd/xfe/src/AddrBookView.h index 4218ba45c5a..85045c1a624 100644 --- a/mozilla/cmd/xfe/src/AddrBookView.h +++ b/mozilla/cmd/xfe/src/AddrBookView.h @@ -41,52 +41,16 @@ public: XFE_View *parent_view, MWContext *context, XP_List *directories); - ~XFE_AddrBookView(); + virtual ~XFE_AddrBookView(); void abCall(); void abVCard(); - // - // The Outlinable interface. - // - virtual EOutlinerTextStyle - getColumnHeaderStyle(int column); - virtual char *getColumnName(int column); - virtual char *getColumnHeaderText(int column); - virtual char *getColumnText(int column); - virtual fe_icon *getColumnIcon(int column); - virtual void clickHeader(const OutlineButtonFuncData *data); - virtual void doubleClickBody(const OutlineButtonFuncData *data); - - // Get tooltipString & docString; - // returned string shall be freed by the callee - // row < 0 indicates heading row; otherwise it is a content row - // (starting from 0) - // - virtual char *getCellTipString(int /* row */, int /* column */); - virtual char *getCellDocString(int /* row */, int /* column */); - // tooltips and doc string virtual char *getDocString(CommandType cmd); + virtual void doubleClickBody(const OutlineButtonFuncData *data); - // - // - // - - // columns for the Outliner - enum {OUTLINER_COLUMN_TYPE = 0, - OUTLINER_COLUMN_NAME, -#if 0 - OUTLINER_COLUMN_CERTIFICATE, -#endif - OUTLINER_COLUMN_EMAIL, - OUTLINER_COLUMN_COMPANY, - OUTLINER_COLUMN_PHONE, - OUTLINER_COLUMN_NICKNAME, - OUTLINER_COLUMN_LOCALITY, - OUTLINER_COLUMN_LAST - }; protected: /* Address Book specific */ diff --git a/mozilla/cmd/xfe/src/AddressFolderView.cpp b/mozilla/cmd/xfe/src/AddressFolderView.cpp index 6f1a9a3513c..7eb10d04df4 100644 --- a/mozilla/cmd/xfe/src/AddressFolderView.cpp +++ b/mozilla/cmd/xfe/src/AddressFolderView.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "AddressFolderView.h" #include "AddressOutliner.h" #include "ABListSearchView.h" @@ -67,7 +67,12 @@ static MSG_HEADER_SET standard_header_set[] = { #define TOTAL_HEADERS (sizeof(standard_header_set)/sizeof(MSG_HEADER_SET)) extern "C" char *fe_StringTrim (char *string); -extern "C" char * xfe_ExpandName(char * pString, int* iconType, short* security); + +extern "C" char* xfe_ExpandForNameCompletion(char *pString, + ABook *pAddrBook, + DIR_Server *pDirServer); +extern "C" char * xfe_ExpandName(char *pString, int* iconType, short* xxx, + ABook *pAddrBook, DIR_Server *pDirServer); extern "C" { @@ -92,7 +97,7 @@ const int XFE_AddressFolderView::ADDRESS_OUTLINER_COLUMN_ICON = 2; const int XFE_AddressFolderView::ADDRESS_OUTLINER_COLUMN_RECEIPIENT= 3; #ifdef HAVE_ADDRESS_SECURITY_COLUMN -const int XFE_AddressFolderView::ADDRESS_OUTLINER_COLUMN_SECURITY = 4; +HG98269 #endif const int XFE_AddressFolderView::ADDRESS_ICON_PERSON = 0; @@ -105,7 +110,7 @@ fe_icon XFE_AddressFolderView::personIcon = { 0 }; fe_icon XFE_AddressFolderView::listIcon = { 0 }; fe_icon XFE_AddressFolderView::newsIcon = { 0 }; -fe_icon XFE_AddressFolderView::securityIcon = { 0 }; +HG91001 typedef enum { @@ -138,6 +143,14 @@ XFE_AddressFolderView::XFE_AddressFolderView( m_clearAddressee = True; + // get the list of directory servers & address books + XP_List *pDirectories=FE_GetDirServers(); + XP_ASSERT(pDirectories); + + DIR_GetComposeNameCompletionAddressBook(pDirectories, &m_pCompleteServer); + + m_pAddrBook = fe_GetABook(0); + setupAddressHeadings(); } @@ -155,7 +168,7 @@ XFE_AddressFolderView::handlesCommand(CommandType command, if (command == xfeCmdGetNewMessages || command == xfeCmdAddNewsgroup || command == xfeCmdDelete - || command == xfeCmdViewSecurity + HG92179 || command == xfeCmdStopLoading) return True; @@ -381,8 +394,7 @@ XFE_AddressFolderView::getColumnName(int column) case ADDRESS_OUTLINER_COLUMN_ICON: return "Icon"; #ifdef HAVE_ADDRESS_SECURITY_COLUMN - case ADDRESS_OUTLINER_COLUMN_SECURITY: - return "Security"; + HG92769 #endif case ADDRESS_OUTLINER_COLUMN_RECEIPIENT: return "Receipient"; @@ -404,8 +416,7 @@ XFE_AddressFolderView::getColumnHeaderText(int column) case ADDRESS_OUTLINER_COLUMN_ICON: return ""; #ifdef HAVE_ADDRESS_SECURITY_COLUMN - case ADDRESS_OUTLINER_COLUMN_SECURITY: - return ""; + HG98268 #endif case ADDRESS_OUTLINER_COLUMN_RECEIPIENT: return "Receipient"; @@ -624,7 +635,7 @@ XFE_AddressFolderView::setData(int line, char *recipient) if ( recipient && strlen(recipient)) { - expandedStr = changedItem(recipient, &iconType, &m_fieldData->security); + HG82688 if ( strcmp(m_fieldData->type, XFE_AddressFolderView::NEWSGROUP) ) // If it's newsgroup, then, don't change it's icon m_fieldData->icon = iconType; @@ -655,8 +666,6 @@ XFE_AddressFolderView::setData(int line, char *recipient) return m_fieldData->type; } -// in AddressOutliner.cpp: -extern "C" char* xfe_ExpandForNameCompletion(char*); // We no longer free the textstr here int @@ -671,7 +680,11 @@ XFE_AddressFolderView::setReceipient(int line, char *textstr) // Try completion first; MSG_ParseRFC822Addresses() may get the count // wrong, especially when completing firstname_lastname w/spaces. - char* completestr = xfe_ExpandForNameCompletion(textstr); +#if defined(DEBUG_tao) + printf("\nXFE_AddressFolderView::setReceipient,%d=%s\n", line, textstr); +#endif + char* completestr = xfe_ExpandForNameCompletion(textstr, m_pAddrBook, + m_pCompleteServer); if (completestr) { setData(line, completestr); @@ -855,12 +868,7 @@ XFE_AddressFolderView::getColumnIcon(int column) } break; #ifdef HAVE_ADDRESS_SECURITY_COLUMN - case ADDRESS_OUTLINER_COLUMN_SECURITY: - if (m_fieldData->security != 0) - return &securityIcon; - else - return 0; - break; + HG32179 #endif } return 0; @@ -956,18 +964,7 @@ XFE_AddressFolderView::setupIcons() MN_Newsgroup.mask_bits, FALSE); - // Security - fe_NewMakeIcon(getToplevel()->getBaseWidget(), - BlackPixelOfScreen(XtScreen(base)), // umm. fix me - bg_pixel, - &securityIcon, - NULL, - MN_CertIndicator.width, - MN_CertIndicator.height, - MN_CertIndicator.mono_bits, - MN_CertIndicator.color_bits, - MN_CertIndicator.mask_bits, - FALSE); + HG82687 } } @@ -1030,7 +1027,7 @@ XFE_AddressFolderView::createWidgets(Widget parent_widget) #ifdef HAVE_ADDRESS_SECURITY_COLUMN // Security thing, didn't make 4.0 - m_outliner->setColumnResizable(ADDRESS_OUTLINER_COLUMN_SECURITY, False); + HG78277 #endif gridW= ( (XFE_AddressOutliner*)m_outliner)->getBaseWidget(); @@ -1209,29 +1206,32 @@ void XFE_AddressFolderView::updateHeaderInfo ( void ) // This method should be called from Activate Callback char * XFE_AddressFolderView::changedItem(char *pString, int* iconType, - short* securityp) + short* xxx) { - return xfe_ExpandName(pString, iconType, securityp); +#if defined(DEBUG_tao) + printf("\nXFE_AddressFolderView::changedItem,%s\n",pString?pString:""); +#endif + return xfe_ExpandName(pString, iconType, xxx, + m_pAddrBook, m_pCompleteServer); } //----------- Address Book stuff here ------------ -extern "C" char * xfe_ExpandName(char * pString, int* iconID, short* security) +extern "C" char * xfe_ExpandName(char * pString, int* iconID, short* xxx, + ABook *pAddrBook, DIR_Server *pDirServer) { ABID entryID; ABID field; char * fullname; - ABook *pAddrBook; - XP_List *pDirectories = FE_GetDirServers(); ABID type; #if defined(DEBUG_tao) printf("\n xfe_ExpandName"); #endif - DIR_Server* pDirServer = NULL; - pAddrBook = fe_GetABook(0); - DIR_GetComposeNameCompletionAddressBook(pDirectories, &pDirServer); + + XP_ASSERT(pAddrBook); + XP_ASSERT(pDirServer); AB_GetIDForNameCompletion(pAddrBook, pDirServer, &entryID, @@ -1250,11 +1250,12 @@ extern "C" char * xfe_ExpandName(char * pString, int* iconID, short* security) *iconID = XFE_AddressFolderView::ADDRESS_ICON_LIST; } - AB_GetSecurity(pDirServer, pAddrBook, entryID, security); + HG91268 AB_GetExpandedName( - (DIR_Server*)XP_ListGetObjectNum(pDirectories,1), + pDirServer, pAddrBook, entryID, &fullname); + if (fullname) return fullname; } return NULL; @@ -1481,13 +1482,48 @@ XFE_AddressFolderView::processAddressBookDrop(XFE_Outliner *outliner, int i; for (i=0; itype=type; item->status=fieldStatus; +#if !defined(USE_ABCOM) item->dir=abDir; item->id=entry; item->emailAddr=XP_STRDUP(email); +#endif /* USE_ABCOM */ item->dplyStr=expName; itemList[numItems++]=item; diff --git a/mozilla/cmd/xfe/src/AddressFolderView.h b/mozilla/cmd/xfe/src/AddressFolderView.h index 95bbc7d90c6..39d90cce649 100644 --- a/mozilla/cmd/xfe/src/AddressFolderView.h +++ b/mozilla/cmd/xfe/src/AddressFolderView.h @@ -25,6 +25,7 @@ #ifndef _xfe_addressfolderview_h #define _xfe_addressfolderview_h +#include "rosetta.h" #include "MNListView.h" #include "Addressable.h" #include "Outliner.h" @@ -116,7 +117,7 @@ public: void insertNewDataAfter(int line); Boolean hasDataAt(int line); - char *changedItem(char *pString, int* iconType, short* security); + char *changedItem(char *pString, int* iconType, short* xxx); // Return actual data count from the receipient data list int getTotalData(); @@ -128,7 +129,7 @@ public: static const int ADDRESS_OUTLINER_COLUMN_TYPE; static const int ADDRESS_OUTLINER_COLUMN_ICON; #ifdef HAVE_ADDRESS_SECURITY_COLUMN - static const int ADDRESS_OUTLINER_COLUMN_SECURITY; + HG21817 #endif static const int ADDRESS_OUTLINER_COLUMN_RECEIPIENT; @@ -159,6 +160,9 @@ public: void processLDAPDrop(fe_dnd_Source*); private: + ABook *m_pAddrBook; + DIR_Server *m_pCompleteServer; + XP_Bool m_clearAddressee; // icons for the outliner @@ -167,7 +171,7 @@ private: static fe_icon listIcon; static fe_icon newsIcon; - static fe_icon securityIcon; + HG81761 const char *setData(int line, char *receipient); // These member data may not need to be here ?? diff --git a/mozilla/cmd/xfe/src/AddressOutliner.cpp b/mozilla/cmd/xfe/src/AddressOutliner.cpp index c68ca04157c..6af5fdefb13 100644 --- a/mozilla/cmd/xfe/src/AddressOutliner.cpp +++ b/mozilla/cmd/xfe/src/AddressOutliner.cpp @@ -23,7 +23,6 @@ AddressOutliner.cpp -- Object wrapper around outline widget hack. #include "AddressOutliner.h" -#include "addrbook.h" #include "xp_core.h" #include "ComposeView.h" @@ -31,6 +30,10 @@ AddressOutliner.cpp -- Object wrapper around outline widget hack. #include "AddressFolderView.h" #include "PopupMenu.h" +#if defined(USE_ABCOM) +#include "Frame.h" +#endif /* USE_ABCOM */ + #include "xfe.h" #include @@ -51,8 +54,6 @@ extern MSG_HEADER_SET MSG_HeaderValue( int pos ); extern "C" { -#include "addrbk.h" - XP_List* FE_GetDirServers(); ABook* fe_GetABook(MWContext *context); @@ -75,8 +76,22 @@ static void FieldTraverse( Cardinal *nparam); } -extern "C" char * xfe_ExpandForNameCompletion(char * pString); -extern "C" char * xfe_ExpandName(char *pString); +extern "C" char* xfe_ExpandForNameCompletion(char *pString, + ABook *pAddrBook, + DIR_Server *pDirServer); + +#if defined(USE_ABCOM) +/* C API + */ +extern "C" XFE_ABComplPickerDlg* +fe_showComplPickerDlg(Widget toplevel, + MWContext *context, + MSG_Pane *pane, + MWContext *pickerContext, + NCPickerExitFunc func, + void *callData); + +#endif /* USE_ABCOM */ const char *XFE_AddressOutliner::textFocusIn = "XFE_AddressOutliner::textFocusIn"; const char *XFE_AddressOutliner::typeFocusIn = "XFE_AddressOutliner::typeFocusIn"; @@ -121,6 +136,27 @@ XFE_AddressOutliner::XFE_AddressOutliner( m_inPopup = False; m_lastFocus = NULL; /* Obselete ?! - dh */ m_textTimer = 0; +#if defined(USE_ABCOM) + m_pickerPane = 0; + XFE_Frame *f = (XFE_Frame *) parent_view->getToplevel(); + XP_ASSERT(f); + m_pickerContext = + XFE_ABComplPickerDlg::cloneCntxtNcreatePane(f->getContext(), + &m_pickerPane); + m_pickerDlg = 0; + + m_rtnIsPicker = False; +#endif /* USE_ABCOM */ + +#if !defined(USE_ABCOM) + // get the list of directory servers & address books + XP_List *pDirectories=FE_GetDirServers(); + XP_ASSERT(pDirectories); + + DIR_GetComposeNameCompletionAddressBook(pDirectories, &m_pCompleteServer); + + m_pAddrBook = fe_GetABook(0); +#endif /* USE_ABCOM */ // Add actions XtAppAddActions( fe_XtAppContext, actions, 3); @@ -241,6 +277,17 @@ XFE_AddressOutliner::XFE_AddressOutliner() // Destructor XFE_AddressOutliner::~XFE_AddressOutliner() { +#if defined(USE_ABCOM) + if (m_pickerPane) { + MSG_SetFEData(m_pickerPane, 0); + AB_ClosePane(m_pickerPane); + }/* if */ + if (m_pickerDlg) { + delete m_pickerDlg; + m_pickerDlg = 0; + }/* if */ +#endif /* USE_ABCOM */ + } // Install local translations -- this needs to be after realize time, @@ -544,6 +591,10 @@ XFE_AddressOutliner::MapText(int row) void XFE_AddressOutliner::PlaceText(int row, int col, Boolean doUpdate) { +#if defined(DEBUG_tao) + printf("\nXFE_AddressOutliner::PlaceText:row=%d, col=%d, update=%d,m_focusRow=%d, m_focusCol=%d\n", + row, col, doUpdate, m_focusRow, m_focusCol); +#endif XRectangle rect; Boolean removed = False; @@ -658,6 +709,10 @@ XFE_AddressOutliner::textLosingFocus(XtPointer /* callData*/ ) void XFE_AddressOutliner::textactivate(XtPointer /* callData */) { +#if defined(DEBUG_tao) && defined(USE_ABCOM) + printf("\nXFE_AddressOutliner::textactivate, m_rtnIsPicker=%d\n", + m_rtnIsPicker); +#endif /* DEBUG_tao */ int oldrow = m_focusRow; int count = getTotalLines(); @@ -665,6 +720,18 @@ XFE_AddressOutliner::textactivate(XtPointer /* callData */) if (XmTextFieldGetInsertionPosition(m_textWidget) <= 0) return; +#if defined(USE_ABCOM) + if (m_rtnIsPicker) { + /* pop up picker + */ + if (m_pickerDlg) { + m_pickerDlg->show(); + m_pickerDlg->selectItem(1); + }/* if */ + return; + }/* if m_rtnIsPicker */ +#endif + //textLosingFocus(0); updateAddresses(); @@ -775,6 +842,33 @@ XFE_AddressOutliner::processInput() // also need to skip past whitespace else curName = textStr; + +#if defined(USE_ABCOM) + m_lastPos = lastPos; + m_curName = curName; + m_textStr = textStr; + + if (!m_pickerDlg) { + XFE_Frame *f = (XFE_Frame *) m_parentView->getToplevel(); + XP_ASSERT(f); + m_pickerDlg = + fe_showComplPickerDlg(f->getBaseWidget(), + f->getContext(), + m_pickerPane, + m_pickerContext, + &nameCPickerExitFunc, + this); + }/* if */ + + int error = + AB_NameCompletionSearch(m_pickerPane, + (const char *) curName, + &nameCompletionExitFunc, +#ifdef FE_IMPLEMENTS_VISIBLE_NC + True, // for now +#endif + (void *) this); +#else char* completeName = nameCompletion(curName); if (completeName) { @@ -801,8 +895,119 @@ XFE_AddressOutliner::processInput() XP_FREE(buf); } XtFree(textStr); +#endif /* USE_ABCOM */ } +#if defined(USE_ABCOM) +void +XFE_AddressOutliner::nameCPickerExitFunc(void *clientData, void *callData) +{ + XFE_AddressOutliner *obj = (XFE_AddressOutliner *) callData; + obj->nameCPickerCB(clientData); +} + +void +XFE_AddressOutliner::nameCPickerCB(void *clientData) +{ + AB_NameCompletionCookie *cookie = (AB_NameCompletionCookie *) clientData; + + /* reset the flag + */ + m_rtnIsPicker = False; + + char *completeName = AB_GetNameCompletionDisplayString(cookie); + if (completeName && XP_STRLEN(completeName)) { + m_lastPos = XP_STRLEN(completeName); + fillNameCompletionStr(completeName); + textactivate(NULL); + XP_FREE(completeName); + }/* if */ + +} + +void +XFE_AddressOutliner::fillNameCompletionStr(char *completeName) +{ + char* buf = (char*)XP_CALLOC((size_t)m_lastPos + + XP_STRLEN(completeName) + 1, + sizeof (char)); + if (m_curName != m_textStr) { + strncpy(buf, m_textStr, m_curName - m_textStr); + XP_STRCAT(buf, completeName); + } + else + XP_STRCPY(buf, completeName); + + // Probably would be better to set all these + // with a single XtSetValues command and avoid + // having to worry about the callback from SetString. + fe_SetTextFieldAndCallBack(m_textWidget, buf); + XmTextFieldSetSelection(m_textWidget, m_lastPos, + XmTextFieldGetLastPosition(m_textWidget), + XtLastTimestampProcessed(XtDisplay(m_textWidget))); + XmTextFieldSetInsertionPosition(m_textWidget, m_lastPos); + XmUpdateDisplay(m_textWidget); + XP_FREE(buf); +} + +int +XFE_AddressOutliner::nameCompletionExitFunc(AB_NameCompletionCookie *cookie, + int numResults, + void *FEcookie) +{ + XFE_AddressOutliner *obj = (XFE_AddressOutliner *) FEcookie; + return obj->nameCompletionCB(cookie, numResults); +} + +int +XFE_AddressOutliner::nameCompletionCB(AB_NameCompletionCookie *cookie, + int numResults) +{ +#if defined(DEBUG_tao) + printf("\nnameCompletionCB,numResults=%d\n", numResults); +#endif + XP_ASSERT(m_pickerPane && m_pickerContext); + if (numResults > 1) { + /* set the flag + */ + m_rtnIsPicker = True; + + /* 1. assemble the hint + */ + AB_AttribID attrib = AB_attribDisplayName; + AB_ColumnInfo *cInfo = + AB_GetColumnInfoForPane(m_pickerPane, + (AB_ColumnID) 1); + if (cInfo) { + attrib = cInfo->attribID; + AB_FreeColumnInfo(cInfo); + + AB_AttributeValue *value = 0; + int error = + AB_GetEntryAttributeForPane(m_pickerPane, + 0, + attrib, &value); + char a_line[1024]; + a_line[0] = '\0'; + XP_SAFE_SPRINTF(a_line, sizeof(a_line), + "%s ", + EMPTY_STRVAL(value)?m_curName:value->u.string); + fillNameCompletionStr(a_line); + AB_FreeEntryAttributeValue(value); + }/* if */ + }/* if */ + else if (numResults == 1){ + char *completeName = AB_GetNameCompletionDisplayString(cookie); + if (completeName && XP_STRLEN(completeName)) { + fillNameCompletionStr(completeName); + XP_FREE(completeName); + }/* if */ + + }/* else */ + return numResults; +} +#endif /* USE_ABCOM */ + void XFE_AddressOutliner::textmodify(Widget, XtPointer callData) { @@ -861,7 +1066,7 @@ XFE_AddressOutliner::textmodify(Widget, XtPointer callData) len = length + cbs->text->length + 1; pName = (char*)XP_CALLOC(len, sizeof(char)); - // If the field was empty before, it's easy: + // If the field was empt before, it's easy: if ( cbs->currInsert == 0 || (moreRecipients && length == 0)) { strcpy(pName, cbs->text->ptr); @@ -1410,7 +1615,11 @@ XFE_AddressOutliner::eventHandler(Widget, XtPointer clientData, XEvent *event, B char * XFE_AddressOutliner::nameCompletion(char *pString) { - return xfe_ExpandForNameCompletion(pString); +#if defined(USE_ABCOM) + return 0; +#else + return xfe_ExpandForNameCompletion(pString, m_pAddrBook, m_pCompleteServer); +#endif } //---------------------------- Static Functions for action table @@ -1463,22 +1672,20 @@ static void TableTraverse( //----------- Address Book stuff here ------------ -extern "C" char * xfe_ExpandForNameCompletion(char * pString) +extern "C" char * xfe_ExpandForNameCompletion(char * pString, + ABook *pAddrBook, + DIR_Server *pDirServer) { ABID entryID; ABID field; - ABook *pAddrBook = fe_GetABook(0); - XP_List *pDirectories= FE_GetDirServers(); char *pName = XP_STRDUP(pString); #if defined(DEBUG_tao) printf("\n xfe_ExpandForNameCompletion"); #endif - DIR_Server* pDirServer = NULL; - pAddrBook = fe_GetABook(0); - DIR_GetComposeNameCompletionAddressBook(pDirectories, &pDirServer); - + XP_ASSERT(pAddrBook); + XP_ASSERT(pDirServer); AB_GetIDForNameCompletion( pAddrBook, pDirServer, diff --git a/mozilla/cmd/xfe/src/AddressOutliner.h b/mozilla/cmd/xfe/src/AddressOutliner.h index 3e97fec58ef..1a4877a36ad 100644 --- a/mozilla/cmd/xfe/src/AddressOutliner.h +++ b/mozilla/cmd/xfe/src/AddressOutliner.h @@ -30,6 +30,12 @@ #include "MNListView.h" #include "Addressable.h" +#if defined(USE_ABCOM) +#include "ABComplPickerDlg.h" +#endif /* USE_ABCOM */ + +#include "addrbk.h" + class XFE_AddressOutliner : public XFE_Outliner { public: @@ -89,10 +95,34 @@ public: static const char *textFocusIn; static const char *typeFocusIn; +#if defined(USE_ABCOM) + static int nameCompletionExitFunc(AB_NameCompletionCookie *cookie, + int numResults, + void *FEcookie); + static void nameCPickerExitFunc(void *clientData, void *callData); +#endif /* USE_ABCOM */ + protected: +#if defined(USE_ABCOM) + int nameCompletionCB(AB_NameCompletionCookie *cookie, + int numResults); + void nameCPickerCB(void *clientData); + void fillNameCompletionStr(char *completeName); + + MSG_Pane *m_pickerPane; + MWContext *m_pickerContext; + XFE_ABComplPickerDlg *m_pickerDlg; + + XmTextPosition m_lastPos; + char *m_curName; + char *m_textStr; + XP_Bool m_rtnIsPicker; +#endif /* USE_ABCOM */ + void selectLine(int line); // call with -1 to clear all selections void extendSelection(int line); + private: // Data @@ -114,6 +144,11 @@ private: int m_lastSelected; XtIntervalId m_textTimer; +#if !defined(USE_ABCOM) + ABook *m_pAddrBook; + DIR_Server *m_pCompleteServer; +#endif /* USE_ABCOM */ + // Methods void handleEvent(XEvent *event, Boolean *c); void textLosingFocus(XtPointer); diff --git a/mozilla/cmd/xfe/src/BookmarkView.cpp b/mozilla/cmd/xfe/src/BookmarkView.cpp index f674c081a80..816470375b3 100644 --- a/mozilla/cmd/xfe/src/BookmarkView.cpp +++ b/mozilla/cmd/xfe/src/BookmarkView.cpp @@ -1687,7 +1687,7 @@ void* BMFE_OpenFindWindow(MWContext* bm_context, BM_FindInfo* findInfo ) { XFE_Frame *frame = ViewGlue_getFrame(bm_context); - + XP_ASSERT(frame); fe_showBMFindDialog(frame->getBaseWidget(), findInfo); diff --git a/mozilla/cmd/xfe/src/BookmarkView.h b/mozilla/cmd/xfe/src/BookmarkView.h index faf2536cc04..b6f38f67175 100644 --- a/mozilla/cmd/xfe/src/BookmarkView.h +++ b/mozilla/cmd/xfe/src/BookmarkView.h @@ -43,7 +43,7 @@ class XFE_BookmarkView : public XFE_View, public XFE_Outlinable public: XFE_BookmarkView(XFE_Component *toplevel, Widget parent, XFE_View *parent_view, MWContext *context); - ~XFE_BookmarkView(); + virtual ~XFE_BookmarkView(); // Methods we override from XFE_View virtual Boolean isCommandEnabled(CommandType cmd, void *calldata = NULL, diff --git a/mozilla/cmd/xfe/src/BrowserDrop.h b/mozilla/cmd/xfe/src/BrowserDrop.h index 7c3d9c955ed..170aaeb9678 100644 --- a/mozilla/cmd/xfe/src/BrowserDrop.h +++ b/mozilla/cmd/xfe/src/BrowserDrop.h @@ -40,7 +40,7 @@ class XFE_BrowserDrop : public XFE_DropNetscape { public: XFE_BrowserDrop(Widget,XFE_BrowserFrame*); - ~XFE_BrowserDrop(); + virtual ~XFE_BrowserDrop(); protected: XFE_BrowserFrame *_browserFrame; char **_jsList; diff --git a/mozilla/cmd/xfe/src/BrowserFrame.cpp b/mozilla/cmd/xfe/src/BrowserFrame.cpp index e79d9899116..7be9a8f3a47 100644 --- a/mozilla/cmd/xfe/src/BrowserFrame.cpp +++ b/mozilla/cmd/xfe/src/BrowserFrame.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "BrowserFrame.h" /* #include "HTMLView.h" */ #include "BrowserView.h" @@ -191,9 +191,7 @@ ToolbarSpec XFE_BrowserFrame::toolbar_spec[] = { { xfeCmdShowImages, PUSHBUTTON, &TB_LoadImages_group }, { xfeCmdPrint, PUSHBUTTON, &TB_Print_group }, -#ifndef NO_SECURITY - { xfeCmdViewSecurity, PUSHBUTTON, &TB_Unsecure_group, &TB_Secure_group, &TB_MixSecurity_group }, -#endif + HG10219 TOOLBAR_SEPARATOR, { xfeCmdStopLoading, PUSHBUTTON, &TB_Stop_group }, { NULL } @@ -222,14 +220,7 @@ XFE_BrowserFrame::XFE_BrowserFrame(Widget toplevel, fe_copy_context_settings(m_context, parent_frame->getContext()); #ifdef notyet -#ifndef NO_SECURITY - /* Enable security bar for all browser windows. I had to do this - so that this would get focus whenever we set focus on the main - window. Thus all owr translations will work. Otherwise, if all - chrome is switched off, there will be no widget to set focus to - */ - CONTEXT_DATA(context)->show_security_bar_p = True; -#endif + HG01092 #endif /* notyet */ @@ -296,9 +287,7 @@ XFE_BrowserFrame::XFE_BrowserFrame(Widget toplevel, respectChrome(chromespec); -#ifndef NO_SECURITY - m_dashboard->setShowSecurityIcon(True); -#endif + HG72711 m_dashboard->setShowStatusBar(True); m_dashboard->setShowProgressBar(True); diff --git a/mozilla/cmd/xfe/src/Button.h b/mozilla/cmd/xfe/src/Button.h index 46fc29fc020..bddd1eca02d 100644 --- a/mozilla/cmd/xfe/src/Button.h +++ b/mozilla/cmd/xfe/src/Button.h @@ -76,7 +76,7 @@ public: IconGroup * iconGroup3 = NULL, IconGroup * iconGroup4 = NULL); - ~XFE_Button(); + virtual ~XFE_Button(); const char * getName() { return m_name; } CommandType getCmd() { return m_cmd; } diff --git a/mozilla/cmd/xfe/src/Command.cpp b/mozilla/cmd/xfe/src/Command.cpp index b0b1ee02def..106d1f4ce79 100644 --- a/mozilla/cmd/xfe/src/Command.cpp +++ b/mozilla/cmd/xfe/src/Command.cpp @@ -567,6 +567,7 @@ static struct cmd_mapping mapping[] = { { "mailNew", xfeCmdNewMessage }, #endif { "docInfo", xfeCmdViewPageInfo }, + { "print", xfeCmdPrint }, { "delete", xfeCmdClose }, { "quit", xfeCmdExit }, diff --git a/mozilla/cmd/xfe/src/Component.cpp b/mozilla/cmd/xfe/src/Component.cpp index e45ffc369e3..5e9593c0084 100644 --- a/mozilla/cmd/xfe/src/Component.cpp +++ b/mozilla/cmd/xfe/src/Component.cpp @@ -32,8 +32,23 @@ // Callback message strings. (Comment about these declarations in header file) +static char myClassName[] = "XFE_Component::className"; + const char *XFE_Component::afterRealizeCallback = "XFE_Component::afterRealizeCallback"; +// Progress bar cylon notifications +const char * XFE_Component::progressBarCylonStart = "XFE_Component::progressBarCylonStart"; +const char * XFE_Component::progressBarCylonStop = "XFE_Component::progressBarCylonStop"; +const char * XFE_Component::progressBarCylonTick = "XFE_Component::progressBarCylonTick"; + +// Progress bar percentage notifications +const char * XFE_Component::progressBarUpdatePercent = "XFE_Component::progressBarUpdatePercent"; +const char * XFE_Component::progressBarUpdateText = "XFE_Component::progressBarUpdateText"; + +// Logo animation notifications +const char * XFE_Component::logoStartAnimation = "XFE_Component::logoStartAnimation"; +const char * XFE_Component::logoStopAnimation = "XFE_Component::logoStopAnimation"; + XFE_Component::XFE_Component(XFE_Component *toplevel_component) { @@ -67,6 +82,31 @@ XFE_Component::~XFE_Component() } } + +const char* +XFE_Component::getClassName() +{ + return myClassName; +} + +XP_Bool +XFE_Component::isClassOf(char *name) +{ + XP_Bool ans = False; + if (name) { + char tmp[256]; + sprintf(tmp, "XFE_%s::className", name); + + const char* className = getClassName(); +#if defined(DEBUG_tao_) + printf("\n**XFE_Component::isClassOf %s,%s\n", tmp, className); +#endif + if (!XP_STRCMP(tmp, className)) + ans = True; + }/* if */ + return ans; +} + Widget XFE_Component::getBaseWidget() { diff --git a/mozilla/cmd/xfe/src/Component.h b/mozilla/cmd/xfe/src/Component.h index 68bfdc030f8..987a6f80518 100644 --- a/mozilla/cmd/xfe/src/Component.h +++ b/mozilla/cmd/xfe/src/Component.h @@ -42,7 +42,7 @@ public: Widget getBaseWidget(); virtual void setBaseWidget(Widget w); - + XFE_Component *getToplevel(); void setSensitive(Boolean sensitive); @@ -77,8 +77,28 @@ public: void translateFromRootCoords(int x_root, int y_root, int *x, int *y); Boolean isWidgetInside(Widget w); + virtual const char* getClassName(); // return the class name + virtual XP_Bool isClassOf(char *xyz); // return true if this object is an + // instance of class + // or subclass XFE_xyz; + // otherwise, return false. + + static const char *afterRealizeCallback; // called after we are realized, if we need to notify anyone. + // Progress bar cylon notifications + static const char *progressBarCylonStart; + static const char *progressBarCylonStop; + static const char *progressBarCylonTick; + + // Progress bar percent notifications + static const char *progressBarUpdatePercent; + static const char *progressBarUpdateText; + + // Logo animation notifications + static const char *logoStartAnimation; + static const char *logoStopAnimation; + // use this method to get 'cmd.labelString' resources // for the specified widget (default is the base widget) char *getLabelString(char* cmd, Widget for_w=NULL); diff --git a/mozilla/cmd/xfe/src/ComposeAddressView.cpp b/mozilla/cmd/xfe/src/ComposeAddressView.cpp index 2f97750bab2..a4829f5504f 100644 --- a/mozilla/cmd/xfe/src/ComposeAddressView.cpp +++ b/mozilla/cmd/xfe/src/ComposeAddressView.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "ComposeAddressView.h" #include "xfe.h" #include "msgcom.h" @@ -76,7 +76,7 @@ XDEBUG( printf ("in XFE_ComposeAddressView::handlesCommand(%s)\n", Command::getS if (command == xfeCmdGetNewMessages || command == xfeCmdAddNewsgroup || command == xfeCmdDelete - || command == xfeCmdViewSecurity + HG78281 || command == xfeCmdStopLoading) return True; diff --git a/mozilla/cmd/xfe/src/ComposeAttachFolderView.cpp b/mozilla/cmd/xfe/src/ComposeAttachFolderView.cpp index 01fd09958ae..8cbc2d6d50d 100644 --- a/mozilla/cmd/xfe/src/ComposeAttachFolderView.cpp +++ b/mozilla/cmd/xfe/src/ComposeAttachFolderView.cpp @@ -623,7 +623,7 @@ char *XFE_ComposeAttachFolderView::parseItemLabel(const char *url) if (s3) *s3 = 0; } - /* Now lose the %XX crap. */ + /* Now lose the %XX */ NET_UnEscape (s); char *retLabel=XP_STRDUP(s); diff --git a/mozilla/cmd/xfe/src/ComposeAttachFolderView.h b/mozilla/cmd/xfe/src/ComposeAttachFolderView.h index f66f909f1ad..3bb34968d17 100644 --- a/mozilla/cmd/xfe/src/ComposeAttachFolderView.h +++ b/mozilla/cmd/xfe/src/ComposeAttachFolderView.h @@ -55,7 +55,7 @@ public: XFE_ComposeAttachFolderView( XFE_Component *toplevel_component, XFE_View *parent_view, MSG_Pane *p = NULL, MWContext *context = NULL); - ~XFE_ComposeAttachFolderView(); + virtual ~XFE_ComposeAttachFolderView(); // widgets virtual void createWidgets(Widget); @@ -135,7 +135,7 @@ private: class XFE_ComposeAttachPanel : public XFE_AttachPanel { public: XFE_ComposeAttachPanel(XFE_ComposeAttachFolderView*,MWContext*); - ~XFE_ComposeAttachPanel(); + virtual ~XFE_ComposeAttachPanel(); // widgets void createWidgets(Widget); @@ -168,7 +168,7 @@ class XFE_ComposeAttachDrop : public XFE_DropNetscape { public: XFE_ComposeAttachDrop(Widget,XFE_ComposeAttachPanel*); - ~XFE_ComposeAttachDrop(); + virtual ~XFE_ComposeAttachDrop(); protected: XFE_ComposeAttachPanel *_attachPanel; diff --git a/mozilla/cmd/xfe/src/ComposeFrame.cpp b/mozilla/cmd/xfe/src/ComposeFrame.cpp index 2c553c5d2cb..1416d357b80 100644 --- a/mozilla/cmd/xfe/src/ComposeFrame.cpp +++ b/mozilla/cmd/xfe/src/ComposeFrame.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "ComposeFrame.h" #include "EditorFrame.h" #include "LdapSearchFrame.h" @@ -35,7 +35,7 @@ #include "Dashboard.h" #include "Xfe/Xfe.h" #include "edt.h" -#include "../../../lib/libmsg/msgcflds.h" +#include "msgcflds.h" #include "msgcom.h" #include /* for XP_GetString() */ @@ -62,7 +62,7 @@ extern "C" { MenuSpec XFE_ComposeFrame::message_attach_menu_spec[] = { { xfeCmdAttachFile, PUSHBUTTON }, { xfeCmdAttachWebPage, PUSHBUTTON }, - { xfeCmdDeleteAttachment, PUSHBUTTON }, + // { xfeCmdDeleteAttachment, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdAttachAddressBookCard, TOGGLEBUTTON }, { NULL } @@ -71,17 +71,16 @@ MenuSpec XFE_ComposeFrame::message_attach_menu_spec[] = { MenuSpec XFE_ComposeFrame::file_menu_spec[] = { { "newSubmenu", CASCADEBUTTON, (MenuSpec*)&XFE_Frame::new_menu_spec }, - MENU_SEPARATOR, - { xfeCmdSaveDraft, PUSHBUTTON }, - { xfeCmdSaveAs, PUSHBUTTON }, + { xfeCmdSaveAsMenu, CASCADEBUTTON, + (MenuSpec*)&XFE_ComposeFrame::saveas_spec}, + { xfeCmdAttach, CASCADEBUTTON, + (MenuSpec*)&XFE_ComposeFrame::message_attach_menu_spec}, MENU_SEPARATOR, { xfeCmdSendMessageNow, PUSHBUTTON }, { xfeCmdSendMessageLater, PUSHBUTTON }, { xfeCmdQuoteOriginalText, PUSHBUTTON}, { xfeCmdAddresseePicker, PUSHBUTTON}, - { xfeCmdAttach, CASCADEBUTTON, - (MenuSpec*)&XFE_ComposeFrame::message_attach_menu_spec}, - MENU_SEPARATOR, + // MENU_SEPARATOR, //{ xfeCmdPrintSetup, PUSHBUTTON }, //{ xfeCmdPrintPreview, PUSHBUTTON }, //{ xfeCmdPrint, PUSHBUTTON }, @@ -91,16 +90,23 @@ MenuSpec XFE_ComposeFrame::file_menu_spec[] = { { NULL } }; +MenuSpec XFE_ComposeFrame::saveas_spec[] = { + { xfeCmdSaveAs, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdSaveDraft, PUSHBUTTON }, + { xfeCmdSaveTemplate, PUSHBUTTON }, + { NULL } +}; + MenuSpec XFE_ComposeFrame::edit_menu_spec[] = { { xfeCmdUndo, PUSHBUTTON }, - { xfeCmdRedo, PUSHBUTTON }, + // { xfeCmdRedo, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdCut, PUSHBUTTON }, { xfeCmdCopy, PUSHBUTTON }, { xfeCmdPaste, PUSHBUTTON }, { xfeCmdPasteAsQuoted, PUSHBUTTON }, - { xfeCmdDeleteItem, PUSHBUTTON }, - MENU_SEPARATOR, + // { xfeCmdDeleteItem, PUSHBUTTON }, { xfeCmdSelectAll, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdFindInObject, PUSHBUTTON }, @@ -113,20 +119,32 @@ MenuSpec XFE_ComposeFrame::edit_menu_spec[] = { static char view_radio_group_name[] = "viewRadiogroup"; -#define RADIOBUTTON TOGGLEBUTTON, NULL, view_radio_group_name +#define RADIOBUTTON TOGGLEBUTTON, NULL MenuSpec XFE_ComposeFrame::view_menu_spec[] = { - { xfeCmdToggleNavigationToolbar, PUSHBUTTON }, - { xfeCmdToggleAddressArea, PUSHBUTTON }, - MENU_SEPARATOR, - { xfeCmdViewAddresses, RADIOBUTTON }, - { xfeCmdViewAttachments, RADIOBUTTON }, - { xfeCmdViewOptions, RADIOBUTTON }, + { xfeCmdShowChrome, CASCADEBUTTON, + (MenuSpec*)&XFE_ComposeFrame::show_chrome_spec}, MENU_SEPARATOR, { xfeCmdWrapLongLines, TOGGLEBUTTON}, { NULL } }; +MenuSpec XFE_ComposeFrame::show_chrome_spec[] = { + + { xfeCmdToggleNavigationToolbar, PUSHBUTTON }, + { xfeCmdToggleAddressArea, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdFloatingTaskBarClose, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdViewAddresses, RADIOBUTTON, view_radio_group_name }, + { xfeCmdViewAttachments, RADIOBUTTON, view_radio_group_name }, + { xfeCmdViewOptions, RADIOBUTTON, view_radio_group_name }, + MENU_SEPARATOR, + { xfeCmdToggleParagraphMarks, PUSHBUTTON }, /* with toggling label */ + { NULL } + +}; + static MenuSpec text_tools_menu_spec[] = { { xfeCmdSpellCheck, PUSHBUTTON }, { NULL } @@ -157,50 +175,43 @@ ToolbarSpec XFE_ComposeFrame::toolbar_spec[] = { { xfeCmdSpellCheck, PUSHBUTTON, &MNC_SpellCheck_group }, { xfeCmdSaveDraft, PUSHBUTTON, &MNC_Save_group }, TOOLBAR_SEPARATOR, - { xfeCmdViewSecurity, PUSHBUTTON, - &TB_Unsecure_group, - &TB_Secure_group, - &MNTB_SignUnsecure_group, - &MNTB_SignSecure_group}, + HG82981 { xfeCmdStopLoading, PUSHBUTTON, &TB_Stop_group }, { NULL } }; MenuSpec XFE_ComposeFrame::html_edit_menu_spec[] = { { xfeCmdUndo, PUSHBUTTON }, - { xfeCmdRedo, PUSHBUTTON }, + // { xfeCmdRedo, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdCut, PUSHBUTTON }, { xfeCmdCopy, PUSHBUTTON }, { xfeCmdPaste, PUSHBUTTON }, { xfeCmdPasteAsQuoted, PUSHBUTTON }, - { xfeCmdDeleteItem, PUSHBUTTON }, + // { xfeCmdDeleteItem, PUSHBUTTON }, + { xfeCmdSelectAll, PUSHBUTTON }, MENU_SEPARATOR, { "deleteTableMenu", CASCADEBUTTON, (MenuSpec*)&XFE_EditorFrame::delete_table_menu_spec }, { xfeCmdRemoveLink, PUSHBUTTON }, MENU_SEPARATOR, - { xfeCmdSelectAll, PUSHBUTTON }, { xfeCmdSelectTable, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdFindInObject, PUSHBUTTON }, { xfeCmdFindAgain, PUSHBUTTON }, +#if 0 + /* temporary take out + */ { xfeCmdSearchAddress, PUSHBUTTON }, +#endif MENU_SEPARATOR, { xfeCmdEditPreferences,PUSHBUTTON }, { NULL } }; MenuSpec XFE_ComposeFrame::html_view_menu_spec[] = { - { xfeCmdToggleNavigationToolbar, PUSHBUTTON }, - { xfeCmdToggleAddressArea, PUSHBUTTON }, - { xfeCmdToggleFormatToolbar, PUSHBUTTON }, - MENU_SEPARATOR, - { xfeCmdViewAddresses, RADIOBUTTON }, - { xfeCmdViewAttachments, RADIOBUTTON }, - { xfeCmdViewOptions, RADIOBUTTON }, - MENU_SEPARATOR, - { xfeCmdToggleParagraphMarks, PUSHBUTTON }, /* with toggling label */ + { xfeCmdShowChrome, CASCADEBUTTON, + (MenuSpec*)&XFE_ComposeFrame::html_show_chrome_spec }, MENU_SEPARATOR, { xfeCmdViewPageSource, PUSHBUTTON }, { xfeCmdViewPageInfo, PUSHBUTTON }, @@ -210,6 +221,21 @@ MenuSpec XFE_ComposeFrame::html_view_menu_spec[] = { { NULL } }; +MenuSpec XFE_ComposeFrame::html_show_chrome_spec[] = { + { xfeCmdToggleNavigationToolbar, PUSHBUTTON }, + { xfeCmdToggleAddressArea, PUSHBUTTON }, + { xfeCmdToggleFormatToolbar, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdFloatingTaskBarClose, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdViewAddresses, RADIOBUTTON, view_radio_group_name }, + { xfeCmdViewAttachments, RADIOBUTTON, view_radio_group_name }, + { xfeCmdViewOptions, RADIOBUTTON, view_radio_group_name }, + MENU_SEPARATOR, + { xfeCmdToggleParagraphMarks, PUSHBUTTON }, /* with toggling label */ + { NULL } +}; + MenuSpec XFE_ComposeFrame::html_menu_bar_spec[] = { { xfeMenuFile, CASCADEBUTTON, (MenuSpec*)&XFE_ComposeFrame::file_menu_spec }, @@ -275,8 +301,7 @@ XDEBUG( printf ("in XFE_ComposeFrame::XFE_ComposeFrame()\n");) // Configure the dashboard XP_ASSERT( m_dashboard != NULL ); - m_dashboard->setShowSecurityIcon(True); - m_dashboard->setShowSignedIcon(True); + HG87288 m_dashboard->setShowStatusBar(True); m_dashboard->setShowProgressBar(True); @@ -306,7 +331,7 @@ XDEBUG( printf ("in XFE_ComposeFrame::~XFE_ComposeFrame()\n");) } void -XFE_ComposeFrame::allConnectionsComplete() +XFE_ComposeFrame::allConnectionsComplete(MWContext */* context */) { MSG_Pane *pane = getPane(); @@ -363,7 +388,7 @@ XFE_ComposeFrame::getPane() XP_Bool XFE_ComposeFrame::isCommandEnabled(CommandType cmd, void *cd, XFE_CommandInfo* info) { - if ( cmd == xfeCmdViewSecurity + if ( HG82111 || (cmd == xfeCmdSearchAddress) || cmd == xfeCmdAddresseePicker ) return True; @@ -412,7 +437,7 @@ XFE_ComposeFrame::doCommand(CommandType cmd, void *cd, XFE_CommandInfo* info) XP_Bool XFE_ComposeFrame::handlesCommand(CommandType cmd, void *, XFE_CommandInfo*) { - if ( cmd == xfeCmdViewSecurity || + if ( HG92828 cmd == xfeCmdSearchAddress || cmd == xfeCmdAddresseePicker || cmd == xfeCmdCut || @@ -515,42 +540,8 @@ fe_showCompose(Widget toplevel, Chrome *chromespec, MWContext *old_context, int XFE_ComposeFrame::getSecurityStatus() { - XP_Bool is_signed = False; - XP_Bool is_encrypted = False; XFE_MailSecurityStatusType status = XFE_UNSECURE_UNSIGNED; - - XDEBUG(printf("XFE_ComposeFrame::getSecurityStatus\n");) - - if (getPane() == NULL) return XFE_UNSECURE_UNSIGNED; - - // Encrypted - if ( MSG_GetCompBoolHeader(getPane(), MSG_ENCRYPTED_BOOL_HEADER_MASK) ) - { - is_encrypted = True; - } - - // Signed - if ( MSG_GetCompBoolHeader(getPane(), MSG_SIGNED_BOOL_HEADER_MASK) ) - { - is_signed = True; - } - - if (is_encrypted && is_signed ) - { - status = XFE_SECURE_SIGNED; - } - else if (!is_encrypted && is_signed) - { - status = XFE_UNSECURE_SIGNED; - } - else if (is_encrypted && !is_signed) - { - status = XFE_SECURE_UNSIGNED; - } - else if (!is_encrypted && !is_signed ) - { - status = XFE_UNSECURE_UNSIGNED; - } + HG18181 return status; } diff --git a/mozilla/cmd/xfe/src/ComposeFrame.h b/mozilla/cmd/xfe/src/ComposeFrame.h index 41c9c2cb1d2..aa64a308d98 100644 --- a/mozilla/cmd/xfe/src/ComposeFrame.h +++ b/mozilla/cmd/xfe/src/ComposeFrame.h @@ -53,7 +53,7 @@ public: virtual int initEditor(); - virtual void allConnectionsComplete(); + virtual void allConnectionsComplete(MWContext *context = NULL); void destroyWhenAllConnectionsComplete(); @@ -68,10 +68,13 @@ private: static MenuSpec file_menu_spec[]; static MenuSpec edit_menu_spec[]; static MenuSpec view_menu_spec[]; + static MenuSpec show_chrome_spec[]; + static MenuSpec saveas_spec[]; static MenuSpec message_attach_menu_spec[]; static ToolbarSpec toolbar_spec[]; static MenuSpec html_edit_menu_spec[]; static MenuSpec html_view_menu_spec[]; + static MenuSpec html_show_chrome_spec[]; static MenuSpec html_menu_bar_spec[]; XP_Bool m_destroyWhenConnectionsComplete; diff --git a/mozilla/cmd/xfe/src/ComposeView.cpp b/mozilla/cmd/xfe/src/ComposeView.cpp index 782b1c70059..03d7ed18f3c 100644 --- a/mozilla/cmd/xfe/src/ComposeView.cpp +++ b/mozilla/cmd/xfe/src/ComposeView.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "xfe2_extern.h" #include "ComposeView.h" #include "ComposeFolderView.h" @@ -46,7 +46,7 @@ #include extern int MK_MSG_EMPTY_MESSAGE; extern int MK_MSG_DOUBLE_INCLUDE; -extern int MK_MSG_MIXED_SECURITY; +HG12821 extern int MK_MSG_MISSING_SUBJECT; extern int XFE_NO_SUBJECT; @@ -77,6 +77,7 @@ extern "C" { Widget fe_EditorCreateComposeToolbar(MWContext*, Widget, char*); } +extern "C" void fe_sec_logo_cb (Widget, XtPointer, XtPointer); extern "C" XtPointer fe_GetFont(MWContext *context, int sizeNum, int fontmask); extern "C" void @@ -111,7 +112,7 @@ const char *XFE_ComposeView::tabBeforeSubject = "XFE_ComposeView::tabBeforeSubje const char *XFE_ComposeView::tabAfterSubject = "XFE_ComposeView::tabAfterSubject"; const char *XFE_ComposeView::tabPrev = "XFE_ComposeView::tabPrev"; const char *XFE_ComposeView::tabNext = "XFE_ComposeView::tabNext"; -const char *XFE_ComposeView::updateSecurityOption= "XFE_ComposeView::updateSecurityOption"; +HG12111 static void TabBeforeSubjectTraverse(Widget w, XEvent *, String *, Cardinal *) { @@ -757,6 +758,7 @@ XFE_ComposeView::isCommandEnabled(CommandType command, void *calldata, } else if ( (command == xfeCmdNewMessage ) || (command == xfeCmdSaveDraft) + || (command == xfeCmdSaveTemplate) || (command == xfeCmdQuoteOriginalText) || (command == xfeCmdQuote) || (command == xfeCmdAttach) @@ -1052,6 +1054,7 @@ XDEBUG( printf ("in XFE_ComposeView::handlesCommand(%s)\n", Command::getString(c return False; if ( (command == xfeCmdNewMessage ) || (command == xfeCmdSaveDraft) + || (command == xfeCmdSaveTemplate) || (command == xfeCmdAddresseePicker) || (command == xfeCmdQuoteOriginalText) || (command == xfeCmdQuote) @@ -1153,10 +1156,7 @@ XFE_ComposeView::continueAfterSanityCheck() { cont = XFE_Confirm(m_contextData,XP_GetString(errcode)); } - else if ( errcode == MK_MSG_MIXED_SECURITY ) - { - cont = XFE_Confirm(m_contextData,XP_GetString(errcode)); - } + else if ( errcode == MK_MSG_MISSING_SUBJECT ) { const char *def = XP_GetString(XFE_NO_SUBJECT); @@ -1243,7 +1243,8 @@ XDEBUG( printf ("Do Command: %s \n", Command::getString(command));) /* ###tw Should still probably do the commandstatus stuff. */ MSG_Command(getPane(), MSG_SendMessageLater, NULL, 0); } - else if (command == xfeCmdSaveDraft) + else if (command == xfeCmdSaveDraft || + command == xfeCmdSaveTemplate) { XDEBUG( printf ("XFE_ComposeView::saveAsDraft()\n");) @@ -1256,8 +1257,10 @@ XDEBUG( printf ("Do Command: %s \n", Command::getString(command));) XP_FREE(pBody); /* ###tw Should still probably do the commandstatus stuff. */ - - MSG_Command(getPane(), MSG_SaveDraft, NULL, 0); + if (command == xfeCmdSaveDraft) + MSG_Command(getPane(), MSG_SaveDraft, NULL, 0); + else if (command == xfeCmdSaveTemplate) + MSG_Command(getPane(), MSG_SaveTemplate, NULL, 0); // Reset these two flags so that if user close the window, they // will not be prompt to save again @@ -1485,11 +1488,7 @@ XDEBUG( printf ("Do Command: %s \n", Command::getString(command));) { toggleAddressArea(); } - else if (command == xfeCmdViewSecurity ) - { - updateHeaderInfo(); - fe_sec_logo_cb(NULL, getContext(), NULL); - } + HG81210 else if (command == xfeCmdDeleteItem) { if ( m_focusW ) { if ( m_focusW != m_addrTypeW ) { @@ -1667,7 +1666,7 @@ fe_compose_getData(MWContext *context) { XFE_Frame *f = ViewGlue_getFrame(context); - XP_ASSERT(f->getType() == FRAME_MAILNEWS_COMPOSE); + XP_ASSERT(f && f->getType() == FRAME_MAILNEWS_COMPOSE); return ((XFE_ComposeView *)f->getView())->getComposerData(); } @@ -1677,7 +1676,7 @@ fe_compose_setData(MWContext *context, void* data) { XFE_Frame *f = ViewGlue_getFrame(context); - XP_ASSERT(f->getType() == FRAME_MAILNEWS_COMPOSE); + XP_ASSERT(f && f->getType() == FRAME_MAILNEWS_COMPOSE); ((XFE_ComposeView *)f->getView())->setComposerData(data); } @@ -1687,7 +1686,7 @@ fe_compose_getAttachment(MWContext *context) { XFE_Frame *f = ViewGlue_getFrame(context); - XP_ASSERT(f->getType() == FRAME_MAILNEWS_COMPOSE); + XP_ASSERT(f && f->getType() == FRAME_MAILNEWS_COMPOSE); return ((XFE_ComposeView *)f->getView())->getAttachmentData(); } @@ -1697,7 +1696,7 @@ fe_compose_setAttachment(MWContext *context, void* data) { XFE_Frame *f = ViewGlue_getFrame(context); - XP_ASSERT(f->getType() == FRAME_MAILNEWS_COMPOSE); + XP_ASSERT(f && f->getType() == FRAME_MAILNEWS_COMPOSE); ((XFE_ComposeView *)f->getView())->setAttachmentData(data); } @@ -2278,7 +2277,7 @@ fe_set_compose_wrap_state(MWContext *context, XP_Bool wrap_p) { XFE_Frame *frame = ViewGlue_getFrame(XP_GetNonGridContext(context)); - XP_ASSERT(frame->getType() == FRAME_MAILNEWS_COMPOSE); + XP_ASSERT(frame && frame->getType() == FRAME_MAILNEWS_COMPOSE); ((XFE_ComposeView*)frame->getView())->setComposeWrapState(wrap_p); } @@ -2534,10 +2533,6 @@ XFE_ComposeView::getCommandView(XFE_Command* ) extern "C" void FE_SecurityOptionsChanged(MWContext * pContext) { - XFE_Frame * pFrame = ViewGlue_getFrame(XP_GetNonGridContext(pContext)); - if ( pFrame ) { - ((XFE_ComposeView*)pFrame->getView())->getToplevel()-> - notifyInterested(XFE_ComposeView::updateSecurityOption, NULL); - } + HG03833 } diff --git a/mozilla/cmd/xfe/src/ComposeView.h b/mozilla/cmd/xfe/src/ComposeView.h index ab9eaf7cc85..577bef1bdfb 100644 --- a/mozilla/cmd/xfe/src/ComposeView.h +++ b/mozilla/cmd/xfe/src/ComposeView.h @@ -25,6 +25,7 @@ #ifndef _xfe_composeview_h #define _xfe_composeview_h +#include "rosetta.h" #include "MNView.h" /* Has to be the first include because of xp_xx.h */ #include "msgcom.h" #include "Command.h" /* For compose window commands */ @@ -71,7 +72,7 @@ public: static const char* tabNext; static const char* eFocusIn; static const char* eFocusOut; - static const char* updateSecurityOption; + HG12172 static void daFocusProc(Widget,XtPointer,XEvent*,Boolean*); static void topFocusProc(Widget,XtPointer,XEvent*,Boolean*); diff --git a/mozilla/cmd/xfe/src/Dashboard.cpp b/mozilla/cmd/xfe/src/Dashboard.cpp index 5e8394c9727..db55cc3f393 100644 --- a/mozilla/cmd/xfe/src/Dashboard.cpp +++ b/mozilla/cmd/xfe/src/Dashboard.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "Dashboard.h" #include "Button.h" #include "View.h" @@ -224,6 +224,32 @@ XFE_Dashboard::~XFE_Dashboard() // Unregister progress notifications with parent if (m_parentFrame && m_progressBar) { +#if defined(GLUE_COMPO_CONTEXT) + m_parentFrame->unregisterInterest( + XFE_Component::progressBarCylonStart, + this, + startCylonNotice_cb); + + m_parentFrame->unregisterInterest( + XFE_Component::progressBarCylonStop, + this, + stopCylonNotice_cb); + + m_parentFrame->unregisterInterest( + XFE_Component::progressBarCylonTick, + this, + tickCylonNotice_cb); + + m_parentFrame->unregisterInterest( + XFE_Component::progressBarUpdatePercent, + this, + progressBarUpdatePercentNotice_cb); + + m_parentFrame->unregisterInterest( + XFE_Component::progressBarUpdateText, + this, + progressBarUpdateTextNotice_cb); +#else m_parentFrame->unregisterInterest( XFE_Frame::progressBarCylonStart, this, @@ -248,6 +274,7 @@ XFE_Dashboard::~XFE_Dashboard() XFE_Frame::progressBarUpdateText, this, progressBarUpdateTextNotice_cb); +#endif /* GLUE_COMPO_CONTEXT */ } // Unregister parent frame update chrome notifications if needed @@ -261,6 +288,71 @@ XFE_Dashboard::~XFE_Dashboard() D( printf ("Leaving XFE_Dashboard::~XFE_Dashboard\n");) } + +#if defined(GLUE_COMPO_CONTEXT) +void XFE_Dashboard::connect2Dashboard(XFE_Component *compo) +{ + if (compo) { + // register dashboard events + compo->registerInterest(XFE_View::statusNeedsUpdating, + this, + (XFE_FunctionNotification)setStatusTextNotice_cb); + + // Register progress notifications with parent + compo->registerInterest(XFE_Component::progressBarCylonStart, + this, + startCylonNotice_cb); + + compo->registerInterest(XFE_Component::progressBarCylonStop, + this, + stopCylonNotice_cb); + + compo->registerInterest(XFE_Component::progressBarCylonTick, + this, + tickCylonNotice_cb); + + compo->registerInterest(XFE_Component::progressBarUpdatePercent, + this, + progressBarUpdatePercentNotice_cb); + + compo->registerInterest(XFE_Component::progressBarUpdateText, + this, + progressBarUpdateTextNotice_cb); + }/* compo */ +} + +void XFE_Dashboard::disconnectFromDashboard(XFE_Component *compo) +{ + if (compo) { + // register dashboard events + compo->unregisterInterest(XFE_View::statusNeedsUpdating, + this, + (XFE_FunctionNotification)setStatusTextNotice_cb); + + // Register progress notifications with parent + compo->unregisterInterest(XFE_Component::progressBarCylonStart, + this, + startCylonNotice_cb); + + compo->unregisterInterest(XFE_Component::progressBarCylonStop, + this, + stopCylonNotice_cb); + + compo->unregisterInterest(XFE_Component::progressBarCylonTick, + this, + tickCylonNotice_cb); + + compo->unregisterInterest(XFE_Component::progressBarUpdatePercent, + this, + progressBarUpdatePercentNotice_cb); + + compo->unregisterInterest(XFE_Component::progressBarUpdateText, + this, + progressBarUpdateTextNotice_cb); + }/* compo */ +} +#endif /* GLUE_COMPO_CONTEXT */ + ////////////////////////////////////////////////////////////////////////// void XFE_Dashboard::createStatusBar() @@ -331,6 +423,32 @@ XFE_Dashboard::createProgressBar() // Register progress notifications with parent if (m_parentFrame) { +#if defined(GLUE_COMPO_CONTEXT) + m_parentFrame->registerInterest( + XFE_Component::progressBarCylonStart, + this, + startCylonNotice_cb); + + m_parentFrame->registerInterest( + XFE_Component::progressBarCylonStop, + this, + stopCylonNotice_cb); + + m_parentFrame->registerInterest( + XFE_Component::progressBarCylonTick, + this, + tickCylonNotice_cb); + + m_parentFrame->registerInterest( + XFE_Component::progressBarUpdatePercent, + this, + progressBarUpdatePercentNotice_cb); + + m_parentFrame->registerInterest( + XFE_Component::progressBarUpdateText, + this, + progressBarUpdateTextNotice_cb); +#else m_parentFrame->registerInterest( XFE_Frame::progressBarCylonStart, this, @@ -355,6 +473,7 @@ XFE_Dashboard::createProgressBar() XFE_Frame::progressBarUpdateText, this, progressBarUpdateTextNotice_cb); +#endif /* GLUE_COMPO_CONTEXT */ } } ////////////////////////////////////////////////////////////////////////// @@ -385,16 +504,12 @@ XFE_Dashboard::createSecurityBar() { XP_ASSERT( m_parentFrame != NULL ); XP_ASSERT( XfeIsAlive(m_widget) ); - XP_ASSERT( m_securityBar == NULL ); + /* XP_ASSERT( m_securityBar == NULL ); */ if (!m_parentFrame) return; - // Create the icon toolbar - m_securityBar = XtVaCreateWidget(ICON_TOOL_BAR_NAME, - xfeToolBarWidgetClass, - m_widget, - NULL); + HG12928 } ////////////////////////////////////////////////////////////////////////// void @@ -402,46 +517,13 @@ XFE_Dashboard::addSecurityIcon() { XP_ASSERT( m_parentFrame != NULL ); XP_ASSERT( XfeIsAlive(m_widget) ); - XP_ASSERT( XfeIsAlive(m_securityBar) ); - XP_ASSERT( m_securityIcon == NULL ); + /* XP_ASSERT( XfeIsAlive(m_securityBar) ); */ + /* XP_ASSERT( m_securityIcon == NULL ); */ if (!m_parentFrame) return; - m_securityIcon = new XFE_Button(m_parentFrame, - m_securityBar, - xfeCmdViewSecurity, - &Dash_Unsecure_group, - &Dash_Secure_group, - &Dash_Unsecure_group, - &Dash_Secure_group); - - // Show or hide the new security icon based on its isEnabled state. - m_securityIcon->show(); - - // Configure the icon - m_securityIcon->setToplevel(m_parentFrame); - - XtVaSetValues(m_securityIcon->getBaseWidget(), - XmNtraversalOn, True, - XmNhighlightThickness, 0, - NULL); - - // Add chrome update notice to parent frame if needed - if (m_parentFrame && !m_securityRegistered) - { - m_securityRegistered = True; - - m_parentFrame->registerInterest(XFE_View::chromeNeedsUpdating, - this, - (XFE_FunctionNotification)update_cb); - } - - // Add button command notice - m_securityIcon->registerInterest( - XFE_Button::doCommandCallback, - this, - (XFE_FunctionNotification)doSecurityCommand_cb); + HG00298 } ////////////////////////////////////////////////////////////////////////// void @@ -449,57 +531,19 @@ XFE_Dashboard::addSignedIcon() { XP_ASSERT( m_parentFrame != NULL ); XP_ASSERT( XfeIsAlive(m_widget) ); - XP_ASSERT( XfeIsAlive(m_securityBar) ); - XP_ASSERT( m_signedIcon == NULL ); + /* XP_ASSERT( XfeIsAlive(m_securityBar) ); */ + /* XP_ASSERT( m_signedIcon == NULL ); */ if (!m_parentFrame) return; - m_signedIcon = new XFE_Button(m_parentFrame, - m_securityBar, - xfeCmdViewSecurity, - &Dash_Unsigned_group, - &Dash_Unsigned_group, - &Dash_Signed_group, - &Dash_Signed_group); - - // Show or hide the new signed icon based on its isEnabled state. - m_signedIcon->show(); - - // Configure the icon - m_signedIcon->setToplevel(m_parentFrame); - - XtVaSetValues(m_signedIcon->getBaseWidget(), - XmNtraversalOn, True, - XmNhighlightThickness, 0, - NULL); - - // Add chrome update notice to parent frame if needed - if (m_parentFrame && !m_securityRegistered) - { - m_securityRegistered = True; - - m_parentFrame->registerInterest(XFE_View::chromeNeedsUpdating, - this, - (XFE_FunctionNotification)update_cb); - } - - // Add button command notice - m_signedIcon->registerInterest( - XFE_Button::doCommandCallback, - this, - (XFE_FunctionNotification)doSecurityCommand_cb); + HG02920 } ////////////////////////////////////////////////////////////////////////// void XFE_Dashboard::configureSecurityBar() { - // Make sure the is a security bar to configure - if (XfeIsAlive(m_securityBar)) - { - XfeSetManagedState(m_securityBar, - isSecurityIconShown() || isSignedIconShown()); - } + HG02092 } ////////////////////////////////////////////////////////////////////////// void @@ -509,8 +553,11 @@ XFE_Dashboard::setStatusText(const char * text) Widget top = m_toplevel->getBaseWidget(); printf("%s: setStatusText: %s\n", XtName(top), text); ) - XP_ASSERT( XfeIsAlive(m_statusBar) ); +#if defined(DEBUG_tao_) + printf("\nXFE_Dashboard::setStatusText=%s\n", text?text:""); +#endif + XfeLabelSetStringPSZ(m_statusBar,(String) text); } ////////////////////////////////////////////////////////////////////////// @@ -519,6 +566,9 @@ XFE_Dashboard::setProgressBarText(const char * text) { XP_ASSERT( XfeIsAlive(m_progressBar) ); +#if defined(DEBUG_tao_) + printf("\nXFE_Dashboard::setProgressBarText=%s\n", text?text:""); +#endif XfeLabelSetStringPSZ(m_progressBar,(String) text); } ////////////////////////////////////////////////////////////////////////// @@ -527,6 +577,9 @@ XFE_Dashboard::setProgressBarPercent(int percent) { XP_ASSERT( XfeIsAlive(m_progressBar) ); +#if defined(DEBUG_tao_) + printf("\nXFE_Dashboard::setProgressBarPercent=%d\n", percent); +#endif if (percent < 0) { percent = 0; @@ -543,7 +596,9 @@ void XFE_Dashboard::startCylon() { XP_ASSERT( XfeIsAlive(m_progressBar) ); - +#if defined(DEBUG_tao_) + printf("\nXFE_Dashboard::startCylon\n"); +#endif XfeProgressBarCylonStart(m_progressBar); } ////////////////////////////////////////////////////////////////////////// @@ -551,6 +606,9 @@ void XFE_Dashboard::stopCylon() { XP_ASSERT( XfeIsAlive(m_progressBar) ); +#if defined(DEBUG_tao_) + printf("\nXFE_Dashboard::stopCylon\n"); +#endif XfeProgressBarCylonStop(m_progressBar); } @@ -560,6 +618,9 @@ XFE_Dashboard::tickCylon() { XP_ASSERT( XfeIsAlive(m_progressBar) ); +#if defined(DEBUG_tao_) + printf("\nXFE_Dashboard::tickCylon\n"); +#endif XfeProgressBarCylonTick(m_progressBar); } ////////////////////////////////////////////////////////////////////////// @@ -860,16 +921,7 @@ XFE_CALLBACK_DEFN(XFE_Dashboard, update) if (!XfeIsAlive(m_widget)) return; - if (m_securityIcon && m_securityIcon->isAlive()) - { - m_securityIcon->setPretendSensitive(m_parentFrame->isCommandEnabled((CommandType)m_securityIcon->getName())); - m_securityIcon->useIconGroup(m_parentFrame->getSecurityStatus()); - } - if (m_signedIcon && m_signedIcon->isAlive()) - { - m_signedIcon->setPretendSensitive(m_parentFrame->isCommandEnabled((CommandType)m_signedIcon->getName())); - m_signedIcon->useIconGroup(m_parentFrame->getSecurityStatus()); - } + HG28999 } ////////////////////////////////////////////////////////////////////////// XFE_CALLBACK_DEFN(XFE_Dashboard, doSecurityCommand) @@ -882,11 +934,7 @@ XFE_CALLBACK_DEFN(XFE_Dashboard, doSecurityCommand) if (!XfeIsAlive(m_widget)) return; - m_parentFrame->doCommand(cmdArgs->cmd, cmdArgs->callData, - cmdArgs->info ); - - m_parentFrame->notifyInterested(Command::commandDispatchedCallback, - callData); + HG09219 } ////////////////////////////////////////////////////////////////////////// XFE_CALLBACK_DEFN(XFE_Dashboard, startCylonNotice) @@ -1117,27 +1165,7 @@ XFE_Dashboard::setShowSecurityIcon(XP_Bool state) return; } - // Create the security bar if needed - if (!m_securityBar) - { - createSecurityBar(); - } - - // Create the security icon if needed - if (!m_securityIcon) - { - addSecurityIcon(); - } - - XP_ASSERT( m_securityIcon != NULL ); - - if (m_securityIcon && m_securityIcon->isAlive()) - { - m_securityIcon->setShowingState(state); - } - - // Configure the secutiry bar - configureSecurityBar(); + HG89219 } ////////////////////////////////////////////////////////////////////////// void @@ -1183,57 +1211,25 @@ XFE_Dashboard::setShowSignedIcon(XP_Bool state) } - // Create the security bar if needed - if (!m_securityBar) - { - createSecurityBar(); - } - - // Create the signed icon if needed - if (!m_signedIcon) - { - addSignedIcon(); - } - - XP_ASSERT( m_signedIcon != NULL ); - - if (m_signedIcon && m_signedIcon->isAlive()) - { - m_signedIcon->setShowingState(state); - } - - // Configure the secutiry bar - configureSecurityBar(); + HG82198 } ////////////////////////////////////////////////////////////////////////// XP_Bool XFE_Dashboard::isSecurityIconShown() { - return (m_securityIcon && m_securityIcon->isShown()); + return (HG20303); } ////////////////////////////////////////////////////////////////////////// XP_Bool XFE_Dashboard::isSignedIconShown() { - return (m_signedIcon && m_signedIcon->isShown()); + return (HG02023); } ////////////////////////////////////////////////////////////////////////// XP_Bool XFE_Dashboard::processTraversal(XmTraversalDirection direction) { - // Try the security icon - if ((m_securityIcon && m_securityIcon->isAlive()) && - XmProcessTraversal(m_securityIcon->getBaseWidget(),direction)) - { - return True; - } - - // Try the signed icon - if ((m_signedIcon && m_signedIcon->isAlive()) && - XmProcessTraversal(m_signedIcon->getBaseWidget(),direction)) - { - return True; - } + HG93649 // Try the progress bar if (XfeIsAlive(m_progressBar) && diff --git a/mozilla/cmd/xfe/src/Dashboard.h b/mozilla/cmd/xfe/src/Dashboard.h index af8b0bdf12c..c639cfbbf28 100644 --- a/mozilla/cmd/xfe/src/Dashboard.h +++ b/mozilla/cmd/xfe/src/Dashboard.h @@ -46,6 +46,12 @@ public: virtual ~XFE_Dashboard(); +#if defined(GLUE_COMPO_CONTEXT) + // connect the compo to the dashboard + void connect2Dashboard(XFE_Component *compo); + void disconnectFromDashboard(XFE_Component *compo); +#endif /* GLUE_COMPO_CONTEXT */ + // Status methods void setStatusText (const char * text); diff --git a/mozilla/cmd/xfe/src/DesktopTypes.h b/mozilla/cmd/xfe/src/DesktopTypes.h index 47e91c6575b..c413598973d 100644 --- a/mozilla/cmd/xfe/src/DesktopTypes.h +++ b/mozilla/cmd/xfe/src/DesktopTypes.h @@ -68,7 +68,7 @@ class XFE_URLDesktopType : public XFE_DesktopType public: XFE_URLDesktopType(const char *string=NULL); XFE_URLDesktopType(FILE*); - ~XFE_URLDesktopType(); + virtual ~XFE_URLDesktopType(); static const char *ftrType(); static int isDesktopType(const char*); @@ -114,7 +114,7 @@ class XFE_WebJumperDesktopType : public XFE_DesktopType { public: XFE_WebJumperDesktopType(FILE*); - ~XFE_WebJumperDesktopType(); + virtual ~XFE_WebJumperDesktopType(); static int isDesktopType(const char*); diff --git a/mozilla/cmd/xfe/src/Dialog.cpp b/mozilla/cmd/xfe/src/Dialog.cpp index b13d78503d6..402886ce4c0 100644 --- a/mozilla/cmd/xfe/src/Dialog.cpp +++ b/mozilla/cmd/xfe/src/Dialog.cpp @@ -46,6 +46,21 @@ XFE_Dialog::XFE_Dialog(Widget parent, // dialog parent Widget chrome_widget) : XFE_Component() { +#if defined(GLUE_COMPO_CONTEXT) + Widget s = parent; + while (s && !XtIsShell(s)) { + s = XtParent(s); + } + m_wParent = s; + + // Create the chrome + + if (chrome_widget == NULL) + m_chrome = createDialogChromeWidget(s, name, ok, cancel, + help, apply, separator, modal); + else + m_chrome = chrome_widget; +#else m_wParent = parent; // Create the chrome @@ -55,6 +70,7 @@ XFE_Dialog::XFE_Dialog(Widget parent, // dialog parent help, apply, separator, modal); else m_chrome = chrome_widget; +#endif /* GLUE_COMPO_CONTEXT */ // Register base widget and parent widget diff --git a/mozilla/cmd/xfe/src/DownloadFrame.cpp b/mozilla/cmd/xfe/src/DownloadFrame.cpp index 2820f280019..5be37f911cc 100644 --- a/mozilla/cmd/xfe/src/DownloadFrame.cpp +++ b/mozilla/cmd/xfe/src/DownloadFrame.cpp @@ -322,6 +322,15 @@ XFE_DownloadFrame::XFE_DownloadFrame(Widget toplevel, XFE_Frame *parent_frame) // We need to do this, cause the XFE_Frame class only does so // if the have_toolbars ctor parameter is true and in our case // it is not. +#if defined(GLUE_COMPO_CONTEXT) + registerInterest(XFE_Component::logoStartAnimation, + this, + &XFE_Frame::logoAnimationStartNotice_cb); + + registerInterest(XFE_Component::logoStopAnimation, + this, + &XFE_Frame::logoAnimationStopNotice_cb); +#else registerInterest(XFE_Frame::logoStartAnimation, this, &XFE_Frame::logoAnimationStartNotice_cb); @@ -329,6 +338,7 @@ XFE_DownloadFrame::XFE_DownloadFrame(Widget toplevel, XFE_Frame *parent_frame) registerInterest(XFE_Frame::logoStopAnimation, this, &XFE_Frame::logoAnimationStopNotice_cb); +#endif /* GLUE_COMPO_CONTEXT */ } XFE_DownloadFrame::~XFE_DownloadFrame() @@ -337,6 +347,15 @@ XFE_DownloadFrame::~XFE_DownloadFrame() // We need to do this, cause the XFE_Frame class only does so // if the have_toolbars ctor parameter is true and in our case // it is not. +#if defined(GLUE_COMPO_CONTEXT) + unregisterInterest(XFE_Component::logoStartAnimation, + this, + &XFE_Frame::logoAnimationStartNotice_cb); + + unregisterInterest(XFE_Component::logoStopAnimation, + this, + &XFE_Frame::logoAnimationStopNotice_cb); +#else unregisterInterest(XFE_Frame::logoStartAnimation, this, &XFE_Frame::logoAnimationStartNotice_cb); @@ -344,6 +363,7 @@ XFE_DownloadFrame::~XFE_DownloadFrame() unregisterInterest(XFE_Frame::logoStopAnimation, this, &XFE_Frame::logoAnimationStopNotice_cb); +#endif /* GLUE_COMPO_CONTEXT */ } XP_Bool @@ -389,7 +409,7 @@ XFE_DownloadFrame::activate_cb(Widget w, XtPointer clientData, XtPointer) } void -XFE_DownloadFrame::allConnectionsComplete() +XFE_DownloadFrame::allConnectionsComplete(MWContext */* context */) { D( printf ("in allConnectionsComplete\n");) XP_InterruptContext(m_context); @@ -956,7 +976,7 @@ fe_MakeSaveAsStream (int /*format_out*/, void */*data_obj*/, MWContext *new_context; parent = ViewGlue_getFrame(XP_GetNonGridContext(context)); - + XP_ASSERT(parent); new_frame = new XFE_DownloadFrame(XtParent(parent->getBaseWidget()), parent); new_context = new_frame->getContext(); @@ -1029,7 +1049,7 @@ fe_save_as_nastiness (MWContext *context, URL_Struct *url, /* Hold on to the saved data. */ XP_MEMCPY(&saved_data, &url->savedData, sizeof(SHIST_SavedData)); - /* make damn sure the form_data slot is zero'd or else all + /* make sure the form_data slot is zero'd or else all * hell will break loose */ XP_MEMSET (&url->savedData, 0, sizeof (SHIST_SavedData)); diff --git a/mozilla/cmd/xfe/src/DownloadFrame.h b/mozilla/cmd/xfe/src/DownloadFrame.h index 51fe9952fb3..4f3d9f5d041 100644 --- a/mozilla/cmd/xfe/src/DownloadFrame.h +++ b/mozilla/cmd/xfe/src/DownloadFrame.h @@ -46,7 +46,7 @@ public: void setAddress(char *address); void setDestination(char *address); - void allConnectionsComplete(); + virtual void allConnectionsComplete(MWContext *context = NULL); virtual XFE_Logo * getLogo (); virtual void configureLogo (); diff --git a/mozilla/cmd/xfe/src/DragDrop.cpp b/mozilla/cmd/xfe/src/DragDrop.cpp index 377770d58d2..a951920fedc 100644 --- a/mozilla/cmd/xfe/src/DragDrop.cpp +++ b/mozilla/cmd/xfe/src/DragDrop.cpp @@ -185,7 +185,7 @@ char *XFE_DragBase::guessUrlMimeType(const char *data) else if (XP_STRNCASECMP(data,"addbook:",8)==0) return "text/x-vcard"; -#ifdef MOZ_MAIL_NEWS +#if defined(MOZ_MAIL_NEWS) // mail or news message else if (MSG_RequiresMailMsgWindow(data) || MSG_RequiresNewsMsgWindow(data)) return "message/rfc822"; @@ -193,7 +193,7 @@ char *XFE_DragBase::guessUrlMimeType(const char *data) // document URL - use internal id, since there's no URL mime type else if (MSG_RequiresBrowserWindow(data)) return "_url"; -#endif +#endif /* MOZ_MAIL_NEWS */ // fallback to generic type else diff --git a/mozilla/cmd/xfe/src/DragDrop.h b/mozilla/cmd/xfe/src/DragDrop.h index b3fb4db2a7b..e8410088668 100644 --- a/mozilla/cmd/xfe/src/DragDrop.h +++ b/mozilla/cmd/xfe/src/DragDrop.h @@ -141,7 +141,7 @@ class XFE_DragDesktop : public XFE_DragBase { public: XFE_DragDesktop(Widget); - ~XFE_DragDesktop(); + virtual ~XFE_DragDesktop(); protected: Atom _fileTarget; @@ -161,7 +161,7 @@ class XFE_DragNetscape : public XFE_DragDesktop { public: XFE_DragNetscape(Widget); - ~XFE_DragNetscape(); + virtual ~XFE_DragNetscape(); protected: XFE_DesktopType *_desktopFileData; @@ -247,7 +247,7 @@ class XFE_DropDesktop : public XFE_DropBase { public: XFE_DropDesktop(Widget); - ~XFE_DropDesktop(); + virtual ~XFE_DropDesktop(); protected: // base class methods changed int isFileTarget(Atom); @@ -273,7 +273,7 @@ class XFE_DropNetscape : public XFE_DropDesktop { public: XFE_DropNetscape(Widget); - ~XFE_DropNetscape(); + virtual ~XFE_DropNetscape(); protected: int processFileTarget(const char**,int); int processDesktopURLTarget(const char*,const char*); diff --git a/mozilla/cmd/xfe/src/EditorDrop.h b/mozilla/cmd/xfe/src/EditorDrop.h index 58e9d9b1f6b..9a06e7d35ff 100644 --- a/mozilla/cmd/xfe/src/EditorDrop.h +++ b/mozilla/cmd/xfe/src/EditorDrop.h @@ -39,7 +39,7 @@ class XFE_EditorDrop : public XFE_DropNetscape { public: XFE_EditorDrop(Widget,XFE_EditorView*); - ~XFE_EditorDrop(); + virtual ~XFE_EditorDrop(); protected: XFE_EditorView *_editorView; diff --git a/mozilla/cmd/xfe/src/EditorFrame.cpp b/mozilla/cmd/xfe/src/EditorFrame.cpp index af3e3d4e221..cfe17eceb80 100644 --- a/mozilla/cmd/xfe/src/EditorFrame.cpp +++ b/mozilla/cmd/xfe/src/EditorFrame.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "EditorFrame.h" #include "EditorView.h" #include "Command.h" @@ -241,7 +241,7 @@ MenuSpec XFE_EditorFrame::format_menu_spec[] = { { xfeCmdSetObjectProperties, PUSHBUTTON }, { xfeCmdSetTableProperties, PUSHBUTTON }, { xfeCmdSetPageProperties, PUSHBUTTON }, - { xfeCmdSetEncrypted, TOGGLEBUTTON }, + HG10287 { NULL } }; diff --git a/mozilla/cmd/xfe/src/EditorToolbar.h b/mozilla/cmd/xfe/src/EditorToolbar.h index 73f5b8df232..b61d0a82fc0 100644 --- a/mozilla/cmd/xfe/src/EditorToolbar.h +++ b/mozilla/cmd/xfe/src/EditorToolbar.h @@ -22,7 +22,7 @@ * EditorToolbar.h --- Toolbar for Editor and HTML Mail Compose. * * Created: David Williams , Feb-7-1997 - * RCSID: "$Id: EditorToolbar.h,v 3.1 1998-03-28 03:26:25 ltabb Exp $" + * RCSID: "$Id: EditorToolbar.h,v 3.2 1998-06-22 21:19:13 spider Exp $" * *---------------------------------------------------------------------------- */ @@ -46,7 +46,7 @@ public: ToolbarSpec* spec, Boolean show_frame); - ~XFE_EditorToolbar(); + virtual ~XFE_EditorToolbar(); // contract: void update(); diff --git a/mozilla/cmd/xfe/src/EditorView.cpp b/mozilla/cmd/xfe/src/EditorView.cpp index f359a2995ca..1e6403aeda1 100644 --- a/mozilla/cmd/xfe/src/EditorView.cpp +++ b/mozilla/cmd/xfe/src/EditorView.cpp @@ -20,7 +20,7 @@ Created: Richard Hess , 11-Nov-96 */ - +#include "rosetta.h" #include "EditorFrame.h" #include "EditorView.h" #include "SpellHandler.h" @@ -1497,26 +1497,7 @@ public: } }; -#ifndef NO_SECURITY -class SetEncryptedCommand : public XFE_EditorViewCommand -{ -public: - SetEncryptedCommand() : XFE_EditorViewCommand(xfeCmdSetEncrypted) {}; - - XP_Bool isDynamic() { return TRUE; }; - - XP_Bool isSelected(XFE_View* view, XFE_CommandInfo* /*calldata*/) { - return (XP_Bool) EDT_EncryptState(view->getContext()); - } - XP_Bool isEnabled(XFE_View* /*view*/, XFE_CommandInfo*) { - return (XP_Bool) PK11_TokenExists(CKM_SKIPJACK_CBC64); - } - void reallyDoCommand(XFE_View* view, XFE_CommandInfo*) { - EDT_EncryptToggle(view->getContext()); - - } -}; -#endif +HG10297 class SetCharacterColorCommand : public AlwaysEnabledCommand { @@ -2823,9 +2804,7 @@ XFE_EditorView::XFE_EditorView(XFE_Component *toplevel_component, registerCommand(my_commands, new SetObjectPropertiesCommand); registerCommand(my_commands, new SetPagePropertiesCommand); registerCommand(my_commands, new SetTablePropertiesCommand); -#ifndef NO_SECURITY - registerCommand(my_commands, new SetEncryptedCommand); -#endif + HG81272 registerCommand(my_commands, new SetCharacterColorCommand); registerCommand(my_commands, new BrowsePageCommand); registerCommand(my_commands, new EditSourceCommand); diff --git a/mozilla/cmd/xfe/src/EditorView.h b/mozilla/cmd/xfe/src/EditorView.h index 82e344dc28f..83920888997 100644 --- a/mozilla/cmd/xfe/src/EditorView.h +++ b/mozilla/cmd/xfe/src/EditorView.h @@ -43,7 +43,7 @@ class XFE_EditorView : public XFE_HTMLView, public XFE_Editable { public: XFE_EditorView(XFE_Component *toplevel_component, Widget parent, XFE_View *parent_view, MWContext *context); - ~XFE_EditorView(); + virtual ~XFE_EditorView(); #if 0 virtual Boolean isCommandEnabled(CommandType cmd, void *calldata = NULL, XFE_CommandInfo* i = NULL); diff --git a/mozilla/cmd/xfe/src/FolderDropdown.cpp b/mozilla/cmd/xfe/src/FolderDropdown.cpp index ee48f29b36d..7b947a971ea 100644 --- a/mozilla/cmd/xfe/src/FolderDropdown.cpp +++ b/mozilla/cmd/xfe/src/FolderDropdown.cpp @@ -46,11 +46,13 @@ XFE_FolderDropdown::XFE_FolderDropdown(XFE_Component *toplevel_component, Widget parent, XP_Bool allowServerSelection, XP_Bool showNewsgroups, - XP_Bool boldWithNew) + XP_Bool boldWithNew, + XP_Bool showFolders) : XFE_Component(toplevel_component) { m_popupServer = True; - + m_master = fe_getMNMaster(); + Widget combo; Colormap cmap; Cardinal depth; @@ -66,7 +68,8 @@ XFE_FolderDropdown::XFE_FolderDropdown(XFE_Component *toplevel_component, m_showNewsgroups = showNewsgroups; m_boldWithNew = boldWithNew; m_foldersHaveChanged = FALSE; - + m_showFolders = showFolders; + combo = XtVaCreateWidget("folderDropdown", dtComboBoxWidgetClass, parent, @@ -186,8 +189,7 @@ void XFE_FolderDropdown::buildList(MSG_FolderInfo *info, int *position) { - - int num_children = MSG_GetFolderChildren(fe_getMNMaster(), + int num_children = MSG_GetFolderChildren(m_master, info, NULL, 0); @@ -200,7 +202,7 @@ XFE_FolderDropdown::buildList(MSG_FolderInfo *info, int *position) if ( info ) { - MSG_GetFolderLineById(fe_getMNMaster(), info, &line); + MSG_GetFolderLineById(m_master, info, &line); if ( line.name) printf("folder name=%s\n", line.name); @@ -220,7 +222,7 @@ XFE_FolderDropdown::buildList(MSG_FolderInfo *info, int *position) tmp = new MSG_FolderInfo* [num_children]; /* first we handle local mail stuff. */ - MSG_GetFolderChildren(fe_getMNMaster(), + MSG_GetFolderChildren(m_master, info, tmp, num_children); @@ -233,7 +235,11 @@ XFE_FolderDropdown::buildList(MSG_FolderInfo *info, int *position) *position += 1; XP_ASSERT(tmp[i]); - buildList(tmp[i], position); + + // don't recurse if we're at the top level (info==NULL) + // and we only want servers (m_showFolders=False) + if (info || m_showFolders) + buildList(tmp[i], position); } delete [] tmp; @@ -243,7 +249,6 @@ XFE_FolderDropdown::buildList(MSG_FolderInfo *info, int *position) void XFE_FolderDropdown::syncFolderList() { - MSG_Master *master = fe_getMNMaster(); int num_infos; @@ -251,17 +256,17 @@ XFE_FolderDropdown::syncFolderList() /* this should be the number of MSG_FolderInfo's for mail, including servers. */ - num_infos = MSG_GetFoldersWithFlag(master, + num_infos = MSG_GetFoldersWithFlag(m_master, MSG_FOLDER_FLAG_MAIL, NULL, 0); if (m_showNewsgroups) { - num_infos += MSG_GetFoldersWithFlag(master, + num_infos += MSG_GetFoldersWithFlag(m_master, MSG_FOLDER_FLAG_NEWSGROUP, NULL, 0); - m_numNewsHosts = MSG_GetFoldersWithFlag(master, + m_numNewsHosts = MSG_GetFoldersWithFlag(m_master, MSG_FOLDER_FLAG_NEWS_HOST, NULL, 0); num_infos += m_numNewsHosts; @@ -283,7 +288,7 @@ XFE_FolderDropdown::syncFolderList() news_hosts = new MSG_FolderInfo* [m_numNewsHosts]; - MSG_GetFoldersWithFlag(master, + MSG_GetFoldersWithFlag(m_master, MSG_FOLDER_FLAG_NEWS_HOST, news_hosts, m_numNewsHosts); @@ -343,7 +348,7 @@ XFE_FolderDropdown::syncCombo() return; } - MSG_GetFolderLineById(fe_getMNMaster(), m_infos[i], &line); + MSG_GetFolderLineById(m_master, m_infos[i], &line); xmstrings[i] = makeListItemFromLine(&line); } @@ -407,7 +412,7 @@ XFE_CALLBACK_DEFN(XFE_FolderDropdown, boldFolderInfo)(XFE_NotificationCenter *, /* not found */ if (index == m_numinfos) return; - if (!MSG_GetFolderLineById(fe_getMNMaster(), info, &line)) + if (!MSG_GetFolderLineById(m_master, info, &line)) return; XmString both = makeListItemFromLine(&line); @@ -431,7 +436,7 @@ XFE_FolderDropdown::folderSelect(int row) XP_ASSERT(row >= 0 && row < m_numinfos); - if (!MSG_GetFolderLineById(fe_getMNMaster(), + if (!MSG_GetFolderLineById(m_master, m_infos[row], &line)) return; @@ -532,7 +537,7 @@ XFE_FolderDropdown::selectFolder(char *name) for (int i=0; i < m_numinfos; i++) { MSG_FolderLine line; - MSG_GetFolderLineById(fe_getMNMaster(), m_infos[i], &line); + MSG_GetFolderLineById(m_master, m_infos[i], &line); this_folder_name = MSG_GetFolderNameFromID(m_infos[i]); if (this_folder_name && (XP_STRCMP(this_folder_name,name) == 0)) { diff --git a/mozilla/cmd/xfe/src/FolderDropdown.h b/mozilla/cmd/xfe/src/FolderDropdown.h index 654bcc76c1e..23aab264f3c 100644 --- a/mozilla/cmd/xfe/src/FolderDropdown.h +++ b/mozilla/cmd/xfe/src/FolderDropdown.h @@ -36,7 +36,8 @@ public: Widget parent, XP_Bool allowServerSelection = TRUE, XP_Bool showNewsgroups = TRUE, - XP_Bool boldWithNew = FALSE); + XP_Bool boldWithNew = FALSE, + XP_Bool showFolders = TRUE); virtual ~XFE_FolderDropdown(); @@ -51,6 +52,7 @@ public: protected: private: + MSG_Master *m_master; XmString makeListItemFromLine(MSG_FolderLine* line); void buildList(MSG_FolderInfo *info, int *position); @@ -72,6 +74,7 @@ private: XP_Bool m_popupServer; XP_Bool m_showNewsgroups; XP_Bool m_boldWithNew; + XP_Bool m_showFolders; int m_lastSelectedPosition; diff --git a/mozilla/cmd/xfe/src/FolderFrame.cpp b/mozilla/cmd/xfe/src/FolderFrame.cpp index b899f817a80..90e2073ad52 100644 --- a/mozilla/cmd/xfe/src/FolderFrame.cpp +++ b/mozilla/cmd/xfe/src/FolderFrame.cpp @@ -23,6 +23,7 @@ #include "MozillaApp.h" +#include "ThreadFrame.h" #include "FolderFrame.h" #include "FolderView.h" #include "FolderMenu.h" @@ -52,8 +53,7 @@ extern int XFE_INBOX_DOESNT_EXIST; static XFE_FolderFrame *theFrame = NULL; MenuSpec XFE_FolderFrame::file_menu_spec[] = { - { "newSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::new_submenu_spec }, - { xfeCmdNewFolder, PUSHBUTTON }, + { "newSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::new_submenu_spec }, { xfeCmdNewNewsHost, PUSHBUTTON }, { xfeCmdOpenSelected, PUSHBUTTON }, MENU_SEPARATOR, @@ -87,10 +87,11 @@ MenuSpec XFE_FolderFrame::edit_menu_spec[] = { { xfeCmdSelectAll, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdSearch, PUSHBUTTON }, +#if 0 + /* temporary take out + */ { xfeCmdSearchAddress, PUSHBUTTON }, - MENU_SEPARATOR, - { xfeCmdEditConfiguration, PUSHBUTTON }, - { xfeCmdModerateDiscussion, PUSHBUTTON }, +#endif MENU_SEPARATOR, { xfeCmdEditMailFilterRules,PUSHBUTTON }, { xfeCmdViewProperties, PUSHBUTTON }, @@ -99,8 +100,7 @@ MenuSpec XFE_FolderFrame::edit_menu_spec[] = { }; MenuSpec XFE_FolderFrame::view_menu_spec[] = { - { xfeCmdToggleNavigationToolbar, PUSHBUTTON }, - { xfeCmdToggleLocationToolbar, PUSHBUTTON }, +{ "showSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::show_submenu_spec }, MENU_SEPARATOR, { "expandCollapseSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::expand_collapse_submenu_spec }, diff --git a/mozilla/cmd/xfe/src/FolderView.cpp b/mozilla/cmd/xfe/src/FolderView.cpp index 470786a7ee2..16e6088c76d 100644 --- a/mozilla/cmd/xfe/src/FolderView.cpp +++ b/mozilla/cmd/xfe/src/FolderView.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "FolderView.h" #include "SubscribeDialog.h" /* for fe_showSubscribeDialog */ #include "ThreadFrame.h" /* for fe_showMessages */ @@ -117,6 +117,7 @@ MenuSpec XFE_FolderView::mailfolder_popup_menu[] = { { xfeCmdDeleteFolder, PUSHBUTTON }, { xfeCmdRenameFolder, PUSHBUTTON }, { xfeCmdCompressFolders, PUSHBUTTON }, + { xfeCmdCompressAllFolders, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdComposeMessage, PUSHBUTTON }, MENU_SEPARATOR, @@ -288,6 +289,24 @@ XFE_FolderView::initFolderIcons(Widget widget, Pixel bg_pixel, Pixel fg_pixel) MN_DraftO.width, MN_DraftO.height, MN_DraftO.mono_bits, MN_DraftO.color_bits, MN_DraftO.mask_bits, FALSE); + if (!templatesIcon.pixmap) + fe_NewMakeIcon(widget, + fg_pixel, + bg_pixel, + &templatesIcon, + NULL, + MN_Template.width, MN_Template.height, + MN_Template.mono_bits, MN_Template.color_bits, MN_Template.mask_bits, FALSE); + + if (!templatesOpenIcon.pixmap) + fe_NewMakeIcon(widget, + fg_pixel, + bg_pixel, + &templatesOpenIcon, + NULL, + MN_TemplateO.width, MN_TemplateO.height, + MN_TemplateO.mono_bits, MN_TemplateO.color_bits, MN_TemplateO.mask_bits, FALSE); + if (!outboxIcon.pixmap) fe_NewMakeIcon(widget, fg_pixel, @@ -351,15 +370,7 @@ XFE_FolderView::initFolderIcons(Widget widget, Pixel bg_pixel, Pixel fg_pixel) MN_NewsServer.width, MN_NewsServer.height, MN_NewsServer.mono_bits, MN_NewsServer.color_bits, MN_NewsServer.mask_bits, FALSE); - if (!newsServerSecureIcon.pixmap) - fe_NewMakeIcon(widget, - fg_pixel, - bg_pixel, - &newsServerSecureIcon, - NULL, - MN_NewsServerSecure.width, MN_NewsServerSecure.height, - MN_NewsServerSecure.mono_bits, MN_NewsServerSecure.color_bits, MN_NewsServerSecure.mask_bits, FALSE); - + HG39875 if (!newsgroupIcon.pixmap) fe_NewMakeIcon(widget, fg_pixel, @@ -460,8 +471,7 @@ XFE_FolderView::isCommandEnabled(CommandType cmd, void *call_data, XFE_CommandIn ) return True; #endif - else if (IS_CMD(xfeCmdViewSecurity)) - return True; + HG07326 else if (IS_CMD(xfeCmdViewProperties)) { return count == 1; @@ -470,12 +480,27 @@ XFE_FolderView::isCommandEnabled(CommandType cmd, void *call_data, XFE_CommandIn { return !XP_IsContextBusy(m_contextData); } - else if (IS_CMD(xfeCmdSearch) - || IS_CMD(xfeCmdSearchAddress)) + else if (IS_CMD(xfeCmdSearch) ) + { + // Find current selected folder, if none, disable this button + + if (XP_IsContextBusy(m_contextData) ) return False; + + const int *selected; + int count; + + m_outliner->getSelection(&selected, &count); + + if ( count > 0 ) + return True; + else + return False; + } + else if ( IS_CMD(xfeCmdSearchAddress)) { return !XP_IsContextBusy(m_contextData); } - else if (IS_CMD(xfeCmdDelete)) + else if (IS_CMD(xfeCmdDeleteAny)) { return XFE_MNListView::isCommandEnabled(xfeCmdDeleteFolder); } @@ -483,6 +508,20 @@ XFE_FolderView::isCommandEnabled(CommandType cmd, void *call_data, XFE_CommandIn { return True; } + else if (IS_CMD(xfeCmdEditConfiguration) ) + { + MSG_FolderLine line; + if (!MSG_GetFolderLineByIndex(m_pane, selected[0], 1, &line)) + return False; + return (line.flags & MSG_FOLDER_FLAG_MAIL); + } + else if (IS_CMD(xfeCmdModerateDiscussion) ) + { + MSG_FolderLine line; + if (!MSG_GetFolderLineByIndex(m_pane, selected[0], 1, &line)) + return False; + return (line.flags & MSG_FOLDER_FLAG_NEWSGROUP); + } else if (IS_CMD(xfeCmdOpenSelected)) { MSG_FolderLine line; @@ -510,6 +549,19 @@ XFE_FolderView::isCommandEnabled(CommandType cmd, void *call_data, XFE_CommandIn &selectable, NULL, NULL, NULL); return selectable; } + else if (IS_CMD(xfeCmdRenameFolder) && count == 1) + { + MSG_FolderLine line; + if (!MSG_GetFolderLineByIndex(m_pane, selected[0], 1, &line)) + return False; + XP_Bool selectable; + + if (line.flags & MSG_FOLDER_FLAG_MAIL) + MSG_CommandStatus(m_pane, MSG_NewFolder, + (MSG_ViewIndex*)selected, count, + &selectable, NULL, NULL, NULL); + return selectable; + } else { return XFE_MNListView::isCommandEnabled(cmd, call_data, info); @@ -530,6 +582,7 @@ XFE_FolderView::handlesCommand(CommandType cmd, void *, XFE_CommandInfo*) || IS_CMD(xfeCmdRenameFolder) || IS_CMD(xfeCmdEmptyTrash) || IS_CMD(xfeCmdCompressFolders) + || IS_CMD(xfeCmdCompressAllFolders) || IS_CMD(xfeCmdAddNewsgroup) || IS_CMD(xfeCmdNewNewsHost) || IS_CMD(xfeCmdInviteToNewsgroup) @@ -557,11 +610,11 @@ XFE_FolderView::handlesCommand(CommandType cmd, void *, XFE_CommandInfo*) || IS_CMD(xfeCmdMoveFoldersInto) #endif - || IS_CMD(xfeCmdModerateDiscussion) || IS_CMD(xfeCmdMarkAllMessagesRead) || IS_CMD(xfeCmdSendMessagesInOutbox) + || IS_CMD(xfeCmdDeleteAny) || IS_CMD(xfeCmdDeleteFolder) - || IS_CMD(xfeCmdViewSecurity) + HG82883 || IS_CMD(xfeCmdViewProperties) || IS_CMD(xfeCmdUpdateMessageCount) || IS_CMD(xfeCmdShowPopup)) @@ -605,6 +658,11 @@ D( printf ("in XFE_FolderView::doCommand()\n");) /* we create a new popup each time. */ if (m_popup) delete m_popup; + + /* Need to switch focus for the popup menu so that menu items can be enabled in + the three pane world */ + + getToplevel()->notifyInterested(XFE_MNListView::changeFocus, (void*)this); m_popup = new XFE_PopupMenu("popup", (XFE_Frame*)m_toplevel, // XXXXXXX @@ -671,6 +729,9 @@ D( printf ("in XFE_FolderView::doCommand()\n");) if (!(line.level == 1 && line.flags & MSG_FOLDER_FLAG_DIRECTORY)) fe_showMessages(XtParent(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), NULL, MSG_GetFolderInfo(m_pane, selected[i]), @@ -761,28 +822,32 @@ D( printf ("in XFE_FolderView::doCommand()\n");) MSG_Command(m_pane, MSG_CompressFolder, (MSG_ViewIndex*)selected, count); } - else if (IS_CMD(xfeCmdDeleteFolder)) + else if (IS_CMD(xfeCmdCompressAllFolders)) + { + D( printf ("MSG_FolderPane::compressAllFolders()\n");) + + MSG_Command(m_pane, MSG_CompressAllFolders, (MSG_ViewIndex*)selected, count); + } + else if (IS_CMD(xfeCmdDeleteFolder) || IS_CMD(xfeCmdDeleteAny) ) { D( printf ("MSG_FolderPane::deleteFolder()\n");) MSG_Command(m_pane, MSG_DeleteFolder, (MSG_ViewIndex*)selected, count); XFE_MozillaApp::theApp()->notifyInterested(XFE_MNView::foldersHaveChanged); } - else if (IS_CMD(xfeCmdViewSecurity)) - { - D( printf ("MSG_FolderPane::viewSecurity()\n");) - fe_sec_logo_cb(NULL, m_contextData, NULL); - return; - } + HG20388 else if (IS_CMD(xfeCmdEditMailFilterRules)) { fe_showMailFilterDlg(getToplevel()->getBaseWidget(), - m_contextData); + m_contextData,m_pane); } else if (IS_CMD(xfeCmdSearchAddress)) { DD(printf ("searchAddress\n");) fe_showLdapSearch(XfeAncestorFindApplicationShell(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), (Chrome*)NULL); @@ -850,6 +915,9 @@ D( printf ("in XFE_FolderView::doCommand()\n");) // to get to the wrong frame if we don't use the real toplevel // as the base for the toplevel frames ... dora 12/31/96 fe_showMNSearch(XfeAncestorFindApplicationShell(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), NULL, this, folderInfo); @@ -874,6 +942,9 @@ D( printf ("in XFE_FolderView::doCommand()\n");) // This code taken out of SubAllView::doCommand(): XFE_NewsServerDialog *d = new XFE_NewsServerDialog(getToplevel()->getBaseWidget(), "addServer", + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData)); XP_Bool ok_pressed = d->post(); @@ -881,12 +952,12 @@ D( printf ("in XFE_FolderView::doCommand()\n");) { const char *serverName = d->getServer(); int serverPort = d->getPort(); - XP_Bool isSecure = d->isSecure(); + XP_Bool isxxx = HG72988; MSG_NewsHost *host; host = MSG_CreateNewsHost(XFE_MNView::getMaster(), serverName, - isSecure, + isxxx, serverPort); XFE_MozillaApp::theApp()->notifyInterested(XFE_MNView::foldersHaveChanged); @@ -900,11 +971,42 @@ D( printf ("in XFE_FolderView::doCommand()\n");) (MSG_ViewIndex*)selected, count); // XFE_MozillaApp::theApp()->notifyInterested(XFE_MNView::foldersHaveChanged); } - else if (IS_CMD(xfeCmdModerateDiscussion)) - { - MSG_Command(m_pane, MSG_ModerateNewsgroup, - (MSG_ViewIndex*)selected, count); + else if (IS_CMD(xfeCmdEditConfiguration) || + IS_CMD(xfeCmdModerateDiscussion) ) + { + MSG_CommandType msg_cmd = commandToMsgCmd(cmd); + MSG_Command(m_pane, msg_cmd, (MSG_ViewIndex*)selected, count); + return; + } + /* Do it now + */ + else if ( (cmd == xfeCmdComposeMessage) + || (cmd == xfeCmdComposeArticle) ) { + if (info) { + CONTEXT_DATA(m_contextData)->stealth_cmd = + ((info->event->type == ButtonRelease) && + (info->event->xkey.state & ShiftMask)); } + + MSG_Command(m_pane, commandToMsgCmd(cmd), + (MSG_ViewIndex*)selected, count); + } + else if ( (cmd == xfeCmdComposeMessageHTML) + || (cmd == xfeCmdComposeArticleHTML) ) { + CONTEXT_DATA(m_contextData)->stealth_cmd = + (fe_globalPrefs.send_html_msg == False); + MSG_Command(m_pane, commandToMsgCmd(cmd), + (MSG_ViewIndex*)selected, count); + } + else if ( (cmd == xfeCmdComposeMessagePlain) + || (cmd == xfeCmdComposeArticlePlain) ) { + CONTEXT_DATA(m_contextData)->stealth_cmd = + (fe_globalPrefs.send_html_msg == True) ; + MSG_Command(m_pane, commandToMsgCmd(cmd), + (MSG_ViewIndex*)selected, count); + } + /* End of New message + */ else { XFE_MNListView::doCommand(cmd, calldata, info); @@ -957,7 +1059,7 @@ XFE_FolderView::commandToString(CommandType cmd, void *calldata, XFE_CommandInfo else return stringFromResource("openFolderCmdString"); } - else if (IS_CMD(xfeCmdDeleteFolder)) + else if (IS_CMD(xfeCmdDeleteFolder) || IS_CMD(xfeCmdDeleteAny)) { if (count != 1) return stringFromResource("deleteFolderCmdString"); @@ -1002,12 +1104,12 @@ XFE_FolderView::commandToString(CommandType cmd, void *calldata, XFE_CommandInfo } fe_icon* -XFE_FolderView::treeInfoToIcon(int depth, int flags, XP_Bool expanded, XP_Bool secure) +XFE_FolderView::treeInfoToIcon(int depth, int flags, XP_Bool expanded, XP_Bool xxxe) { if (depth < 1) { if (flags & MSG_FOLDER_FLAG_NEWS_HOST) - return secure ? &newsServerSecureIcon : &newsServerIcon; + return HG17272 &newsServerIcon; else if (flags & MSG_FOLDER_FLAG_IMAPBOX) return &mailServerIcon; else @@ -1015,11 +1117,13 @@ XFE_FolderView::treeInfoToIcon(int depth, int flags, XP_Bool expanded, XP_Bool s } if (flags & MSG_FOLDER_FLAG_NEWSGROUP) - return &newsgroupIcon; + return HG00288 &newsgroupIcon; else if (flags & MSG_FOLDER_FLAG_INBOX) return expanded ? &inboxOpenIcon : &inboxIcon; else if (flags & MSG_FOLDER_FLAG_DRAFTS) return expanded ? &draftsOpenIcon : &draftsIcon; + else if (flags & MSG_FOLDER_FLAG_TEMPLATES) + return expanded ? &templatesOpenIcon : &templatesIcon; else if (flags & MSG_FOLDER_FLAG_TRASH) return &trashIcon; else if (flags & MSG_FOLDER_FLAG_QUEUE) @@ -1050,6 +1154,8 @@ XFE_FolderView::treeInfoToIconData(int depth, int flags, XP_Bool expanded) return expanded ? &MN_InboxO : &MN_Inbox; else if (flags & MSG_FOLDER_FLAG_DRAFTS) return expanded ? &MN_DraftO : &MN_Draft; + else if (flags & MSG_FOLDER_FLAG_TEMPLATES) + return expanded ? &MN_TemplateO : &MN_Template; else if (flags & MSG_FOLDER_FLAG_TRASH) return &MN_TrashSmall; else if (flags & MSG_FOLDER_FLAG_QUEUE) @@ -1247,10 +1353,7 @@ XFE_FolderView::getTreeInfo(XP_Bool *expandable, XP_Bool is_line_expandable; XP_Bool is_line_expanded; - is_line_expandable = ((m_folderLine.numChildren > 0) - && !(m_folderLine.flags - & MSG_FOLDER_FLAG_CAT_CONTAINER)); - + is_line_expandable = (m_folderLine.numChildren > 0); if (is_line_expandable) { is_line_expanded = !(m_folderLine.flags & MSG_FOLDER_FLAG_ELIDED); @@ -1279,20 +1382,28 @@ XFE_FolderView::getColumnStyle(int /*column*/) return (m_folderLine.unseen > 0) ? OUTLINER_Bold : OUTLINER_Default; } +#define A_BIG_BUFFER_SIZE 1024 /* I have no idea what the right size is */ + char * XFE_FolderView::getColumnText(int column) { static char unseen_a[10]; /* uniquify name for IRIX5.3 */ static char total_a[10]; + static char a_line[A_BIG_BUFFER_SIZE]; + char *loc; switch (column) { case OUTLINER_COLUMN_NAME: { - if (m_folderLine.prettyName) - return (char*)m_folderLine.prettyName; - else - return (char*)m_folderLine.name; + if (m_folderLine.prettyName) { + XP_STRNCPY_SAFE(a_line, m_folderLine.prettyName, sizeof(a_line)); + } + else { + XP_STRNCPY_SAFE(a_line, m_folderLine.name, sizeof(a_line)); + } + INTL_CONVERT_BUF_TO_LOCALE(a_line, loc); + return a_line; } case OUTLINER_COLUMN_UNREAD: @@ -1369,16 +1480,15 @@ XFE_FolderView::getColumnIcon(int column) if (column == OUTLINER_COLUMN_NAME) { - XP_Bool secure = False; - /* we need to check if newshosts are secure */ + XP_Bool xxxe = False; + /* we need to check newshosts */ if (m_folderLine.flags & MSG_FOLDER_FLAG_NEWS_HOST) { MSG_NewsHost *host = MSG_GetNewsHostForFolder(m_folderLine.id); - if (host) - secure = MSG_IsNewsHostSecure(host); + HG82992 } - return treeInfoToIcon(depth, m_folderLine.flags, expanded, secure); + return treeInfoToIcon(depth, m_folderLine.flags, expanded, xxxe); } else { @@ -1496,6 +1606,9 @@ XFE_FolderView::Buttonfunc(const OutlineButtonFuncData *data) // the alt button was held during the double click. fe_showMessages(XtParent(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this return a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), NULL, MSG_GetFolderInfo(m_pane, data->row), @@ -1589,6 +1702,9 @@ XFE_FolderView::processClick() m_outliner->selectItemExclusive(m_cur_selected[i]); #endif fe_showMessages(XtParent(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this return a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), NULL, MSG_GetFolderInfo(m_pane, data->row), @@ -2053,7 +2169,7 @@ XFE_FolderView::ProcessTargets(int row, int col, else { MSG_FolderInfo *info = MSG_GetFolderInfoFromURL(m_master, - url); + url,FALSE); MSG_ViewIndex new_index; if (!info) diff --git a/mozilla/cmd/xfe/src/Frame.cpp b/mozilla/cmd/xfe/src/Frame.cpp index 0f0b82ad9da..130911a52ff 100644 --- a/mozilla/cmd/xfe/src/Frame.cpp +++ b/mozilla/cmd/xfe/src/Frame.cpp @@ -21,7 +21,11 @@ */ +#ifndef NO_SECURITY +#include "ssl.h" +#endif +#include "rosetta.h" #include "Frame.h" #include "layers.h" @@ -75,10 +79,6 @@ #include -#ifndef NO_SECURITY -#include "ssl.h" // For Security Status defines: SSL_SECURITY_STATUS_* -#endif /* ! NO_SECURITY */ - #ifdef EDITOR #include "xeditor.h" #endif /*EDITOR*/ @@ -129,7 +129,7 @@ extern "C" { XP_Bool fe_IsPolarisInstalled(); XP_Bool fe_IsConferenceInstalled(); URL_Struct *fe_GetBrowserStartupUrlStruct(); -}; +} extern MWContext *last_documented_xref_context; extern LO_Element *last_documented_xref; @@ -162,6 +162,27 @@ MenuSpec XFE_Frame::bookmark_submenu_spec[] = { { NULL } }; +MenuSpec XFE_Frame::tools_submenu_spec[] = { + { xfeCmdOpenHistory, PUSHBUTTON }, + HG27632 +#ifndef MOZ_LITE + { xfeCmdOpenFolders, PUSHBUTTON }, +#endif + { xfeCmdJavaConsole, PUSHBUTTON }, + { NULL } +}; + +MenuSpec XFE_Frame::servertools_submenu_spec[] = { + { xfeCmdPageServices, PUSHBUTTON }, +#ifndef MOZ_LITE + { xfeCmdEditConfiguration, PUSHBUTTON }, // Mail Account + { xfeCmdManageMailingList, PUSHBUTTON }, // Mail Account + { xfeCmdManagePublicFolders, PUSHBUTTON }, + { xfeCmdModerateDiscussion, PUSHBUTTON }, // Newsgroup +#endif + { NULL } +}; + MenuSpec XFE_Frame::window_menu_spec[] = { { xfeCmdOpenNavCenter, PUSHBUTTON }, { xfeCmdOpenOrBringUpBrowser, PUSHBUTTON }, @@ -190,12 +211,13 @@ MenuSpec XFE_Frame::window_menu_spec[] = { #endif { "bookmarksSubmenu", CASCADEBUTTON, bookmark_submenu_spec }, { xfeCmdOpenHistory, PUSHBUTTON }, -#if JAVA +#ifdef JAVA { xfeCmdJavaConsole, PUSHBUTTON }, #endif -#ifndef NO_SECURITY - { xfeCmdViewSecurity, PUSHBUTTON }, -#endif + HG87782 + MENU_SEPARATOR, + { "toolsSubmenu", CASCADEBUTTON, tools_submenu_spec }, + { "serverToolsSubmenu", CASCADEBUTTON, servertools_submenu_spec }, MENU_SEPARATOR, { "frameListPlaceHolder", DYNA_MENUITEMS, NULL, NULL, False, NULL, XFE_FrameListMenu::generate }, { NULL } @@ -239,6 +261,9 @@ MenuSpec XFE_Frame::mark_submenu_spec[] = { { xfeCmdMarkAllMessagesRead, PUSHBUTTON }, { xfeCmdMarkMessageByDate, PUSHBUTTON }, { xfeCmdMarkMessageForLater, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdMarkMessage, PUSHBUTTON }, + { xfeCmdUnmarkMessage, PUSHBUTTON }, { NULL } }; @@ -525,6 +550,7 @@ const char *XFE_Frame::userActivityHere = "XFE_Frame::userActivityHere"; const char *XFE_Frame::encodingChanged = "XFE_Frame::encodingChanged"; const char *XFE_Frame::allConnectionsCompleteCallback = "XFE_Frame::allConnectionsCompleteCallback"; +#if !defined(GLUE_COMPO_CONTEXT) // Progress bar cylon notifications const char * XFE_Frame::progressBarCylonStart = "XFE_Frame::progressBarCylonStart"; const char * XFE_Frame::progressBarCylonStop = "XFE_Frame::progressBarCylonStop"; @@ -537,6 +563,7 @@ const char * XFE_Frame::progressBarUpdateText = "XFE_Frame::progressBarUpdateTex // Logo animation notifications const char * XFE_Frame::logoStartAnimation = "XFE_Frame::logoStartAnimation"; const char * XFE_Frame::logoStopAnimation = "XFE_Frame::logoStopAnimation"; +#endif /* GLUE_COMPO_CONTEXT */ const char* XFE_Frame::frameBusyCallback = "XFE_Frame::frameBusyCallback"; const char* XFE_Frame::frameNotBusyCallback = "XFE_Frame::frameNotBusyCallback"; @@ -546,6 +573,9 @@ static void resizeHandler(Widget, XtPointer, XEvent *, Boolean *); static XFE_CommandList* my_commands; +// +static char myClassName[] = "XFE_Frame::className"; + XFE_Command* XFE_Frame::getCommand(CommandType cmd) { @@ -1027,6 +1057,15 @@ XFE_Frame::XFE_Frame(char *name, doCommandCallback_cb); // Register the logo animation notifications with ourselves +#if defined(GLUE_COMPO_CONTEXT) + registerInterest(XFE_Component::logoStartAnimation, + this, + logoAnimationStartNotice_cb); + + registerInterest(XFE_Component::logoStopAnimation, + this, + logoAnimationStopNotice_cb); +#else registerInterest(XFE_Frame::logoStartAnimation, this, logoAnimationStartNotice_cb); @@ -1034,6 +1073,7 @@ XFE_Frame::XFE_Frame(char *name, registerInterest(XFE_Frame::logoStopAnimation, this, logoAnimationStopNotice_cb); +#endif /* GLUE_COMPO_CONTEXT */ } XFE_MozillaApp::theApp()->registerInterest(XFE_MozillaApp::changeInToplevelFrames, @@ -1176,6 +1216,12 @@ XFE_Frame::~XFE_Frame() // XFE_MozillaApp::theApp()->unregisterFrame(this); } + +const char* +XFE_Frame::getClassName() +{ + return myClassName; +} ////////////////////////////////////////////////////////////////////////// // // This method creates the toplevel shell of this frame. It handles @@ -1905,12 +1951,12 @@ XFE_Frame::initializeMWContext(EFrameType frame_type, } void -XFE_Frame::allConnectionsComplete() +XFE_Frame::allConnectionsComplete(MWContext *context) { /* Tao_17dec96 * Notify whoever interested in "allConnectionsComplete" event */ - notifyInterested(XFE_Frame::allConnectionsCompleteCallback); + notifyInterested(XFE_Frame::allConnectionsCompleteCallback, (void*) context); notifyInterested(XFE_View::chromeNeedsUpdating); } @@ -2158,23 +2204,7 @@ XFE_Frame::getSecurityStatus() { int rval = XFE_UNSECURE; -#ifndef NO_SECURITY - switch (XP_GetSecurityStatus(m_context)) - { - case SSL_SECURITY_STATUS_ON_HIGH: // us - case SSL_SECURITY_STATUS_ON_LOW: // export - rval = XFE_SECURE; - break; - /* rval = XFE_SECURE_MIXED; - break;*/ - case SSL_SECURITY_STATUS_NOOPT: // fall through - case SSL_SECURITY_STATUS_OFF: // fall through - case SSL_SECURITY_STATUS_FORTEZZA: // fall through (is this be secure???) - default: - rval = XFE_UNSECURE; - break; - } -#endif /* ! NO_SECURITY */ + HG87111 return rval; } @@ -2622,9 +2652,7 @@ XFE_Frame::queryChrome(Chrome * chrome) chrome->show_button_bar = m_toolbar && m_toolbar->isShown(); chrome->show_bottom_status_bar = m_dashboard && m_dashboard->isShown(); chrome->show_menu = m_menubar && m_menubar->isShown(); -#ifndef NO_SECURITY - chrome->show_security_bar = context_data->show_security_bar_p; -#endif /* ! NO_SECURITY */ + HG37211 if (isTitleBarShown()) chrome->hide_title_bar = FALSE; diff --git a/mozilla/cmd/xfe/src/Frame.h b/mozilla/cmd/xfe/src/Frame.h index 4788e5bc145..45ae9b227d4 100644 --- a/mozilla/cmd/xfe/src/Frame.h +++ b/mozilla/cmd/xfe/src/Frame.h @@ -105,6 +105,7 @@ public: virtual ~XFE_Frame(); + virtual const char* getClassName(); virtual EFrameType getType(); virtual void setTitle(char *title); @@ -178,6 +179,7 @@ public: // Encoding for this window has changed. static const char *encodingChanged; +#if !defined(GLUE_COMPO_CONTEXT) // Progress bar cylon notifications static const char *progressBarCylonStart; static const char *progressBarCylonStop; @@ -190,6 +192,7 @@ public: // Logo animation notifications static const char *logoStartAnimation; static const char *logoStopAnimation; +#endif /* GLUE_COMPO_CONTEXT */ // Frame busy notifications. static const char *frameBusyCallback; @@ -207,7 +210,7 @@ public: // called when all connections when this window are finished. // Really should be a notification... - virtual void allConnectionsComplete(); + virtual void allConnectionsComplete(MWContext *context); static const char *allConnectionsCompleteCallback; @@ -398,6 +401,9 @@ protected: static MenuSpec next_submenu_spec[]; static MenuSpec compose_message_submenu_spec[]; static MenuSpec compose_article_submenu_spec[]; + static MenuSpec tools_submenu_spec[]; + static MenuSpec servertools_submenu_spec[]; + private: diff --git a/mozilla/cmd/xfe/src/HTMLDrag.h b/mozilla/cmd/xfe/src/HTMLDrag.h index 5d353a05cac..c0405247f86 100644 --- a/mozilla/cmd/xfe/src/HTMLDrag.h +++ b/mozilla/cmd/xfe/src/HTMLDrag.h @@ -37,7 +37,7 @@ class XFE_HTMLDrag : public XFE_DragNetscape { public: XFE_HTMLDrag(Widget,MWContext*); - ~XFE_HTMLDrag(); + virtual ~XFE_HTMLDrag(); protected: MWContext *_context; URL_Struct *_dragURLStruct; diff --git a/mozilla/cmd/xfe/src/HTMLView.cpp b/mozilla/cmd/xfe/src/HTMLView.cpp index edbb2645091..575405c4c24 100644 --- a/mozilla/cmd/xfe/src/HTMLView.cpp +++ b/mozilla/cmd/xfe/src/HTMLView.cpp @@ -28,6 +28,7 @@ #define D(x) #endif +#include "rosetta.h" #include "HTMLView.h" #include "BookmarkFrame.h" #include "MozillaApp.h" @@ -561,8 +562,8 @@ XFE_HTMLView::doCommand(CommandType cmd, void *callData, XFE_CommandInfo* info) NULL, // priority NULL, // attachment NULL, // newspost_url - FALSE, // encrypt_p - FALSE); // sign_p + FALSE, // xxx_p + FALSE); // xxx2_p // Since they are only sending the link, // I am guessing that they want a plaintext editor. @@ -738,11 +739,7 @@ XFE_HTMLView::doCommand(CommandType cmd, void *callData, XFE_CommandInfo* info) getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); return; } - else if (IS_CMD(xfeCmdViewSecurity)) - { - fe_sec_logo_cb(NULL, m_contextData, NULL); - return; - } + HG28732 else if (IS_CMD(xfeCmdAddBookmark)) { History_entry *h = SHIST_GetCurrent (&m_contextData->hist); @@ -1250,10 +1247,7 @@ XFE_HTMLView::isCommandEnabled(CommandType cmd, void *calldata, XFE_CommandInfo* { return True; } - else if (IS_CMD(xfeCmdViewSecurity)) - { - return True; // should this always be enabled? - } + HG20931 else if (IS_CMD(xfeCmdOpenUrl)) { return True; // should this always be enabled? @@ -1370,7 +1364,7 @@ XFE_HTMLView::handlesCommand(CommandType cmd, void *calldata, XFE_CommandInfo*) || IS_CMD(xfeCmdRefresh) || IS_CMD(xfeCmdViewPageSource) || IS_CMD(xfeCmdViewPageInfo) - || IS_CMD(xfeCmdViewSecurity) + HG29322 || IS_CMD(xfeCmdAddBookmark) || IS_CMD(xfeCmdOpenUrl) || IS_CMD(xfeCmdOpenUrlFromSelection) diff --git a/mozilla/cmd/xfe/src/IconGroup.cpp b/mozilla/cmd/xfe/src/IconGroup.cpp index 449f3c558d0..fab169696c1 100644 --- a/mozilla/cmd/xfe/src/IconGroup.cpp +++ b/mozilla/cmd/xfe/src/IconGroup.cpp @@ -26,6 +26,8 @@ #include "IconGroup.h" #undef WANT_GROUPS +#include "rosetta.h" + ////////////////////////////////////////////////////////////////////////// // // Private functions @@ -116,7 +118,7 @@ static _name_and_group_t _iconGroups[] = { "Print", &TB_Print_group }, { "Reload", &TB_Reload_group }, { "Stop", &TB_Stop_group }, - { "MixSecurity", &TB_MixSecurity_group }, + HG29281 #ifdef MOZ_MAIL_NEWS // Mail/News { "GetMsg", &MNTB_GetMsg_group }, diff --git a/mozilla/cmd/xfe/src/IconGroup.h b/mozilla/cmd/xfe/src/IconGroup.h index 2845aa2eb66..dfd4b37b5a1 100644 --- a/mozilla/cmd/xfe/src/IconGroup.h +++ b/mozilla/cmd/xfe/src/IconGroup.h @@ -25,6 +25,7 @@ #ifndef _xfe_icongroup_h #define _xfe_icongroup_h +#include "rosetta.h" #include "mozilla.h" #include "xfe.h" #include "icons.h" @@ -80,15 +81,7 @@ ICONGROUP(TB_LoadImages) ICONGROUP(TB_Print) ICONGROUP(TB_Reload) ICONGROUP(TB_Stop) -ICONGROUP(TB_Unsecure) -ICONGROUP(TB_Secure) -ICONGROUP(TB_MixSecurity) - -/* Dashboard icons. */ -ICONGROUP_VERBOSE(Dash_Secure, &Dash_Secure, NULL, NULL, NULL) -ICONGROUP_VERBOSE(Dash_Unsecure, &Dash_Unsecure, NULL, NULL, NULL) -ICONGROUP_VERBOSE(Dash_Signed, &Dash_Signed, NULL, NULL, NULL) -ICONGROUP_VERBOSE(Dash_Unsigned, &Dash_Unsigned, NULL, NULL, NULL) +HG29081 /* Dynamic ToolBox tab icons. */ ICONGROUP_VERBOSE(DTB_bottom, &DTB_bottom, NULL, &DTB_bottom_mo, NULL) @@ -142,9 +135,7 @@ ICONGROUP(MNTB_MarkRead) /* Message Center */ ICONGROUP(MNTB_NewFolder) -/* Toolbar Security */ -ICONGROUP(MNTB_SignUnsecure) -ICONGROUP(MNTB_SignSecure) +HG10282 /* Compose Window. */ ICONGROUP(MNC_Send) diff --git a/mozilla/cmd/xfe/src/Logo.cpp b/mozilla/cmd/xfe/src/Logo.cpp index 15eb1f5be5b..55d18a470ed 100644 --- a/mozilla/cmd/xfe/src/Logo.cpp +++ b/mozilla/cmd/xfe/src/Logo.cpp @@ -16,6 +16,7 @@ * Reserved. */ /*---------------------------------------*/ +#include "prefapi.h" /* */ /* Name: Logo.cpp */ /* Description: XFE_Logo component source. */ @@ -88,7 +89,7 @@ XFE_Logo::XFE_Logo(XFE_Frame * frame, NULL); // Add tooltip to logo - fe_WidgetAddToolTips(m_widget); + fe_AddTipStringCallback(m_widget, XFE_Logo::tipStringCallback, NULL); // Add the netscape callback XtAddCallback(m_widget, @@ -679,6 +680,7 @@ XFE_Logo::logoCallback(Widget /* w */,XtPointer clientData,XtPointer callData) XfeButtonCallbackStruct * cbs = (XfeButtonCallbackStruct *) callData; XP_ASSERT( logo != NULL ); + if (!logo) return; switch(cbs->reason) { @@ -691,6 +693,28 @@ XFE_Logo::logoCallback(Widget /* w */,XtPointer clientData,XtPointer callData) break; } } + +// XFE_Logo::tipStringCallback +// Checks to see if a config pref has been set to overrule the tooltip +// string or documentation string. +/* static */ void +XFE_Logo::tipStringCallback(Widget, XtPointer closure, XtPointer call_data) +{ + XFE_TipStringCallbackStruct* cb_info = (XFE_TipStringCallbackStruct*) call_data; + char* pref; + char* value; + + if ( !cb_info ) return; + + pref = ( cb_info->reason == XFE_DOCSTRING ) ? "toolbar.logo.doc_string" : + ( cb_info->reason == XFE_TIPSTRING ) ? "toolbar.logo.tooltip" : + (char *)NULL; + + if ( pref && PREF_CopyConfigString(pref, &value) == PREF_OK ) { + *(cb_info->string) = value; + } +} + ////////////////////////////////////////////////////////////////////////// XP_Bool XFE_Logo::processTraversal(XmTraversalDirection direction) diff --git a/mozilla/cmd/xfe/src/Logo.h b/mozilla/cmd/xfe/src/Logo.h index e0da6785d7c..e61b9aa177f 100644 --- a/mozilla/cmd/xfe/src/Logo.h +++ b/mozilla/cmd/xfe/src/Logo.h @@ -92,6 +92,7 @@ private: static fe_icon_data ** _large_animation_data; static Cardinal _num_animations; static Cardinal * _animation_frame_counts; + static void tipStringCallback (Widget,XtPointer,XtPointer); void updatePixmaps (); diff --git a/mozilla/cmd/xfe/src/MNBanner.cpp b/mozilla/cmd/xfe/src/MNBanner.cpp index 3af0081e581..2e3aa9561d9 100644 --- a/mozilla/cmd/xfe/src/MNBanner.cpp +++ b/mozilla/cmd/xfe/src/MNBanner.cpp @@ -44,6 +44,7 @@ XFE_MNBanner::XFE_MNBanner(XFE_Frame *parent_frame, m_parentFrame = parent_frame; + m_isFolderShown = True; // Create the base widget - a tool item tool_item = XtVaCreateWidget("bannerItem", xfeToolItemWidgetClass, @@ -377,6 +378,7 @@ XFE_MNBanner::setShowFolder(XP_Bool show) { unsigned char arrowDir; + m_isFolderShown = show; if (!m_arrowButton ) { m_arrowButton = XtVaCreateManagedWidget("arrowb", @@ -405,3 +407,9 @@ XFE_MNBanner::setShowFolder(XP_Bool show) XtVaSetValues(m_arrowButton, XmNarrowDirection, XmARROW_DOWN, NULL); } } + +XP_Bool +XFE_MNBanner::isFolderShown() +{ + return m_isFolderShown; +} diff --git a/mozilla/cmd/xfe/src/MNBanner.h b/mozilla/cmd/xfe/src/MNBanner.h index 47e571dd303..fd1eb7f961d 100644 --- a/mozilla/cmd/xfe/src/MNBanner.h +++ b/mozilla/cmd/xfe/src/MNBanner.h @@ -74,6 +74,7 @@ public: static const char * twoPaneView; void showFolderBtn(); void setShowFolder(XP_Bool show); + XP_Bool isFolderShown(); protected: @@ -96,6 +97,7 @@ private: XFE_Frame *m_parentFrame; XFE_ProxyIcon *m_proxyicon; + XP_Bool m_isFolderShown; }; #endif /* _xfe_mnbanner_h */ diff --git a/mozilla/cmd/xfe/src/MNListView.cpp b/mozilla/cmd/xfe/src/MNListView.cpp index cf945f47d64..66ebbc50fe9 100644 --- a/mozilla/cmd/xfe/src/MNListView.cpp +++ b/mozilla/cmd/xfe/src/MNListView.cpp @@ -31,7 +31,7 @@ const char* XFE_MNListView::changeFocus = "XFE_MNListView::changeFocus"; extern int XFE_INBOX_DOESNT_EXIST; -extern "C" void fe_mailfilter_cb(Widget w, XtPointer closure, XtPointer call_data); +extern "C" void fe_showMailFilterDlg(Widget toplevel, MWContext *context, MSG_Pane *pane); XFE_MNListView::XFE_MNListView(XFE_Component *toplevel_component, XFE_View *parent_view, MWContext *context, MSG_Pane *p) @@ -102,6 +102,11 @@ XFE_MNListView::isCommandEnabled(CommandType cmd, void *calldata, XFE_CommandInf if (msg_cmd != (MSG_CommandType)~0) { + + if (IS_CMD(xfeCmdAddNewsgroup) || IS_CMD(xfeCmdInviteToNewsgroup)) { + return !XP_IsContextBusy(m_contextData); + } + if (IS_CMD(xfeCmdGetNewMessages)) { int num_inboxes = MSG_GetFoldersWithFlag(XFE_MNView::getMaster(), MSG_FOLDER_FLAG_INBOX, @@ -168,12 +173,6 @@ XFE_MNListView::isCommandEnabled(CommandType cmd, void *calldata, XFE_CommandInf }/* if */ return enabled; } - else if (IS_CMD(xfeCmdAddNewsgroup) - || IS_CMD(xfeCmdInviteToNewsgroup) - ) - { - return !XP_IsContextBusy(m_contextData); - } else if (IS_CMD(xfeCmdSelectAll)) { return True; // not sure I feel comfortable with such extremes @@ -196,10 +195,7 @@ XFE_MNListView::doCommand(CommandType cmd, void *calldata, } else if (IS_CMD(xfeCmdEditMailFilterRules)) { - fe_mailfilter_cb(getToplevel()->getBaseWidget(), - (XtPointer) m_contextData, - (XtPointer) NULL); - + fe_showMailFilterDlg(getToplevel()->getBaseWidget(),m_contextData,m_pane); } else { @@ -264,6 +260,9 @@ XFE_MNListView::commandToString(CommandType cmd, void *calldata, XFE_CommandInfo if (display_string) + if ( IS_CMD(xfeCmdAddNewsgroup) || IS_CMD(xfeCmdRenameFolder) ) + return NULL; + else return (char*)display_string; else return XFE_MNView::commandToString(cmd, calldata, info); diff --git a/mozilla/cmd/xfe/src/MNListView.h b/mozilla/cmd/xfe/src/MNListView.h index a8252257906..826e99ab862 100644 --- a/mozilla/cmd/xfe/src/MNListView.h +++ b/mozilla/cmd/xfe/src/MNListView.h @@ -40,6 +40,15 @@ public: static const char *changeFocus; + // + virtual void listChangeFinished(XP_Bool /* asynchronous */, + MSG_NOTIFY_CODE /* notify */, + MSG_ViewIndex /* where */, int32 /* num */) {}; + + virtual void paneChanged(XP_Bool /* asynchronous */, + MSG_PANE_CHANGED_NOTIFY_CODE /* notify_code */, + int32 /* value*/) {}; + // We're nice to our subclasses :) virtual Boolean handlesCommand(CommandType cmd, void *calldata = NULL, XFE_CommandInfo* i = NULL); diff --git a/mozilla/cmd/xfe/src/MNView.cpp b/mozilla/cmd/xfe/src/MNView.cpp index 35e3e040389..d60bd22084b 100644 --- a/mozilla/cmd/xfe/src/MNView.cpp +++ b/mozilla/cmd/xfe/src/MNView.cpp @@ -54,6 +54,7 @@ #include "mcom_db.h" #define _SVID3 /* for statvfs.h */ #endif + #include "xpgetstr.h" #ifdef MOZ_MAIL_NEWS @@ -89,6 +90,8 @@ fe_icon XFE_MNView::inboxIcon = { 0 }; fe_icon XFE_MNView::inboxOpenIcon = { 0 }; fe_icon XFE_MNView::draftsIcon = { 0 }; fe_icon XFE_MNView::draftsOpenIcon = { 0 }; +fe_icon XFE_MNView::templatesIcon = { 0 }; +fe_icon XFE_MNView::templatesOpenIcon = { 0 }; fe_icon XFE_MNView::filedMailIcon = { 0 }; fe_icon XFE_MNView::filedMailOpenIcon = { 0 }; fe_icon XFE_MNView::outboxIcon = { 0 }; @@ -107,12 +110,14 @@ fe_icon XFE_MNView::mailMessageReadIcon = { 0 }; fe_icon XFE_MNView::mailMessageUnreadIcon = { 0 }; fe_icon XFE_MNView::newsPostIcon = { 0 }; fe_icon XFE_MNView::draftIcon = { 0 }; +fe_icon XFE_MNView::templateIcon = { 0 }; fe_icon XFE_MNView::newsNewIcon = { 0 }; fe_icon XFE_MNView::msgReadIcon = { 0 }; fe_icon XFE_MNView::msgUnreadIcon = { 0 }; fe_icon XFE_MNView::deletedIcon = { 0 }; fe_icon XFE_MNView::msgFlagIcon = { 0 }; fe_icon XFE_MNView::collectionsIcon = { 0 }; +fe_icon XFE_MNView::mailMessageAttachIcon = { 0 }; fe_icon XFE_MNView::openSpoolIcon = { 0 }; fe_icon XFE_MNView::closedSpoolIcon = { 0 }; @@ -228,6 +233,7 @@ XFE_MNView::commandToMsgNav(CommandType cmd) MN_MSGMAP(xfeCmdNextUnreadThread, MSG_NextUnreadThread); MN_MSGMAP(xfeCmdNextFlaggedMessage, MSG_NextFlagged); MN_MSGMAP(xfeCmdFirstFlaggedMessage, MSG_FirstFlagged); + MN_MSGMAP(xfeCmdFirstUnreadMessage, MSG_FirstUnreadMessage); MN_MSGMAP(xfeCmdPreviousMessage, MSG_PreviousMessage); MN_MSGMAP(xfeCmdPreviousUnreadMessage, MSG_PreviousUnreadMessage); MN_MSGMAP(xfeCmdPreviousFlaggedMessage, MSG_PreviousFlagged); @@ -267,6 +273,7 @@ XFE_MNView::commandToMsgCmd(CommandType cmd) MN_MSGMAP(xfeCmdFetchGroupList, MSG_FetchGroupList); // subscribe ui only MN_MSGMAP(xfeCmdForwardMessage, MSG_ForwardMessage); MN_MSGMAP(xfeCmdForwardMessageQuoted, MSG_ForwardMessageQuoted); + MN_MSGMAP(xfeCmdForwardMessageInLine, MSG_ForwardMessageInline); MN_MSGMAP(xfeCmdGetNewGroups, MSG_CheckForNew); // subscribe ui only MN_MSGMAP(xfeCmdGetNewMessages, MSG_GetNewMail); MN_MSGMAP(xfeCmdGetNextNNewMsgs, MSG_GetNextChunkMessages); @@ -296,6 +303,7 @@ XFE_MNView::commandToMsgCmd(CommandType cmd) MN_MSGMAP(xfeCmdRetrieveSelectedMessages, MSG_RetrieveSelectedMessages); MN_MSGMAP(xfeCmdRot13Message, MSG_Rot13Message); MN_MSGMAP(xfeCmdSaveMessagesAs, MSG_SaveMessagesAs); + MN_MSGMAP(xfeCmdSaveAsTemplate, MSG_SaveTemplate ); MN_MSGMAP(xfeCmdSaveMessagesAsAndDelete, MSG_SaveMessagesAsAndDelete); MN_MSGMAP(xfeCmdSendMessagesInOutbox, MSG_DeliverQueuedMessages); MN_MSGMAP(xfeCmdShowAllHeaders, MSG_ShowAllHeaders); @@ -496,6 +504,9 @@ XFE_MNView::getNewNews() XFE_MailDownloadFrame *download_frame = new XFE_MailDownloadFrame(XtParent(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), m_pane); @@ -526,6 +537,9 @@ XFE_MNView::getNewMail() { XFE_MailDownloadFrame *download_frame = new XFE_MailDownloadFrame(XtParent(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), m_pane); @@ -719,6 +733,9 @@ XFE_MNView::doCommand(CommandType cmd, void *calldata, XFE_CommandInfo* info) // create progress pane XFE_MailDownloadFrame* progressFrame = new XFE_MailDownloadFrame(XfeAncestorFindApplicationShell(getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), getPane()); progressFrame->cleanUpNews(); @@ -766,14 +783,8 @@ FE_PaneChanged(MSG_Pane *pane, XP_Bool asynchronous, if (view) view->paneChanged(asynchronous, code, value); -// MSG_HandlePaneChangedNotifications(pane, asynchronous, code, value); } -#endif // MOZ_MAIL_NEWS - - -#ifdef MOZ_MAIL_NEWS - extern "C" void FE_UpdateBiff(MSG_BIFF_STATE state) { @@ -832,7 +843,7 @@ FE_DestroyMailCompositionContext(MWContext* context) XFE_Frame *f = ViewGlue_getFrame(XP_GetNonGridContext(context)); XFE_ComposeFrame *cf; - XP_ASSERT (f->getType() == FRAME_MAILNEWS_COMPOSE); + XP_ASSERT (f && f->getType() == FRAME_MAILNEWS_COMPOSE); cf = (XFE_ComposeFrame*)f; @@ -868,10 +879,11 @@ FE_ListChangeStarting(MSG_Pane* pane, XP_Bool asynchronous, MSG_PaneType paneType = MSG_GetPaneType(pane); if (paneType == MSG_THREADPANE && - (notify == MSG_NotifyScramble || + (notify == MSG_NotifyNone || + notify == MSG_NotifyScramble || notify == MSG_NotifyAll)) { - XFE_ThreadView *threadView = (XFE_ThreadView *) list_view; - threadView->listChangeStarting(asynchronous, notify, where, num); + ((XFE_ThreadView *) list_view)-> + listChangeStarting(asynchronous, notify, where, num); }/* else if */ outliner = list_view->getOutliner(); @@ -891,55 +903,38 @@ FE_ListChangeFinished(MSG_Pane* pane, XP_Bool asynchronous, // int numsel; // MSG_ViewIndex *sellist; + MSG_PaneType paneType = MSG_GetPaneType(pane); list_view = (XFE_MNListView*)MSG_GetFEData(pane); // // restore this quote out: use pane type to prevent mail/news pane // get into this flow wrongfully // - if (!list_view) + if (!list_view) { return; + } - MSG_PaneType paneType = MSG_GetPaneType(pane); if (notify == MSG_NotifyInsertOrDelete) { - if (paneType == MSG_ADDRPANE) { - XFE_ABListSearchView *abView = (XFE_ABListSearchView *) list_view; - if (abView->isSearching()) - /* Tao_12dec96 - * Added for LDAP search in AddrBook - */ - -#if defined(USE_ABCOM) - { - int error = AB_LDAPSearchResultsAB2(pane, - where, num); - } -#else - AB_LDAPSearchResults((ABPane*)pane, where, num); -#endif /* USE_ABCOM */ + if (paneType == MSG_ADDRPANE || + paneType == AB_ABPANE || + paneType == AB_PICKERPANE) { + list_view->listChangeFinished(asynchronous, notify, where, num); }/* if */ - else if (paneType == MSG_THREADPANE -#if !defined(DEL_5_0) - /* let them all fall through - */ - && num <= 0 -#endif /* DEL_5_0 */ - ) { + else if (paneType == MSG_THREADPANE) { /* we do this hack : * 1. to make our code concise; only threadview need to handle this * currently. * 2. need to deal with general cases when the time comes! */ - XFE_ThreadView *threadView = (XFE_ThreadView *) list_view; - threadView->listChangeFinished(asynchronous, notify, where, num); + list_view->listChangeFinished(asynchronous, notify, where, num); }/* else threadPane */ }/* if */ else if (paneType == MSG_THREADPANE && - (notify == MSG_NotifyChanged || + (notify == MSG_NotifyNone || + notify == MSG_NotifyChanged || notify == MSG_NotifyScramble || notify == MSG_NotifyAll)) { - XFE_ThreadView *threadView = (XFE_ThreadView *) list_view; - threadView->listChangeFinished(asynchronous, notify, where, num); + list_view->listChangeFinished(asynchronous, notify, where, num); }/* else if */ outliner = list_view->getOutliner(); @@ -947,9 +942,6 @@ FE_ListChangeFinished(MSG_Pane* pane, XP_Bool asynchronous, if (!outliner) return; - if (notify == MSG_NotifyNone) - { - } outliner->listChangeFinished(asynchronous, notify, where, num, MSG_GetNumLines(pane)); } @@ -965,6 +957,8 @@ fe_incdone(void* closure, XP_Bool result) { fe_mn_incstate* state = (fe_mn_incstate*) closure; XFE_Frame *f = ViewGlue_getFrame(state->context); + XP_ASSERT(f); + if (result) { unlink(state->filename); if (state->file) { diff --git a/mozilla/cmd/xfe/src/MNView.h b/mozilla/cmd/xfe/src/MNView.h index ef4088d3eae..ac172c3e729 100644 --- a/mozilla/cmd/xfe/src/MNView.h +++ b/mozilla/cmd/xfe/src/MNView.h @@ -83,6 +83,8 @@ public: static fe_icon inboxOpenIcon; static fe_icon draftsIcon; static fe_icon draftsOpenIcon; + static fe_icon templatesIcon; + static fe_icon templatesOpenIcon; static fe_icon filedMailIcon; static fe_icon filedMailOpenIcon; static fe_icon outboxIcon; @@ -105,11 +107,13 @@ public: static fe_icon mailMessageUnreadIcon; static fe_icon newsPostIcon; static fe_icon draftIcon; + static fe_icon templateIcon; static fe_icon newsNewIcon; static fe_icon msgReadIcon; static fe_icon msgUnreadIcon; static fe_icon deletedIcon; static fe_icon msgFlagIcon; + static fe_icon mailMessageAttachIcon; // thread selection icons; static fe_icon openSpoolIgnoredIcon; diff --git a/mozilla/cmd/xfe/src/MailDownloadFrame.cpp b/mozilla/cmd/xfe/src/MailDownloadFrame.cpp index b9d4d577f31..7559fdaa39c 100644 --- a/mozilla/cmd/xfe/src/MailDownloadFrame.cpp +++ b/mozilla/cmd/xfe/src/MailDownloadFrame.cpp @@ -250,6 +250,15 @@ XFE_MailDownloadFrame::XFE_MailDownloadFrame(Widget toplevel, // We need to do this, cause the XFE_Frame class only does so // if the have_toolbars ctor parameter is true and in our case // it is not. +#if defined(GLUE_COMPO_CONTEXT) + registerInterest(XFE_Component::logoStartAnimation, + this, + &XFE_Frame::logoAnimationStartNotice_cb); + + registerInterest(XFE_Component::logoStopAnimation, + this, + &XFE_Frame::logoAnimationStopNotice_cb); +#else registerInterest(XFE_Frame::logoStartAnimation, this, &XFE_Frame::logoAnimationStartNotice_cb); @@ -257,6 +266,7 @@ XFE_MailDownloadFrame::XFE_MailDownloadFrame(Widget toplevel, registerInterest(XFE_Frame::logoStopAnimation, this, &XFE_Frame::logoAnimationStopNotice_cb); +#endif /* GLUE_COMPO_CONTEXT */ } XFE_MailDownloadFrame::~XFE_MailDownloadFrame() @@ -265,6 +275,15 @@ XFE_MailDownloadFrame::~XFE_MailDownloadFrame() // We need to do this, cause the XFE_Frame class only does so // if the have_toolbars ctor parameter is true and in our case // it is not. +#if defined(GLUE_COMPO_CONTEXT) + unregisterInterest(XFE_Component::logoStartAnimation, + this, + &XFE_Frame::logoAnimationStartNotice_cb); + + unregisterInterest(XFE_Component::logoStopAnimation, + this, + &XFE_Frame::logoAnimationStopNotice_cb); +#else unregisterInterest(XFE_Frame::logoStartAnimation, this, &XFE_Frame::logoAnimationStartNotice_cb); @@ -272,6 +291,7 @@ XFE_MailDownloadFrame::~XFE_MailDownloadFrame() unregisterInterest(XFE_Frame::logoStopAnimation, this, &XFE_Frame::logoAnimationStopNotice_cb); +#endif /* GLUE_COMPO_CONTEXT */ } XFE_Logo * @@ -335,7 +355,7 @@ XFE_MailDownloadFrame::app_delete_response() } void -XFE_MailDownloadFrame::allConnectionsComplete() +XFE_MailDownloadFrame::allConnectionsComplete(MWContext */* context */) { D(printf ("All Connections Complete in mail download frame.\n");) diff --git a/mozilla/cmd/xfe/src/MailDownloadFrame.h b/mozilla/cmd/xfe/src/MailDownloadFrame.h index f4a57a8b2e7..4dc26ef3cf2 100644 --- a/mozilla/cmd/xfe/src/MailDownloadFrame.h +++ b/mozilla/cmd/xfe/src/MailDownloadFrame.h @@ -51,7 +51,7 @@ public: virtual void app_delete_response(); - virtual void allConnectionsComplete(); + virtual void allConnectionsComplete(MWContext *context = NULL); virtual XFE_Logo * getLogo (); virtual void configureLogo (); diff --git a/mozilla/cmd/xfe/src/MailFilterDlg.cpp b/mozilla/cmd/xfe/src/MailFilterDlg.cpp index 5371109b85a..50977bafe4a 100644 --- a/mozilla/cmd/xfe/src/MailFilterDlg.cpp +++ b/mozilla/cmd/xfe/src/MailFilterDlg.cpp @@ -42,7 +42,8 @@ extern "C" { XFE_MailFilterDlg::XFE_MailFilterDlg(Widget parent, char *name, Boolean modal, - MWContext *context): + MWContext *context, + MSG_Pane *pane): XFE_ViewDialog((XFE_View *) 0, parent, name, context, True, /* ok */ @@ -81,7 +82,8 @@ XFE_MailFilterDlg::XFE_MailFilterDlg(Widget parent, new XFE_MailFilterView(this, /* toplevel_component */ form, /* parent */ NULL, /* parent_view */ - m_context /* context */); + m_context,/* context */ + pane); setView(view); } @@ -116,7 +118,7 @@ XFE_CALLBACK_DEFN(XFE_MailFilterDlg, listChanged)(XFE_NotificationCenter */*obj* /* C API */ extern "C" void -fe_showMailFilterDlg(Widget toplevel, MWContext *context) +fe_showMailFilterDlg(Widget toplevel, MWContext *context, MSG_Pane *pane) { /* recreate every time -> delete for eaech cancel */ @@ -124,12 +126,8 @@ fe_showMailFilterDlg(Widget toplevel, MWContext *context) new XFE_MailFilterDlg(toplevel, "filterDialog", False, - context); + context, + pane); dlg->show(); } -extern "C" void -fe_mailfilter_cb(Widget w, XtPointer closure, XtPointer /* call_data */) -{ - fe_showMailFilterDlg(w, (MWContext *)closure); -} diff --git a/mozilla/cmd/xfe/src/MailFilterDlg.h b/mozilla/cmd/xfe/src/MailFilterDlg.h index 52dec3bcb56..710f772dcf9 100644 --- a/mozilla/cmd/xfe/src/MailFilterDlg.h +++ b/mozilla/cmd/xfe/src/MailFilterDlg.h @@ -34,9 +34,10 @@ class XFE_MailFilterDlg: public XFE_ViewDialog public: XFE_MailFilterDlg(Widget parent, - char *name, - Boolean modal, - MWContext *context); + char *name, + Boolean modal, + MWContext *context, + MSG_Pane *pane); virtual ~XFE_MailFilterDlg(); @@ -52,6 +53,7 @@ private: }; -extern "C" void fe_showMailFilterDlg(Widget toplevel, MWContext *context); +extern "C" void fe_showMailFilterDlg(Widget toplevel, MWContext *context, + MSG_Pane *pane); #endif /* _MAILFILTERDLG_H_ */ diff --git a/mozilla/cmd/xfe/src/MailFilterRulesView.cpp b/mozilla/cmd/xfe/src/MailFilterRulesView.cpp index 229877d80cb..4dc73f71b6f 100644 --- a/mozilla/cmd/xfe/src/MailFilterRulesView.cpp +++ b/mozilla/cmd/xfe/src/MailFilterRulesView.cpp @@ -62,15 +62,17 @@ XFE_MailFilterRulesView::XFE_MailFilterRulesView(XFE_Component *toplevel_compone m_booleanAnd = TRUE; + m_booleanAnd = TRUE; + /* Create main filter list dialog */ m_filterlist = 0; m_dialog = XtParent(parent); - if (XmIsDialogShell(m_dialog)) { #ifdef DEBUG_tao_ + if (XmIsDialogShell(m_dialog)) { printf("\n XFE_MailFilterRulesView: parent is not dialog shell\n"); -#endif }/* if */ +#endif Widget dummy; Arg av[30]; @@ -491,6 +493,26 @@ XFE_MailFilterRulesView::getTerm(int num, printf("Line %d had custom header of %s, value %s\n", num, customHdr, value->u.string); #endif + } + else if (*attrib == attribOtherHeader) { /* Custom Header */ + value->attribute = *attrib; + value->u.string = fe_GetTextField(m_scopeText[num]); + + // and get the value of the custom header (ugh!) + Widget curW; + XtVaGetValues(m_scopeOptPopup[num], + XmNmenuHistory, &curW, + 0); + XmString xmstr; + XtVaGetValues(curW, XmNlabelString, &xmstr, 0); + char* labl; + XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &labl); + XP_STRCPY(customHdr, labl); + XtFree(labl); +#ifdef DEBUG_akkana + printf("Line %d had custom header of %s, value %s\n", + num, customHdr, value->u.string); +#endif } else { /* everything else */ value->attribute = *attrib; @@ -1050,7 +1072,7 @@ XFE_MailFilterRulesView::buildWhereOpt(Dimension *width, int num_inboxes = MSG_GetFoldersWithFlag(master, MSG_FOLDER_FLAG_INBOX, &folderInfo, 1); - if (num_inboxes == 1) { + if (num_inboxes >= 1) { selArray[0] = folderInfo; MSG_GetOperatorsForFilterScopes(master, scopeMailFolder, (void**)selArray, 1, @@ -1798,6 +1820,8 @@ XFE_MailFilterRulesView::makeRules(Widget rowcol, int fake_num) XtManageChild(m_strip[num]); XtManageChild(m_content[num]); } + + // Doesn't userData also need to be deleted? } void diff --git a/mozilla/cmd/xfe/src/MailFilterView.cpp b/mozilla/cmd/xfe/src/MailFilterView.cpp index 46998de784d..b11e1d693fb 100644 --- a/mozilla/cmd/xfe/src/MailFilterView.cpp +++ b/mozilla/cmd/xfe/src/MailFilterView.cpp @@ -41,88 +41,14 @@ extern int XFE_CANNOT_EDIT_JS_MAILFILTERS; #define OUTLINER_GEOMETRY_PREF "mail.mailfilter.outliner_geometry" -/* Old struct - */ -typedef struct fe_mailfilt_data { - - Widget filterDialog; - Widget filterOutline; - Widget editDialog; - Widget deletebtn; - Widget editbtn; - - Widget filterName; - Widget rulesRC; - Widget content[5]; /* rule content RC */ - Widget scopeOpt[5]; /* scope option */ - Widget whereOpt[5]; /* where option */ - Widget scopeOptPopup[5]; - Widget whereOptPopup[5]; - Widget scopeText[5]; /* scope text */ - Widget priLevel[5]; /* priority level */ - Widget priLevelPopup[5]; - Widget whereLabel[5]; - Widget rulesLabel[5]; - Widget thenTo; - Widget thenToPopup; - Widget thenClause; - Widget thenClausePopup; - Widget priAction; - Widget priActionPopup; - Widget commandGroup; - Widget despField; - Widget strip[5]; - Widget mainDespField; - Widget filterOnBtn; - Widget filterOffBtn; - Widget filterLabel; - Widget despLabel; - Widget thenLabel; - Widget upBtn; - Widget downBtn; - Widget btnform; - - /* these are just pointers to other widgets, they are not really - * widgets themselves */ - /* priority buttons */ - Widget highBtn; - Widget lowBtn; - Widget noneBtn; - Widget logBtn; - /* selected btns */ - Widget scopeOptSelected[5]; - Widget whereOptSelected[5]; - Widget priLevelSelected[5]; - Widget thenToSelected; - Widget thenClauseSelected; - Widget priActionSelected; - Widget editOK; - Widget editCancel; - Widget ScriptBtnGroup; - Widget ScriptEdit; - - Dimension despwidth; - MSG_FilterList *filterlist; - - int curPos; - int stripCount; - XP_Bool curFilterOn; - XP_Bool logOn; -} fe_mailfilt_data; - -#if !defined(FILTER_DATA) -#define FILTER_DATA(context) (CONTEXT_DATA(context)->filtdata) -#endif - -#define VIEW_LOG 1 - XFE_MailFilterView::XFE_MailFilterView(XFE_Component *toplevel_component, Widget parent, /* the dialog form */ XFE_View *parent_view, - MWContext *context) + MWContext *context, + MSG_Pane *pane) : XFE_MNListView(toplevel_component, parent_view, context, - (MSG_Pane *) NULL), + pane), m_dataRow(-1), m_goneFilter(0), m_numGone(0) @@ -130,6 +56,8 @@ XFE_MailFilterView::XFE_MailFilterView(XFE_Component *toplevel_component, int ac; Arg av[20]; + m_pane=pane; + /* Create main filter list dialog */ m_filterlist = 0; @@ -158,6 +86,13 @@ XFE_MailFilterView::XFE_MailFilterView(XFE_Component *toplevel_component, XtAddCallback(m_downBtn, XmNactivateCallback, XFE_MailFilterView::downCallback, this); + + m_server_dropdown = new XFE_FolderDropdown(toplevel_component, + parent, + TRUE, // allow server sel + FALSE, // show newgroups + FALSE, // boldwithnew + FALSE); // showFolders /* In new 4.x spec */ XmString info = XmStringCreateLtoR(XP_GetString(XFE_MFILTER_INFO), @@ -237,50 +172,35 @@ XFE_MailFilterView::XFE_MailFilterView(XFE_Component *toplevel_component, * XFE_Outliner::change(int first, int length, int newnumrows) */ - - /* - * Provide callbacks as for entries outside world - XtVaSetValues(m_outliner->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, m_toBtn, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - */ - /* Command buttons */ - ac = 0; - Widget dummy = XtVaCreateManagedWidget("btnrowcol", + Widget cmd_rowcol = XtVaCreateManagedWidget("btnrowcol", xmRowColumnWidgetClass, parent, XmNorientation, XmVERTICAL, NULL); /* always on */ Widget newbtn = XtVaCreateWidget("newFilter", - xmPushButtonGadgetClass, dummy, + xmPushButtonGadgetClass, cmd_rowcol, NULL); m_editBtn = XtVaCreateWidget("editFilter", - xmPushButtonGadgetClass, dummy, + xmPushButtonGadgetClass, cmd_rowcol, NULL); m_deleteBtn = XtVaCreateWidget("delFilter", - xmPushButtonGadgetClass, dummy, + xmPushButtonGadgetClass, cmd_rowcol, NULL); -#if VIEW_LOG /* view log */ - Widget dummy2 = XtVaCreateManagedWidget("btnrowcol2", + Widget log_rowcol = XtVaCreateManagedWidget("btnrowcol2", xmRowColumnWidgetClass, parent, XmNorientation, XmVERTICAL, NULL); Widget viewLogBtn = XtVaCreateWidget("viewLog", - xmPushButtonGadgetClass, dummy2, + xmPushButtonGadgetClass, log_rowcol, NULL); -#endif m_text = XtVaCreateWidget("text", xmTextWidgetClass, parent, @@ -294,9 +214,7 @@ XFE_MailFilterView::XFE_MailFilterView(XFE_Component *toplevel_component, XtManageChild(m_text); XtManageChild(m_logBtn); -#if VIEW_LOG XtManageChild(viewLogBtn); -#endif XtAddCallback(newbtn, XmNactivateCallback, XFE_MailFilterView::newCallback, @@ -310,13 +228,11 @@ XFE_MailFilterView::XFE_MailFilterView(XFE_Component *toplevel_component, XtAddCallback(m_logBtn, XmNvalueChangedCallback, XFE_MailFilterView::logCallback, this); -#if VIEW_LOG XtAddCallback(viewLogBtn, XmNactivateCallback, XFE_MailFilterView::viewLogCallback, this); -#endif - XtManageChild(dummy); + XtManageChild(cmd_rowcol); XtManageChild(newbtn); XtManageChild(m_editBtn); XtManageChild(m_deleteBtn); @@ -336,32 +252,37 @@ XFE_MailFilterView::XFE_MailFilterView(XFE_Component *toplevel_component, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, m_text, 0); - XtVaSetValues(dummy, + XtVaSetValues(cmd_rowcol, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_NONE, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_NONE, 0); -#if VIEW_LOG - XtVaSetValues(dummy2, + XtVaSetValues(log_rowcol, XmNtopAttachment, XmATTACH_NONE, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, dummy, + XmNleftWidget, cmd_rowcol, XmNbottomWidget, m_text, 0); -#endif XtVaSetValues(orderBox, XmNtopAttachment, XmATTACH_NONE, XmNleftAttachment, XmATTACH_NONE, XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, dummy, + XmNrightWidget, cmd_rowcol, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, m_logBtn, 0); + XtVaSetValues(m_server_dropdown->getBaseWidget(), + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); XtVaSetValues(outlinerLabel, - XmNtopAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, m_server_dropdown->getBaseWidget(), XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_NONE, XmNbottomAttachment, XmATTACH_NONE, @@ -409,16 +330,6 @@ XFE_MailFilterView::XFE_MailFilterView(XFE_Component *toplevel_component, (XFE_NotificationCenter *) this, (XFE_FunctionNotification) updateCommands_cb); - - /* for extern C ; old stuff - */ - fe_mailfilt_data *d; - d = FILTER_DATA(context) = XP_NEW_ZAP(fe_mailfilt_data); - - d->filterlist = m_filterlist; - d->filterOutline = m_outliner->getBaseWidget(); - d->editDialog = NULL; - d->curPos = 0; } void XFE_MailFilterView::listChanged(int which) @@ -862,22 +773,7 @@ void XFE_MailFilterView::viewLogCallback(Widget w, void XFE_MailFilterView::viewLogCB(Widget, XtPointer) { - XFE_Frame * frame = NULL; - - // Try to use context's frame since dialog does not - // have pane ! - frame = ViewGlue_getFrame(m_contextData); - if (frame && frame->isAlive()) { - EFrameType type = frame->getType(); - if (type == FRAME_MAILNEWS_THREAD || - type == FRAME_MAILNEWS_FOLDER) { - - XFE_MNView *mnView = (XFE_MNView *)frame->getView(); - MSG_Pane *pane = mnView->getPane(); - if (pane) - MSG_ViewFilterLog(pane); - }/* if */ - }/* if */ + MSG_ViewFilterLog(m_pane); }/* XFE_MailFilterView::viewLogCB() */ void XFE_MailFilterView::apply() @@ -953,11 +849,12 @@ void XFE_MailFilterView::editCB(Widget , XtPointer) XFE_MailFilterView::~XFE_MailFilterView() { +#if 0 fe_mailfilt_data *d = FILTER_DATA(m_contextData); if (d) XP_FREE((fe_mailfilt_data *) d); FILTER_DATA(m_contextData) = 0; - +#endif getToplevel()->unregisterInterest(XFE_View::chromeNeedsUpdating, (XFE_NotificationCenter *)this, (XFE_FunctionNotification)updateCommands_cb); diff --git a/mozilla/cmd/xfe/src/MailFilterView.h b/mozilla/cmd/xfe/src/MailFilterView.h index 8fea037544a..1fed57fe9df 100644 --- a/mozilla/cmd/xfe/src/MailFilterView.h +++ b/mozilla/cmd/xfe/src/MailFilterView.h @@ -27,7 +27,7 @@ #include "msg_filt.h" #include "msg_srch.h" - +#include "FolderDropdown.h" #include "MNListView.h" @@ -37,7 +37,8 @@ public: XFE_MailFilterView(XFE_Component *toplevel_component, Widget parent, XFE_View *parent_view, - MWContext *context); + MWContext *context, + MSG_Pane *pane); virtual ~XFE_MailFilterView(); // The Outlinable interface. @@ -122,12 +123,15 @@ protected: private: XFE_CALLBACK_DECL(updateCommands) - XFE_Outliner *m_outliner; + XFE_Outliner *m_outliner; + XFE_FolderDropdown *m_server_dropdown; + int m_dataRow; MSG_FilterList *m_filterlist; MSG_Filter *m_filter; MSG_Filter **m_goneFilter; + MSG_Pane *m_pane; int m_numGone; Widget m_editBtn; diff --git a/mozilla/cmd/xfe/src/MailFolderPropDialog.cpp b/mozilla/cmd/xfe/src/MailFolderPropDialog.cpp index 031092a69e8..098ebdd87c2 100644 --- a/mozilla/cmd/xfe/src/MailFolderPropDialog.cpp +++ b/mozilla/cmd/xfe/src/MailFolderPropDialog.cpp @@ -25,6 +25,12 @@ #include "MailFolderPropDialog.h" #include "PropertySheetView.h" #include "MNView.h" +#include "xfe.h" +#include "felocale.h" +#include "msgcom.h" +#include "imap.h" +#include "xpgetstr.h" + #include #include #include @@ -32,11 +38,8 @@ #include #include -#include "xfe.h" -#include "felocale.h" - -#include "xpgetstr.h" -extern int XFE_GENERAL; +extern int XFE_GENERAL, XFE_SHARING, XFE_ACL_NOT_SUPPORTED; +extern int XFE_ACL_FOLDER_TYPE, XFE_ACL_PERMISSIONS, XFE_ACL_SHARE_PRIVILEGES; static XFE_MailFolderPropDialog *theDialog = NULL; @@ -322,12 +325,219 @@ XFE_MailFolderPropGeneralTab::apply() XtFree(folder_name); } +XFE_MailFolderPropSharingTab::XFE_MailFolderPropSharingTab(XFE_Component *top, + XFE_View *view, + MSG_Pane *pane, + MSG_FolderInfo *folder) + : XFE_PropertyTabView(top, view, XFE_SHARING) +{ + char *p; + XP_Bool supports_acl; // Does the server support ACL ? + XmString str; + Widget kids[15]; + int i = 0; + + m_folder = folder; + m_pane = pane; + + supports_acl = MSG_GetFolderNeedsACLListed(folder); + + top_form = XtCreateManagedWidget("top_form", + xmFormWidgetClass, + getBaseWidget(), + NULL, 0); + + if (supports_acl) { + bottom_form = XtCreateManagedWidget("bottom_form", + xmFormWidgetClass, + getBaseWidget(), + NULL, 0); + + sep = XtCreateManagedWidget("sep", + xmSeparatorGadgetClass, + getBaseWidget(), + NULL, 0); + + } else { + str = XmStringCreate(XP_GetString(XFE_ACL_NOT_SUPPORTED), + XmFONTLIST_DEFAULT_TAG); + not_supported = XtVaCreateManagedWidget("not_supported", + xmLabelGadgetClass, + top_form, + XmNlabelString, str, + NULL); + XmStringFree(str); + } + + XtVaSetValues(top_form, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_FORM, + NULL); + + + if (supports_acl) { + Widget folder_type_label, folder_type_string; + Widget folder_type_desc, folder_perm_label, folder_perm_string; + Widget share_privileges, privileges_button; + + str = XmStringCreate(XP_GetString(XFE_ACL_FOLDER_TYPE), + XmFONTLIST_DEFAULT_TAG); + folder_type_label = kids[i++] + = XtVaCreateWidget("folderTypeLabel", + xmLabelGadgetClass, + top_form, + XmNlabelString, str, + NULL); + XmStringFree(str); + + p = MSG_GetFolderTypeName(folder); + + str = XmStringCreate(p, XmFONTLIST_DEFAULT_TAG); + + folder_type_string = kids[i++] + = XtVaCreateWidget("folderType", + xmLabelGadgetClass, + top_form, + XmNlabelString, str, + NULL); + XP_FREE(p); + XmStringFree(str); + + p = MSG_GetFolderTypeDescription(folder); + str = XmStringCreate(p, XmFONTLIST_DEFAULT_TAG); + + folder_type_desc = kids[i++] + = XtVaCreateWidget("folderTypeDescription", + xmLabelGadgetClass, + top_form, + XmNlabelString, str, + NULL); + XP_FREE(p); + XmStringFree(str); + + str = XmStringCreate(XP_GetString(XFE_ACL_PERMISSIONS), + XmFONTLIST_DEFAULT_TAG); + folder_perm_label = kids[i++] = + XtVaCreateWidget("folderPermissions", + xmLabelGadgetClass, + top_form, + XmNlabelString, str, + NULL); + XmStringFree(str); + + p = MSG_GetACLRightsStringForFolder(folder); + + str = XmStringCreate(p, XmFONTLIST_DEFAULT_TAG); + + folder_perm_string = kids[i++] + = XtVaCreateWidget("folderACLString", + xmLabelGadgetClass, + top_form, + XmNlabelString, str, + NULL); + XP_FREE(p); + XmStringFree(str); + + // Layout + XtVaSetValues(folder_type_label, + XmNleftAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_FORM, + NULL); + + XtVaSetValues(folder_type_string, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, folder_type_label, + XmNtopAttachment, XmATTACH_FORM, + NULL); + + XtVaSetValues(folder_type_desc, + XmNleftAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, folder_type_label, + NULL); + + XtVaSetValues(folder_perm_label, + XmNleftAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, folder_type_desc, + NULL); + + XtVaSetValues(folder_perm_string, + XmNleftAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, folder_perm_label, + NULL); + + // Manage the kids + XtManageChildren(kids, i); + +#if 0 + str = XmStringCreate(XP_GetString(XFE_ACL_SHARE_PRIVILEGES), + XmFONTLIST_DEFAULT_TAG); +#endif + // This should come from XFE_ACL_SHARE_PRIVILEGE + // But I can't figure out a way to do multiline labels. So reverting + // to the resources file + share_privileges = XtVaCreateManagedWidget("sharePrivilegesLabel", + xmLabelGadgetClass, + bottom_form, + //XmNlabelString, str, + NULL); +#if 0 + XmStringFree(str); +#endif + + privileges_button = XtVaCreateManagedWidget("Privileges", + xmPushButtonGadgetClass, + bottom_form, + NULL); + + XtVaSetValues(sep, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, top_form, + NULL); + + XtVaSetValues(bottom_form, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, sep, + XmNbottomAttachment, XmATTACH_FORM, + NULL); + + XtVaSetValues(share_privileges, + XmNleftAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_FORM, + NULL); + + XtVaSetValues(privileges_button, + XmNleftAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, share_privileges, + NULL); + + } +} + +XFE_MailFolderPropSharingTab::~XFE_MailFolderPropSharingTab() +{ +} + +void +XFE_MailFolderPropSharingTab::apply() +{ + // There is nothing to apply +} + XFE_MailFolderPropDialog::XFE_MailFolderPropDialog(Widget parent, char *name, MWContext *context, MSG_Pane *pane, MSG_FolderInfo *folder) - : XFE_PropertySheetDialog((XFE_View*)0, parent, name, + : XFE_PropertySheetDialog((XFE_View*)0, parent, name, context, TRUE, /* ok */ TRUE, /* cancel */ @@ -336,10 +546,12 @@ XFE_MailFolderPropDialog::XFE_MailFolderPropDialog(Widget parent, FALSE, /* separator */ True) /* modal */ { - XFE_PropertySheetView* folderView = (XFE_PropertySheetView *) m_view; + XFE_PropertySheetView* folderView = (XFE_PropertySheetView *) m_view; - folderView->addTab(new XFE_MailFolderPropGeneralTab(this, - folderView, pane, folder)); + folderView->addTab(new XFE_MailFolderPropGeneralTab(this, folderView, + pane, folder)); + folderView->addTab(new XFE_MailFolderPropSharingTab(this, folderView, + pane, folder)); } XFE_MailFolderPropDialog::~XFE_MailFolderPropDialog() @@ -356,7 +568,8 @@ fe_showMailFolderProperties(Widget parent, if (theDialog) delete theDialog; - theDialog = new XFE_MailFolderPropDialog(parent, "MailFolderProps", context, pane, folder); + theDialog = new XFE_MailFolderPropDialog(parent, "MailFolderProps", + context, pane, folder); theDialog->show(); } diff --git a/mozilla/cmd/xfe/src/MailFolderPropDialog.h b/mozilla/cmd/xfe/src/MailFolderPropDialog.h index 81bff397161..cebd87c7a9a 100644 --- a/mozilla/cmd/xfe/src/MailFolderPropDialog.h +++ b/mozilla/cmd/xfe/src/MailFolderPropDialog.h @@ -46,6 +46,26 @@ private: Widget m_namevalue; }; +class XFE_MailFolderPropSharingTab : public XFE_PropertyTabView +{ +public: + XFE_MailFolderPropSharingTab(XFE_Component *top, + XFE_View *view, + MSG_Pane *pane, + MSG_FolderInfo *folder); + virtual ~XFE_MailFolderPropSharingTab(); + + void apply(); + +private: + MSG_FolderInfo *m_folder; + MSG_Pane *m_pane; + Widget top_form; + Widget bottom_form; + Widget sep; + Widget not_supported; +}; + class XFE_MailFolderPropDialog : public XFE_PropertySheetDialog { public: diff --git a/mozilla/cmd/xfe/src/Makefile b/mozilla/cmd/xfe/src/Makefile index f80bd116269..b88e0b73705 100644 --- a/mozilla/cmd/xfe/src/Makefile +++ b/mozilla/cmd/xfe/src/Makefile @@ -22,6 +22,8 @@ include $(DEPTH)/config/config.mk MODULE = xfe2 USE_3PANE = 1 +USE_ABCOM = 1 +GLUE_COMPO_CONTEXT = 1 LIBRARY_NAME = xfe2 @@ -50,8 +52,10 @@ REQUIRES =\ xfeicons \ rdf \ xpcom \ - plug \ - netcnvts + netcnvts \ + msg \ + progress \ + plug CPPSRCS = \ plugin.cpp \ @@ -133,6 +137,8 @@ endif ifdef MOZ_MAIL_NEWS CPPSRCS += \ + ABComplPickerDlg.cpp \ + ABComplPickerView.cpp \ ABDirGenTabView.cpp \ ABDirPropertyDlg.cpp \ ABSearchDlg.cpp \ @@ -181,7 +187,6 @@ CPPSRCS += \ FolderPromptDialog.cpp \ FolderMenu.cpp \ FolderView.cpp \ - Frame.cpp \ $(NULL) endif @@ -212,6 +217,14 @@ CPPSRCS += \ NewsServerPropDialog.cpp \ NewsgroupPropDialog.cpp \ OptionFolderView.cpp \ + PrefsDialogMServer.cpp \ + PrefsDialogNServer.cpp \ + PrefsMailFolderDlg.cpp \ + PrefsPageAddress.cpp \ + PrefsPageMessages.cpp \ + PrefsPageNServer.cpp \ + ProgressFrame.cpp \ + SubUpgradeDialog.cpp \ $(NULL) endif @@ -221,19 +234,6 @@ CPPSRCS += \ $(NULL) endif -ifdef MOZ_LDAP -CPPSRCS += \ - PrefsLdapProp.cpp \ - PrefsMserverMore.cpp \ - $(NULL) -endif - -ifdef MOZ_MAIL_NEWS -CPPSRCS += \ - PrefsMsgMore.cpp \ - $(NULL) -endif - ifdef MOZ_MAIL_NEWS CPPSRCS += \ PropertySheetDialog.cpp \ @@ -293,9 +293,10 @@ CSRCS = commands.c include $(DEPTH)/config/rules.mk -INCLUDES += -I$(OBJDIR) -I.. -I../DtWidgets -I$(DEPTH)/modules/libreg/include +INCLUDES += -I$(OBJDIR) -I.. -I../DtWidgets -I$(DEPTH)/modules/libreg/include \ + -I$(DEPTH)/lib/libmsg -I$(DEPTH)/dist/public/security -I$(DEPTH)/dist/public/ldap -#ifndef MOZ_LITE +#ifdef MOZ_MAIL_NEWS #CFLAGS += -DEDITOR #endif @@ -306,15 +307,20 @@ ifdef USE_3PANE DEFINES += -DUSE_3PANE endif +ifdef MOZ_MAIL_NEWS ifdef USE_ABCOM DEFINES += -DUSE_ABCOM endif +endif + +ifdef GLUE_COMPO_CONTEXT +DEFINES += -DGLUE_COMPO_CONTEXT +endif ifdef USE_MOTIF_DND DEFINES += -DUSE_MOTIF_DND endif - $(LIBRARY): $(OBJS) # note the header file is generated as a side effect here. diff --git a/mozilla/cmd/xfe/src/MozillaApp.cpp b/mozilla/cmd/xfe/src/MozillaApp.cpp index a20cbbc97dd..e5ae60cbbfe 100644 --- a/mozilla/cmd/xfe/src/MozillaApp.cpp +++ b/mozilla/cmd/xfe/src/MozillaApp.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "Frame.h" #include "MozillaApp.h" #include "ViewGlue.h" @@ -803,8 +803,17 @@ xfeDoRemoteCommand (Widget w, XEvent *event, printf ("xfeDoRemoteCommand: params[0] = %s\n", params[0]); #endif + // + // Somewhere along the line, the CST people started using "xfeDoCmd" + // instead of "xfeDoCommand". We really dont know why this happened, + // but the net result is that we need to handle the "xfeDoCmd" string + // just as "xfeDoCommand" for -remote operations which otheriwse would + // be broken in calendar. + // + /* if the first argument is xfeDoCommand, skip it. */ - if (!strcmp(params[0], "xfeDoCommand")) + if ((!strcmp(params[0], "xfeDoCommand")) || + (!strcmp(params[0], "xfeDoCmd"))) { first_param = 1; numparams --; @@ -903,7 +912,7 @@ xfeDoCommandAction(Widget w, XEvent *event, ** whether or not hot keys are enabled */ cmd != xfeCmdExit && - cmd != xfeCmdViewSecurity && + HG20363 cmd != xfeCmdCut && cmd != xfeCmdCopy && cmd != xfeCmdPaste) diff --git a/mozilla/cmd/xfe/src/MsgFrame.cpp b/mozilla/cmd/xfe/src/MsgFrame.cpp index 49b3d1f1594..63b693f446b 100644 --- a/mozilla/cmd/xfe/src/MsgFrame.cpp +++ b/mozilla/cmd/xfe/src/MsgFrame.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "MsgFrame.h" #include "MsgView.h" #include "ThreadView.h" @@ -48,10 +48,9 @@ extern int XFE_MN_UNREAD_AND_TOTAL; extern "C" void fe_set_scrolled_default_size(MWContext *context); MenuSpec XFE_MsgFrame::file_menu_spec[] = { - { "newSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::new_submenu_spec }, + { "newSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::new_submenu_spec }, MENU_SEPARATOR, - { xfeCmdSaveMessagesAs, PUSHBUTTON }, - { xfeCmdEditMessage, PUSHBUTTON }, + { "saveMsgAs", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::save_submenu_spec }, MENU_SEPARATOR, { xfeCmdRenameFolder, PUSHBUTTON }, { xfeCmdEmptyTrash, PUSHBUTTON }, @@ -92,17 +91,13 @@ MenuSpec XFE_MsgFrame::edit_menu_spec[] = { { xfeCmdSearch, PUSHBUTTON }, { xfeCmdSearchAddress, PUSHBUTTON }, MENU_SEPARATOR, - { xfeCmdEditConfiguration, PUSHBUTTON }, - { xfeCmdModerateDiscussion, PUSHBUTTON }, - MENU_SEPARATOR, { xfeCmdEditMailFilterRules,PUSHBUTTON }, { xfeCmdEditPreferences, PUSHBUTTON }, { NULL } }; MenuSpec XFE_MsgFrame::view_menu_spec[] = { - { xfeCmdToggleNavigationToolbar,PUSHBUTTON }, - { xfeCmdToggleLocationToolbar, PUSHBUTTON }, +{ "showSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::show_submenu_spec }, MENU_SEPARATOR, { "headersSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::headers_submenu_spec }, // This should just be a toggle. -slamm @@ -132,6 +127,8 @@ MenuSpec XFE_MsgFrame::message_menu_spec[] = { { "replySubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::reply_submenu_spec }, { xfeCmdForwardMessage, PUSHBUTTON }, { xfeCmdForwardMessageQuoted, PUSHBUTTON }, + { xfeCmdForwardMessageInLine, PUSHBUTTON }, + { xfeCmdEditMessage, PUSHBUTTON }, MENU_SEPARATOR, { "addToABSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::addrbk_submenu_spec }, { "fileSubmenu", DYNA_CASCADEBUTTON, NULL, NULL, @@ -139,7 +136,7 @@ MenuSpec XFE_MsgFrame::message_menu_spec[] = { { "copySubmenu", DYNA_CASCADEBUTTON, NULL, NULL, False, (void*)xfeCmdCopyMessage, XFE_FolderMenu::generate }, MENU_SEPARATOR, - { "markSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::mark_submenu_spec }, + { "markSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::mark_submenu_spec }, { xfeCmdMarkMessage, PUSHBUTTON }, { xfeCmdUnflagMessage, PUSHBUTTON }, MENU_SEPARATOR, @@ -171,7 +168,7 @@ MenuSpec XFE_MsgFrame::menu_bar_spec[] = { { xfeMenuFile, CASCADEBUTTON, file_menu_spec }, { xfeMenuEdit, CASCADEBUTTON, edit_menu_spec }, { xfeMenuView, CASCADEBUTTON, view_menu_spec }, - { xfeMenuGo, CASCADEBUTTON, go_menu_spec }, + { xfeMenuGo, CASCADEBUTTON, XFE_ThreadFrame::go_menu_spec }, { xfeMenuMessage, CASCADEBUTTON, message_menu_spec }, { xfeMenuWindow, CASCADEBUTTON, XFE_Frame::window_menu_spec }, { xfeMenuHelp, CASCADEBUTTON, XFE_Frame::help_menu_spec }, @@ -237,11 +234,7 @@ ToolbarSpec XFE_MsgFrame::toolbar_spec[] = { XFE_TOOLBAR_DELAY_LONG // Popup delay }, { xfeCmdPrint, PUSHBUTTON, &TB_Print_group }, - { xfeCmdViewSecurity, PUSHBUTTON, - &TB_Unsecure_group, - &TB_Secure_group, - &MNTB_SignUnsecure_group, - &MNTB_SignSecure_group}, + HG71611 { xfeCmdMarkMessageRead, // XX news only CASCADEBUTTON, &MNTB_MarkRead_group, NULL, NULL, NULL, // Icons @@ -300,8 +293,7 @@ XFE_MsgFrame::XFE_MsgFrame(Widget toplevel, XFE_Frame *parent_frame, Chrome *chr // Configure the dashboard XP_ASSERT( m_dashboard != NULL ); - m_dashboard->setShowSecurityIcon(True); - m_dashboard->setShowSignedIcon(True); + HG11111 m_dashboard->setShowStatusBar(True); m_dashboard->setShowProgressBar(True); @@ -456,9 +448,9 @@ void XFE_MsgFrame::setButtonsByContext(MWContextType cxType) } void -XFE_MsgFrame::allConnectionsComplete() +XFE_MsgFrame::allConnectionsComplete(MWContext *context) { - XFE_Frame::allConnectionsComplete(); + XFE_Frame::allConnectionsComplete(context); updateReadAndTotalCounts(); } @@ -707,37 +699,8 @@ fe_showMsg(Widget toplevel, int XFE_MsgFrame::getSecurityStatus() { - XP_Bool is_signed = False; - XP_Bool is_encrypted = False; - XFE_MsgView *mview = (XFE_MsgView*)m_view; XFE_MailSecurityStatusType status = XFE_UNSECURE_UNSIGNED; - - MIME_GetMessageCryptoState(getContext(), 0, 0, &is_signed, &is_encrypted); - - if (mview && mview->isDisplayingNews() ) - { - // If this is displaying news, we decide if a newsgroup is secure(encrypted) - // or not by checking the security status ...instead of the crypto state - - is_encrypted = XFE_Frame::getSecurityStatus() == XFE_SECURE; - } - - if (is_encrypted && is_signed ) - { - status = XFE_SECURE_SIGNED; - } - else if (!is_encrypted && is_signed) - { - status = XFE_UNSECURE_SIGNED; - } - else if (is_encrypted && !is_signed) - { - status = XFE_SECURE_UNSIGNED; - } - else if (!is_encrypted && !is_signed ) - { - status = XFE_UNSECURE_UNSIGNED; - } + HG98200 return status; } diff --git a/mozilla/cmd/xfe/src/MsgFrame.h b/mozilla/cmd/xfe/src/MsgFrame.h index f5c0c9de4ac..365f7e5a333 100644 --- a/mozilla/cmd/xfe/src/MsgFrame.h +++ b/mozilla/cmd/xfe/src/MsgFrame.h @@ -26,6 +26,7 @@ #define _xfe_msgframe_h #include "Frame.h" +#include "ThreadFrame.h" #include "MNBanner.h" #include "xp_core.h" @@ -51,7 +52,7 @@ public: virtual XP_Bool isOkToClose(); - virtual void allConnectionsComplete(); + virtual void allConnectionsComplete(MWContext *context = NULL); void loadMessage(MSG_FolderInfo *folder_info, MessageKey msg_key); MSG_FolderInfo *getFolderInfo(); diff --git a/mozilla/cmd/xfe/src/MsgView.cpp b/mozilla/cmd/xfe/src/MsgView.cpp index 3f8e534777f..2d6f747dc4f 100644 --- a/mozilla/cmd/xfe/src/MsgView.cpp +++ b/mozilla/cmd/xfe/src/MsgView.cpp @@ -30,6 +30,10 @@ #include "xpgetstr.h" #include "prefapi.h" +#if defined(USE_ABCOM) +#include "ABListSearchView.h" +#endif + #include "ViewGlue.h" #include "MNSearchFrame.h" #include "ThreadFrame.h" @@ -64,10 +68,11 @@ MenuSpec XFE_MsgView::separator_spec[] = { MenuSpec XFE_MsgView::repl_spec[] = { // Setting the call data to non-null is a signal to commandToString // not to reset the menu string - { xfeCmdReplyToSender, PUSHBUTTON, NULL, NULL, NULL, "reply-to-sender" }, - { xfeCmdReplyToAll, PUSHBUTTON, NULL, NULL, NULL, "reply-to-all" }, + { xfeCmdReplyToSender, PUSHBUTTON, NULL, NULL, False, "reply-to-sender" }, + { xfeCmdReplyToAll, PUSHBUTTON, NULL, NULL, False, "reply-to-all" }, { xfeCmdForwardMessage, PUSHBUTTON }, { xfeCmdForwardMessageQuoted, PUSHBUTTON }, + { xfeCmdForwardMessageInLine, PUSHBUTTON }, { NULL } }; @@ -202,6 +207,12 @@ XFE_MsgView::XFE_MsgView(XFE_Component *toplevel_component, m_htmlView->show(); +#if defined(USE_ABCOM) + int error = + AB_SetShowPropertySheetForEntryFunc((MSG_Pane *) m_pane, + &XFE_ABListSearchView::ShowPropertySheetForEntryFunc); +#endif /* USE_ABCOM */ + setBaseWidget(panedW); } @@ -476,6 +487,7 @@ XFE_MsgView::paneChanged(XP_Bool asynchronous, { case MSG_PaneNotifyFolderDeleted: { +#ifndef USE_3PANE /* test frame type */ XFE_Frame *frame = (XFE_Frame*)m_toplevel; @@ -489,6 +501,7 @@ XFE_MsgView::paneChanged(XP_Bool asynchronous, }/* if */ }/* if */ +#endif } /* shall we update banner or simply return? NO */ @@ -557,6 +570,35 @@ XFE_MsgView::isCommandEnabled(CommandType cmd, void *calldata, XFE_CommandInfo*) &selectable, NULL, NULL, NULL); return selectable; } +#if defined(USE_ABCOM) + if (IS_CMD(xfeCmdAddSenderToAddressBook)|| + IS_CMD(xfeCmdAddAllToAddressBook)) { + + XP_List *abList = AB_AcquireAddressBookContainers(m_contextData); + XP_ASSERT(abList); + int nDirs = XP_ListCount(abList); + + XP_Bool selectable = False; + if (!nDirs) + return selectable; + + /* XFE always returns the first one + */ + AB_ContainerInfo *destAB = + (AB_ContainerInfo *) XP_ListGetObjectNum(abList,1); + XP_ASSERT(destAB); + + int error = MSG_AddToAddressBookStatus(m_pane, + commandToMsgCmd(cmd), + NULL, + 0, + &selectable, NULL, NULL, NULL, + destAB); + error = AB_ReleaseContainersList(abList); + + return selectable; + }/* if */ +#endif /* USE_ABCOM */ MSG_MotionType nav_cmd; MSG_CommandType msg_cmd; @@ -694,12 +736,39 @@ XFE_MsgView::doCommand(CommandType cmd, if (IS_CMD(xfeCmdMommy)) { fe_showMessages(XtParent(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), NULL, m_folderInfo, fe_globalPrefs.reuse_thread_window, False, MSG_MESSAGEKEYNONE); } +#if defined(USE_ABCOM) + else if (IS_CMD(xfeCmdAddSenderToAddressBook)|| + IS_CMD(xfeCmdAddAllToAddressBook)) { + + XP_List *abList = AB_AcquireAddressBookContainers(m_contextData); + XP_ASSERT(abList); + int nDirs = XP_ListCount(abList); + + if (nDirs) { + /* XFE always returns the first one + */ + AB_ContainerInfo *destAB = + (AB_ContainerInfo *) XP_ListGetObjectNum(abList,1); + XP_ASSERT(destAB); + + int error = MSG_AddToAddressBook(m_pane, + commandToMsgCmd(cmd), + NULL, + 0, + destAB); + error = AB_ReleaseContainersList(abList); + }/* if */ + }/* if */ +#endif /* USE_ABCOM */ else if (IS_CMD(xfeCmdGetNewMessages)) { getNewMail(); @@ -730,6 +799,9 @@ XFE_MsgView::doCommand(CommandType cmd, // the base widget is the real toplevel widget already...dora 12/31/96 // Grabbed this from ThreadView.cpp -slamm 2/19/96 fe_showMNSearch(XfeAncestorFindApplicationShell(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), NULL, this, m_folderInfo); } @@ -917,6 +989,9 @@ XFE_MsgView::doCommand(CommandType cmd, /* in message win */ MWContext *thrContext = fe_showMessages(XtParent(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), NULL, info, @@ -924,6 +999,7 @@ XFE_MsgView::doCommand(CommandType cmd, False, resultId); if (thrContext) { XFE_ThreadFrame *tFrame = (XFE_ThreadFrame *) ViewGlue_getFrame(thrContext); + XP_ASSERT(tFrame); threadView = (XFE_ThreadView *) tFrame->getView(); if (threadView) { switch (nav_cmd) { @@ -950,11 +1026,11 @@ XFE_MsgView::handlesCommand(CommandType cmd, void *calldata, XFE_CommandInfo*) if ( IS_CMD(xfeCmdSaveAs) || IS_CMD(xfeCmdSaveMessagesAs) + || IS_CMD(xfeCmdSaveAsTemplate) || IS_CMD(xfeCmdAddSenderToAddressBook) || IS_CMD(xfeCmdAddAllToAddressBook) - || IS_CMD(xfeCmdSaveMessagesAs) || IS_CMD(xfeCmdGetNewMessages) || IS_CMD(xfeCmdGetNextNNewMsgs) || IS_CMD(xfeCmdPrint) @@ -968,6 +1044,7 @@ XFE_MsgView::handlesCommand(CommandType cmd, void *calldata, XFE_CommandInfo*) || IS_CMD(xfeCmdNextUnreadThread) || IS_CMD(xfeCmdNextCollection) || IS_CMD(xfeCmdNextUnreadCollection) + || IS_CMD(xfeCmdFirstUnreadMessage) || IS_CMD(xfeCmdFirstFlaggedMessage) || IS_CMD(xfeCmdPreviousFlaggedMessage) || IS_CMD(xfeCmdNextFlaggedMessage) @@ -993,6 +1070,7 @@ XFE_MsgView::handlesCommand(CommandType cmd, void *calldata, XFE_CommandInfo*) || IS_CMD(xfeCmdReplyToSenderAndNewsgroup) || IS_CMD(xfeCmdForwardMessage) || IS_CMD(xfeCmdForwardMessageQuoted) + || IS_CMD(xfeCmdForwardMessageInLine) || IS_CMD(xfeCmdShowAllHeaders) || IS_CMD(xfeCmdShowNormalHeaders) || IS_CMD(xfeCmdShowBriefHeaders) @@ -1151,6 +1229,12 @@ XFE_CALLBACK_DEFN(XFE_MsgView, showPopup)(XFE_NotificationCenter *, if (m_popup) delete m_popup; + /* Need to switch focus for the popup menu so that menu items can be enabled in + the three pane world */ + XFE_ThreadView *threadView = (XFE_ThreadView *)getParent(); /* returns the thread view */ + if (threadView) + getToplevel()->notifyInterested(XFE_MNListView::changeFocus, (void*) threadView); + m_popup = new XFE_PopupMenu("popup",(XFE_Frame*)m_toplevel, XfeAncestorFindApplicationShell(m_widget)); diff --git a/mozilla/cmd/xfe/src/NewsServerPropDialog.cpp b/mozilla/cmd/xfe/src/NewsServerPropDialog.cpp index 0033243bf33..ac82ece4303 100644 --- a/mozilla/cmd/xfe/src/NewsServerPropDialog.cpp +++ b/mozilla/cmd/xfe/src/NewsServerPropDialog.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "NewsServerPropDialog.h" #include "PropertySheetView.h" #include @@ -54,7 +54,7 @@ XFE_NewsServerPropGeneralTab::XFE_NewsServerPropGeneralTab(XFE_Component *top, Widget name_label, name_value; Widget port_label, port_value; - Widget security_label, security_value; + HG28921 Widget desc_label, desc_value; m_newshost = host; @@ -101,20 +101,7 @@ XFE_NewsServerPropGeneralTab::XFE_NewsServerPropGeneralTab(XFE_Component *top, NULL); XmStringFree(str); - security_label = XtCreateManagedWidget("security_label", - xmLabelGadgetClass, - top_form, - NULL, 0); - str = XmStringCreate(MSG_IsNewsHostSecure(m_newshost) - ? XP_GetString(XFE_SEC_ENCRYPTED) - : XP_GetString(XFE_SEC_NONE), - XmFONTLIST_DEFAULT_TAG); - security_value = XtVaCreateManagedWidget("security_value", - xmLabelGadgetClass, - top_form, - XmNlabelString, str, - NULL); - XmStringFree(str); + HG21933 desc_label = XtCreateManagedWidget("desc_label", xmLabelGadgetClass, top_form, @@ -154,7 +141,7 @@ XFE_NewsServerPropGeneralTab::XFE_NewsServerPropGeneralTab(XFE_Component *top, XmNrightAttachment, XmATTACH_FORM, NULL); - widest_width = XfeVaGetWidestWidget(name_label, port_label, security_label, desc_label, NULL); + widest_width = XfeVaGetWidestWidget(name_label, port_label, HG82872, NULL); XtVaSetValues(name_label, XmNalignment, XmALIGNMENT_BEGINNING, @@ -171,22 +158,9 @@ XFE_NewsServerPropGeneralTab::XFE_NewsServerPropGeneralTab(XFE_Component *top, XmNbottomAttachment, XmATTACH_NONE, XmNrightAttachment, XmATTACH_NONE, NULL); - XtVaSetValues(security_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, port_label, - XmNbottomAttachment, XmATTACH_NONE, - XmNrightAttachment, XmATTACH_NONE, - NULL); - XtVaSetValues(desc_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, security_label, - XmNbottomAttachment, XmATTACH_NONE, - XmNrightAttachment, XmATTACH_NONE, - NULL); + HG72723 + + XtVaSetValues(name_value, XmNalignment, XmALIGNMENT_BEGINNING, @@ -208,16 +182,7 @@ XFE_NewsServerPropGeneralTab::XFE_NewsServerPropGeneralTab(XFE_Component *top, XmNbottomAttachment, XmATTACH_NONE, XmNrightAttachment, XmATTACH_FORM, NULL); - XtVaSetValues(security_value, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, security_label, - XmNleftOffset, widest_width - XfeWidth(security_label), - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, security_label, - XmNbottomAttachment, XmATTACH_NONE, - XmNrightAttachment, XmATTACH_FORM, - NULL); + XtVaSetValues(desc_value, XmNalignment, XmALIGNMENT_BEGINNING, XmNleftAttachment, XmATTACH_WIDGET, diff --git a/mozilla/cmd/xfe/src/NotificationCenter.h b/mozilla/cmd/xfe/src/NotificationCenter.h index a7d7e63a827..bad27c7921b 100644 --- a/mozilla/cmd/xfe/src/NotificationCenter.h +++ b/mozilla/cmd/xfe/src/NotificationCenter.h @@ -106,7 +106,7 @@ class XFE_NotificationCenter { public: XFE_NotificationCenter(); - ~XFE_NotificationCenter(); + virtual ~XFE_NotificationCenter(); // These two deal with static member function callbacks void registerInterest(const char *notification_name, diff --git a/mozilla/cmd/xfe/src/OptionFolderView.cpp b/mozilla/cmd/xfe/src/OptionFolderView.cpp index ebf2ef3cd7f..b16a78051a8 100644 --- a/mozilla/cmd/xfe/src/OptionFolderView.cpp +++ b/mozilla/cmd/xfe/src/OptionFolderView.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "OptionFolderView.h" #include "ComposeView.h" #include @@ -247,35 +247,7 @@ XFE_CALLBACK_DEFN(XFE_OptionFolderView,updateSecurityOption)(XFE_NotificationCen Boolean notify = False; - XtVaGetValues(m_encryptedW, XmNset, &set, 0 ); - - // Encrypted - if ( !set && MSG_GetCompBoolHeader(getPane(), MSG_ENCRYPTED_BOOL_HEADER_MASK) ) - { - notify = True; - XmToggleButtonSetState (m_encryptedW, True, False); - } - else if ( set && !MSG_GetCompBoolHeader(getPane(), MSG_ENCRYPTED_BOOL_HEADER_MASK) ) - { - notify = True; - XmToggleButtonSetState (m_encryptedW, False, False); - } - - - XtVaGetValues(m_signedW, XmNset, &set, 0 ); - - // Signed - if ( !set && MSG_GetCompBoolHeader(getPane(), MSG_SIGNED_BOOL_HEADER_MASK) ) - { - notify = True; - XmToggleButtonSetState (m_signedW, True, False); - } - else if ( set && !MSG_GetCompBoolHeader(getPane(), MSG_SIGNED_BOOL_HEADER_MASK) ) - { - notify = True; - XmToggleButtonSetState (m_signedW, False, False); - } - + HG20192 if ( notify ) getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating, (void*)NULL); @@ -343,22 +315,14 @@ XFE_OptionFolderView::createWidgets(Widget parent_widget) m_returnReceiptW = XmCreateToggleButtonGadget( RC0, "returnReceipt", av, ac ); - m_encryptedW = XmCreateToggleButtonGadget( RC0, - "encrypted", av, ac ); - m_signedW = XmCreateToggleButtonGadget( RC0, - "signed", av, ac ); XtManageChild(m_textEncodingOptionW); XtManageChild(m_binaryEncodingOptionW); XtManageChild(m_returnReceiptW); XtAddCallback(m_returnReceiptW, XmNvalueChangedCallback, returnReceiptChangeCallback, (XtPointer)this); - XtManageChild(m_encryptedW); - XtAddCallback(m_encryptedW, XmNvalueChangedCallback, - encryptedChangeCallback, (XtPointer)this); - XtManageChild(m_signedW); - XtAddCallback(m_signedW, XmNvalueChangedCallback, - signedChangeCallback, (XtPointer)this); + + HG20198 // Do Some Attachments @@ -432,22 +396,7 @@ XFE_OptionFolderView::updateAllOptions() else XtVaSetValues (m_returnReceiptW, XmNset, False, 0); - // Encrypted - if ( MSG_GetCompBoolHeader(getPane(), MSG_ENCRYPTED_BOOL_HEADER_MASK) ) - { - XtVaSetValues (m_encryptedW, XmNset, True, 0); - } - else - XtVaSetValues (m_encryptedW, XmNset, False, 0); - - - // Signed - if ( MSG_GetCompBoolHeader(getPane(), MSG_SIGNED_BOOL_HEADER_MASK) ) - { - XtVaSetValues (m_signedW, XmNset, True, 0); - } - else - XtVaSetValues (m_signedW, XmNset, False, 0); + HG35220 // Binary encoding... @@ -487,18 +436,7 @@ void XFE_OptionFolderView::handleEncrypted(Boolean set) { Boolean notify = False; - if ((set) && !MSG_GetCompBoolHeader(getPane(), - MSG_ENCRYPTED_BOOL_HEADER_MASK)) - { - MSG_SetCompBoolHeader(getPane(), MSG_ENCRYPTED_BOOL_HEADER_MASK, True); - notify = True; - } - else if ((!set) && MSG_GetCompBoolHeader(getPane(), - MSG_ENCRYPTED_BOOL_HEADER_MASK)) - { - MSG_SetCompBoolHeader(getPane(), MSG_ENCRYPTED_BOOL_HEADER_MASK, False); - notify = True; - } + HG82811 if (notify) { @@ -523,18 +461,7 @@ void XFE_OptionFolderView::handleSigned(Boolean set) { Boolean notify = False; - if ((set) && !MSG_GetCompBoolHeader(getPane(), MSG_SIGNED_BOOL_HEADER_MASK)) - { - MSG_SetCompBoolHeader(getPane(), MSG_SIGNED_BOOL_HEADER_MASK, True); - notify = True; - } - else if ((!set) && MSG_GetCompBoolHeader(getPane(), - MSG_SIGNED_BOOL_HEADER_MASK)) - { - MSG_SetCompBoolHeader(getPane(), MSG_SIGNED_BOOL_HEADER_MASK, False); - notify = True; - - } + HG97291 if (notify) { getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating, diff --git a/mozilla/cmd/xfe/src/OptionFolderView.h b/mozilla/cmd/xfe/src/OptionFolderView.h index d63131d2311..153c9b231c9 100644 --- a/mozilla/cmd/xfe/src/OptionFolderView.h +++ b/mozilla/cmd/xfe/src/OptionFolderView.h @@ -25,6 +25,7 @@ #ifndef _xfe_optionfolderview_h #define _xfe_optionfolderview_h +#include "rosetta.h" #include "MNView.h" #include "msgcom.h" #include @@ -77,8 +78,7 @@ class XFE_OptionFolderView: public XFE_MNView Widget m_textEncodingOptionW; Widget m_binaryEncodingOptionW; Widget m_returnReceiptW; - Widget m_encryptedW; - Widget m_signedW; + HG21182 MSG_PRIORITY m_selectedPriority; XFE_CALLBACK_DECL(updateSecurityOption) }; diff --git a/mozilla/cmd/xfe/src/Outliner.cpp b/mozilla/cmd/xfe/src/Outliner.cpp index 31a63a1fb49..8a5e9aa439f 100644 --- a/mozilla/cmd/xfe/src/Outliner.cpp +++ b/mozilla/cmd/xfe/src/Outliner.cpp @@ -1236,6 +1236,37 @@ XFE_Outliner::deselectAllItems() deselectAll(); } +int +XFE_Outliner::visibleRows(int& first, int& last) +{ + int firstrow, lastrow; + Dimension height, shadowthickness; + + XtVaGetValues(m_widget, + XmNscrollRow, &firstrow, + XmNheight, &height, + XmNshadowThickness, &shadowthickness, + NULL); + first = firstrow; + + height -= shadowthickness; + + for (lastrow = firstrow + 1 ; ; lastrow++) { + XRectangle rect; + + if (XmLGridRowColumnToXY(m_widget, + XmCONTENT, lastrow, + XmCONTENT, 0, + False, &rect) < 0) + break; + + if (rect.y + rect.height >= height) + break; + }/* for lastrow */ + last = lastrow; + return (lastrow-firstrow+1); +} + void XFE_Outliner::makeVisible(int index) { diff --git a/mozilla/cmd/xfe/src/Outliner.h b/mozilla/cmd/xfe/src/Outliner.h index eb1e60fceb7..ab4beda277d 100644 --- a/mozilla/cmd/xfe/src/Outliner.h +++ b/mozilla/cmd/xfe/src/Outliner.h @@ -125,6 +125,8 @@ public: void setOutlinable(XFE_Outlinable *o); #endif /* USE_MOTIF_DND */ + int visibleRows(int& firstrow, int& lastrow); + XFE_Outlinable *getOutlinable(); void setSortColumn(int column, EOutlinerSortDirection direction); diff --git a/mozilla/cmd/xfe/src/PrefsData.h b/mozilla/cmd/xfe/src/PrefsData.h index 16fe079c37f..6885b8635fa 100644 --- a/mozilla/cmd/xfe/src/PrefsData.h +++ b/mozilla/cmd/xfe/src/PrefsData.h @@ -214,6 +214,8 @@ struct PrefsDataGeneralAppl Widget helpers_list; Widget folder_text; Widget browse_button; + Widget edit_button; + Widget delete_button; int helpers_changed; int static_apps_count; @@ -274,88 +276,6 @@ struct PrefsDataMailNewsIdentity #endif }; -struct PrefsDataMailNewsComposition -{ - MWContext *context; - Widget prompt_dialog; - Widget page; - - Widget mail_email_self_toggle; - Widget mail_email_other_text; - Widget news_email_self_toggle; - Widget news_email_other_text; - Widget mail_fcc_toggle; - Widget mail_fcc_combo; - Widget news_fcc_toggle; - Widget news_fcc_combo; - Widget auto_quote_toggle; - Widget send_html_msg_toggle; - Widget wrap_length_text; - - XP_List *mail_fcc_folders; - XP_List *news_fcc_folders; - XP_List *mail_fcc_paths; - XP_List *news_fcc_paths; -}; - -struct PrefsDataMailNewsMserver -{ - MWContext *context; - Widget prompt_dialog; - Widget page; - - Widget pop_user_name_text; - Widget outgoing_mail_server_text; - Widget incoming_mail_server_text; - Widget pop3_toggle; - Widget movemail_toggle; - Widget imap_toggle; - //Widget inbox_toggle; - Widget leave_msg_on_server_toggle; - //Widget imap_local_copies_toggle; - Widget delete_is_move_to_trash_toggle; - Widget imap_server_ssl_toggle; - Widget built_in_app_toggle; - Widget external_app_toggle; - Widget external_app_text; - Widget external_app_browse_button; -}; - -struct PrefsDataMailNewsNserver -{ - MWContext *context; - Widget prompt_dialog; - Widget page; - - Widget nntp_server_text; - Widget news_dir_text; - Widget notify_toggle; - Widget browse_button; - Widget msg_size_text; - Widget port_text; - Widget secure_toggle; -}; - -struct PrefsDataMailNewsAddrBook -{ - MWContext *context; - Widget prompt_dialog; - Widget page; - - XFE_Outliner *dir_outliner; - Widget dir_list; - Widget up_button; - Widget down_button; - Widget add_button; - Widget delete_button; - Widget edit_button; - Widget first_last_toggle; - Widget last_first_toggle; - - XP_List *directories; - int num_directories; - XP_List *deleted_directories; -}; struct PrefsDataApplEdit { diff --git a/mozilla/cmd/xfe/src/PrefsDialog.cpp b/mozilla/cmd/xfe/src/PrefsDialog.cpp index 37725d3aded..a1ad17e4c23 100644 --- a/mozilla/cmd/xfe/src/PrefsDialog.cpp +++ b/mozilla/cmd/xfe/src/PrefsDialog.cpp @@ -69,13 +69,21 @@ static char *TAG_BOLD = "BOLD"; #define CAT_CACHE "Cache" #define CAT_PROXIES "Proxies" #define CAT_MAILNEWS_IDENTITY "Identity" -#define CAT_MAILNEWS_COMPOSITION "Composition" +#define CAT_MAILNEWS_MESSAGES "Messages" #define CAT_MAILNEWS_MAILSERVER "Mail Server" -#define CAT_MAILNEWS_NEWSSERVER "News Server" -#define CAT_MAILNEWS_ADDRBOOK "Address Book" +#define CAT_MAILNEWS_NSERVER "News Server" +#define CAT_MAILNEWS_ADDRESS "Addressing" +#define CAT_MAILNEWS_COPIES "Message Copies" +#define CAT_MAILNEWS_HTML "HTML Formatting" +#define CAT_MAILNEWS_RECEIPTS "Read Receipts" #define CAT_EDITOR_PUBLISH "Publish" #define CAT_DISKSPACE "Disk Space" #define CAT_EDITOR_APPEARANCE "Appearance" +#ifdef MOZ_LI +#define CAT_LI "Location Independence" +#define CAT_LI_SERVER "Location Independence Server" +#define CAT_LI_FILES "Location Independence Files" +#endif /* MOZ_LI */ #ifdef PREFS_UNSUPPORTED #define CAT_HELPFILES "Help Files" #define CAT_OFFLINE_NEWS "News" @@ -89,10 +97,13 @@ static char *TAG_BOLD = "BOLD"; #define CAT_RESNAME_APPS "pref.applications" #define CAT_RESNAME_MAILNEWS "pref.mailNews" #define CAT_RESNAME_MAILNEWS_IDENTITY "pref.identity" -#define CAT_RESNAME_MAILNEWS_COMPOSITION "pref.composition" +#define CAT_RESNAME_MAILNEWS_MESSAGES "pref.messages" #define CAT_RESNAME_MAILNEWS_MAILSERVER "pref.mailServer" -#define CAT_RESNAME_MAILNEWS_NEWSSERVER "pref.newsServer" -#define CAT_RESNAME_MAILNEWS_ADDRBOOK "pref.addressBook" +#define CAT_RESNAME_MAILNEWS_NSERVER "pref.newsServer" +#define CAT_RESNAME_MAILNEWS_ADDRESS "pref.addressing" +#define CAT_RESNAME_MAILNEWS_COPIES "pref.copies" +#define CAT_RESNAME_MAILNEWS_HTML "pref.htmlmail" +#define CAT_RESNAME_MAILNEWS_RECEIPTS "pref.readreceipts" #define CAT_RESNAME_EDITOR "pref.editor" #define CAT_RESNAME_EDITOR_PUBLISH "pref.editorPublish" #define CAT_RESNAME_ADVANCED "pref.advanced" @@ -100,6 +111,11 @@ static char *TAG_BOLD = "BOLD"; #define CAT_RESNAME_PROXIES "pref.proxies" #define CAT_RESNAME_DISKSPACE "pref.diskSpace" #define CAT_RESNAME_EDITOR_APPEARANCE "pref.editorAppearance" +#ifdef MOZ_LI +#define CAT_RESNAME_LI "pref.liGeneral" +#define CAT_RESNAME_LI_SERVER "pref.liServer" +#define CAT_RESNAME_LI_FILES "pref.liFiles" +#endif /* MOZ_LI */ #ifdef PREFS_UNSUPPORTED #define CAT_RESNAME_HELPFILES "pref.helpFiles" #define CAT_RESNAME_OFFLINE "pref.offline" @@ -114,10 +130,13 @@ static char *TAG_BOLD = "BOLD"; #define CAT_RESCLASS_APPS "Pref.Applications" #define CAT_RESCLASS_MAILNEWS "Pref.MailNews" #define CAT_RESCLASS_MAILNEWS_IDENTITY "Pref.Identity" -#define CAT_RESCLASS_MAILNEWS_COMPOSITION "Pref.Composition" +#define CAT_RESCLASS_MAILNEWS_MESSAGES "Pref.Messages" #define CAT_RESCLASS_MAILNEWS_MAILSERVER "Pref.MailServer" -#define CAT_RESCLASS_MAILNEWS_NEWSSERVER "Pref.NewsServer" -#define CAT_RESCLASS_MAILNEWS_ADDRBOOK "Pref.AddressBook" +#define CAT_RESCLASS_MAILNEWS_NSERVER "Pref.NewsServer" +#define CAT_RESCLASS_MAILNEWS_ADDRESS "Pref.Addressing" +#define CAT_RESCLASS_MAILNEWS_COPIES "Pref.Copies" +#define CAT_RESCLASS_MAILNEWS_HTML "Pref.HtmlMail" +#define CAT_RESCLASS_MAILNEWS_RECEIPTS "Pref.ReadReceipts" #define CAT_RESCLASS_EDITOR "Pref.Editor" #define CAT_RESCLASS_EDITOR_PUBLISH "Pref.EditorPublish" #define CAT_RESCLASS_ADVANCED "Pref.Advanced" @@ -125,6 +144,11 @@ static char *TAG_BOLD = "BOLD"; #define CAT_RESCLASS_PROXIES "Pref.Proxies" #define CAT_RESCLASS_DISKSPACE "Pref.DiskSpace" #define CAT_RESCLASS_EDITOR_APPEARANCE "Pref.EditorAppearance" +#ifdef MOZ_LI +#define CAT_RESCLASS_LI "Pref.liGeneral" +#define CAT_RESCLASS_LI_SERVER "Pref.liServer" +#define CAT_RESCLASS_LI_FILES "Pref.liFiles" +#endif /* MOZ_LI */ #ifdef PREFS_UNSUPPORTED #define CAT_RESCLASS_HELPFILES "Pref.HelpFiles" #define CAT_RESCLASS_OFFLINE "Pref.Offline" @@ -139,10 +163,13 @@ static char *TAG_BOLD = "BOLD"; #define DESC_RESNAME_APPS "prefDesc.applications" #define DESC_RESNAME_MAILNEWS "prefDesc.mailNews" #define DESC_RESNAME_MAILNEWS_IDENTITY "prefDesc.identity" -#define DESC_RESNAME_MAILNEWS_COMPOSITION "prefDesc.composition" +#define DESC_RESNAME_MAILNEWS_MESSAGES "prefDesc.messages" #define DESC_RESNAME_MAILNEWS_MAILSERVER "prefDesc.mailServer" -#define DESC_RESNAME_MAILNEWS_NEWSSERVER "prefDesc.newsServer" -#define DESC_RESNAME_MAILNEWS_ADDRBOOK "prefDesc.addressBook" +#define DESC_RESNAME_MAILNEWS_NSERVER "prefDesc.newsServer" +#define DESC_RESNAME_MAILNEWS_ADDRESS "prefDesc.addressing" +#define DESC_RESNAME_MAILNEWS_COPIES "prefDesc.copies" +#define DESC_RESNAME_MAILNEWS_HTML "prefDesc.htmlMail" +#define DESC_RESNAME_MAILNEWS_RECEIPTS "prefDesc.readReceipts" #define DESC_RESNAME_EDITOR "prefDesc.editor" #define DESC_RESNAME_EDITOR_PUBLISH "prefDesc.editorPublish" #define DESC_RESNAME_ADVANCED "prefDesc.advanced" @@ -150,6 +177,11 @@ static char *TAG_BOLD = "BOLD"; #define DESC_RESNAME_PROXIES "prefDesc.proxies" #define DESC_RESNAME_DISKSPACE "prefDesc.diskSpace" #define DESC_RESNAME_EDITOR_APPEARANCE "prefDesc.editorAppearance" +#ifdef MOZ_LI +#define DESC_RESNAME_LI "prefDesc.liGeneral" +#define DESC_RESNAME_LI_SERVER "prefDesc.liServer" +#define DESC_RESNAME_LI_FILES "prefDesc.liFiles" +#endif /* MOZ_LI */ #ifdef PREFS_UNSUPPORTED #define DESC_RESNAME_HELPFILES "prefDesc.helpFiles" #define DESC_RESNAME_OFFLINE "prefDesc.offline" @@ -164,10 +196,13 @@ static char *TAG_BOLD = "BOLD"; #define DESC_RESCLASS_APPS "PrefDesc.Applications" #define DESC_RESCLASS_MAILNEWS "PrefDesc.MailNews" #define DESC_RESCLASS_MAILNEWS_IDENTITY "PrefDesc.Identity" -#define DESC_RESCLASS_MAILNEWS_COMPOSITION "PrefDesc.Composition" +#define DESC_RESCLASS_MAILNEWS_MESSAGES "PrefDesc.Messages" #define DESC_RESCLASS_MAILNEWS_MAILSERVER "PrefDesc.MailServer" -#define DESC_RESCLASS_MAILNEWS_NEWSSERVER "PrefDesc.newsServer" -#define DESC_RESCLASS_MAILNEWS_ADDRBOOK "PrefDesc.AddressBook" +#define DESC_RESCLASS_MAILNEWS_NSERVER "PrefDesc.newsServer" +#define DESC_RESCLASS_MAILNEWS_ADDRESS "PrefDesc.Addressing" +#define DESC_RESCLASS_MAILNEWS_COPIES "PrefDesc.Copies" +#define DESC_RESCLASS_MAILNEWS_HTML "PrefDesc.HTMLMail" +#define DESC_RESCLASS_MAILNEWS_RECEIPTS "PrefDesc.readReceipts" #define DESC_RESCLASS_EDITOR "PrefDesc.Editor" #define DESC_RESCLASS_EDITOR_PUBLISH "PrefDesc.EditorPublish" #define DESC_RESCLASS_ADVANCED "PrefDesc.Advanced" @@ -175,6 +210,11 @@ static char *TAG_BOLD = "BOLD"; #define DESC_RESCLASS_PROXIES "PrefDesc.Proxies" #define DESC_RESCLASS_DISKSPACE "PrefDesc.DiskSpace" #define DESC_RESCLASS_EDITOR_APPEARANCE "PrefDesc.EditorAppearance" +#ifdef MOZ_LI +#define DESC_RESCLASS_LI "PrefDesc.liGeneral" +#define DESC_RESCLASS_LI_SERVER "PrefDesc.liServer" +#define DESC_RESCLASS_LI_FILES "PrefDesc.liFiles" +#endif /* MOZ_LI */ #ifdef PREFS_UNSUPPORTED #define DESC_RESCLASS_HELPFILES "PrefDesc.HelpFiles" #define DESC_RESCLASS_OFFLINE "PrefDesc.Offline" @@ -190,10 +230,13 @@ typedef enum _prefsPageType { PAGE_TYPE_APPS, PAGE_TYPE_MAILNEWS, PAGE_TYPE_MAILNEWS_IDENTITY, - PAGE_TYPE_MAILNEWS_COMPOSITION, + PAGE_TYPE_MAILNEWS_MESSAGES, PAGE_TYPE_MAILNEWS_MAILSERVER, - PAGE_TYPE_MAILNEWS_NEWSSERVER, - PAGE_TYPE_MAILNEWS_ADDRBOOK, + PAGE_TYPE_MAILNEWS_NSERVER, + PAGE_TYPE_MAILNEWS_ADDRESS, + PAGE_TYPE_MAILNEWS_COPIES, + PAGE_TYPE_MAILNEWS_HTML, + PAGE_TYPE_MAILNEWS_RECEIPTS, PAGE_TYPE_EDITOR, PAGE_TYPE_EDITOR_APPEARANCE, PAGE_TYPE_EDITOR_PUBLISH, @@ -201,6 +244,12 @@ typedef enum _prefsPageType { PAGE_TYPE_CACHE, PAGE_TYPE_PROXIES, PAGE_TYPE_DISKSPACE +#ifdef MOZ_LI + , + PAGE_TYPE_LI, + PAGE_TYPE_LI_SERVER, + PAGE_TYPE_LI_FILES +#endif #ifdef PREFS_UNSUPPORTED PAGE_TYPE_HELPFILES PAGE_TYPE_OFFLINE, @@ -257,17 +306,6 @@ struct _prefsCategory prefsMailNews[] = { 0, PAGE_TYPE_MAILNEWS_IDENTITY, }, - { - CAT_MAILNEWS_COMPOSITION, - CAT_RESNAME_MAILNEWS_COMPOSITION, - CAT_RESCLASS_MAILNEWS_COMPOSITION, - DESC_RESNAME_MAILNEWS_COMPOSITION, - DESC_RESCLASS_MAILNEWS_COMPOSITION, - TRUE, - NULL, - 0, - PAGE_TYPE_MAILNEWS_COMPOSITION, - }, { CAT_MAILNEWS_MAILSERVER, CAT_RESNAME_MAILNEWS_MAILSERVER, @@ -280,27 +318,84 @@ struct _prefsCategory prefsMailNews[] = { PAGE_TYPE_MAILNEWS_MAILSERVER, }, { - CAT_MAILNEWS_NEWSSERVER, - CAT_RESNAME_MAILNEWS_NEWSSERVER, - CAT_RESCLASS_MAILNEWS_NEWSSERVER, - DESC_RESNAME_MAILNEWS_NEWSSERVER, - DESC_RESCLASS_MAILNEWS_NEWSSERVER, + CAT_MAILNEWS_NSERVER, + CAT_RESNAME_MAILNEWS_NSERVER, + CAT_RESCLASS_MAILNEWS_NSERVER, + DESC_RESNAME_MAILNEWS_NSERVER, + DESC_RESCLASS_MAILNEWS_NSERVER, TRUE, NULL, 0, - PAGE_TYPE_MAILNEWS_NEWSSERVER, + PAGE_TYPE_MAILNEWS_NSERVER, }, { - CAT_MAILNEWS_ADDRBOOK, - CAT_RESNAME_MAILNEWS_ADDRBOOK, - CAT_RESCLASS_MAILNEWS_ADDRBOOK, - DESC_RESNAME_MAILNEWS_ADDRBOOK, - DESC_RESCLASS_MAILNEWS_ADDRBOOK, + CAT_MAILNEWS_ADDRESS, + CAT_RESNAME_MAILNEWS_ADDRESS, + CAT_RESCLASS_MAILNEWS_ADDRESS, + DESC_RESNAME_MAILNEWS_ADDRESS, + DESC_RESCLASS_MAILNEWS_ADDRESS, TRUE, NULL, 0, - PAGE_TYPE_MAILNEWS_ADDRBOOK, + PAGE_TYPE_MAILNEWS_ADDRESS, }, + { + CAT_MAILNEWS_MESSAGES, + CAT_RESNAME_MAILNEWS_MESSAGES, + CAT_RESCLASS_MAILNEWS_MESSAGES, + DESC_RESNAME_MAILNEWS_MESSAGES, + DESC_RESCLASS_MAILNEWS_MESSAGES, + TRUE, + NULL, + 0, + PAGE_TYPE_MAILNEWS_MESSAGES, + }, + { + CAT_MAILNEWS_COPIES, + CAT_RESNAME_MAILNEWS_COPIES, + CAT_RESCLASS_MAILNEWS_COPIES, + DESC_RESNAME_MAILNEWS_COPIES, + DESC_RESNAME_MAILNEWS_COPIES, + TRUE, + NULL, + 0, + PAGE_TYPE_MAILNEWS_COPIES, + }, + { + CAT_MAILNEWS_HTML, + CAT_RESNAME_MAILNEWS_HTML, + CAT_RESCLASS_MAILNEWS_HTML, + DESC_RESNAME_MAILNEWS_HTML, + DESC_RESNAME_MAILNEWS_HTML, + TRUE, + NULL, + 0, + PAGE_TYPE_MAILNEWS_HTML, + }, + { + CAT_MAILNEWS_RECEIPTS, + CAT_RESNAME_MAILNEWS_RECEIPTS, + CAT_RESCLASS_MAILNEWS_RECEIPTS, + DESC_RESNAME_MAILNEWS_RECEIPTS, + DESC_RESNAME_MAILNEWS_RECEIPTS, + TRUE, + NULL, + 0, + PAGE_TYPE_MAILNEWS_RECEIPTS, + }, +#ifdef MOZ_MAIL_NEWS + { + CAT_DISKSPACE, + CAT_RESNAME_DISKSPACE, + CAT_RESCLASS_DISKSPACE, + DESC_RESNAME_DISKSPACE, + DESC_RESCLASS_DISKSPACE, + TRUE, + NULL, + 0, + PAGE_TYPE_DISKSPACE, + }, +#endif // MOZ_MAIL_NEWS }; struct _prefsCategory prefsEditor[] = { @@ -420,6 +515,33 @@ struct _prefsCategory prefsAdvanced[] = { #endif /* PREFS_UNSUPPORTED */ }; +#ifdef MOZ_LI +struct _prefsCategory prefsLI[] = { + { + CAT_LI_SERVER, + CAT_RESNAME_LI_SERVER, + CAT_RESCLASS_LI_SERVER, + DESC_RESNAME_LI_SERVER, + DESC_RESCLASS_LI_SERVER, + TRUE, + NULL, + 0, + PAGE_TYPE_LI_SERVER, + }, + { + CAT_LI_FILES, + CAT_RESNAME_LI_FILES, + CAT_RESCLASS_LI_FILES, + DESC_RESNAME_LI_FILES, + DESC_RESCLASS_LI_FILES, + TRUE, + NULL, + 0, + PAGE_TYPE_LI_FILES, + } +}; +#endif /* MOZ_LI */ + struct _prefsCategory prefsCategories[] = { { CAT_APPEARANCE, @@ -469,6 +591,19 @@ struct _prefsCategory prefsCategories[] = { PAGE_TYPE_MAILNEWS, }, #endif // MOZ_MAIL_NEWS +#ifdef MOZ_LI + { + CAT_LI, + CAT_RESNAME_LI, + CAT_RESCLASS_LI, + DESC_RESNAME_LI, + DESC_RESCLASS_LI, + FALSE, + prefsLI, + XtNumber(prefsLI), + PAGE_TYPE_LI, + }, +#endif /* MOZ_LI */ #ifdef EDITOR { CAT_EDITOR, @@ -672,6 +807,19 @@ XFE_PrefsPage::XFE_PrefsPage(XFE_PrefsDialog *prefsDialog) : // prefs dialog m_context = m_prefsDialog->getContext(); } +XFE_PrefsPage::XFE_PrefsPage(Widget w) : // prefs dialog + m_context(0), + m_prefsDialog(0), + m_wPageForm(w), + m_wPage(0), + m_created(FALSE), + m_initialized(FALSE), + m_doInitInMap(FALSE), + m_changed(FALSE) +{ + m_wPageForm = w; +} + // Member: ~XFE_PrefsPage // Description: Destructor // Inputs: @@ -1290,9 +1438,12 @@ Dimension XFE_PrefsDialog::calculateWidth() Dimension widest = 0; Dimension width; + if (!m_pages) return 0; for (int i = 0; i < m_numPages; i++) { - width = m_pages[i]->getWidth(); - if (width > widest) widest = width; + if (m_pages[i]) { + width = m_pages[i]->getWidth(); + if (width > widest) widest = width; + } } return widest; } @@ -1308,8 +1459,10 @@ Dimension XFE_PrefsDialog::calculateHeight() Dimension height; for (int i = 0; i < m_numPages; i++) { - height = m_pages[i]->getHeight(); - if (height > tallest) tallest = height; + if (m_pages[i]) { + height = m_pages[i]->getHeight(); + if (height > tallest) tallest = height; + } } return tallest; } @@ -1486,11 +1639,27 @@ void XFE_PrefsDialog::initCategories() XrmValue value; char *type = NULL; int i; +#ifdef MOZ_LI + XP_Bool li_ui_enabled = FALSE; +#endif if (m_categories) deleteCategories(); m_numCategories = XtNumber(prefsCategories); +#ifdef MOZ_LI + /* If li.ui.enabled is false, we hide the LI prefs */ + PREF_GetBoolPref("li.ui.enabled", &li_ui_enabled); + if ( li_ui_enabled == FALSE ) { + int found_it = 0; + for ( i = 0; i < m_numCategories; i++ ) { + if ( prefsCategories[i].type == PAGE_TYPE_LI ) found_it = 1; + if ( found_it ) prefsCategories[i] = prefsCategories[i+1]; + } + m_numCategories--; + } +#endif + // Calculate the number of pages we have m_numPages = 0; @@ -1546,6 +1715,7 @@ void XFE_PrefsDialog::initCategories() for (int j = 0; j < numChildren; j++) { newPage(m_pages[page_index], prefs[j].type); + children[j].page = m_pages[page_index]; page_index++; children[j].open = FALSE; @@ -1652,8 +1822,8 @@ void XFE_PrefsDialog::newPage(XFE_PrefsPage *&page, case PAGE_TYPE_MAILNEWS: page = new XFE_PrefsPageMailNews(this); break; - case PAGE_TYPE_MAILNEWS_COMPOSITION: - page = new XFE_PrefsPageMailNewsComposition(this); + case PAGE_TYPE_MAILNEWS_MESSAGES: + page = new XFE_PrefsPageMessages(this); break; case PAGE_TYPE_MAILNEWS_MAILSERVER: page = new XFE_PrefsPageMailNewsMserver(this); @@ -1661,8 +1831,23 @@ void XFE_PrefsDialog::newPage(XFE_PrefsPage *&page, case PAGE_TYPE_MAILNEWS_NEWSSERVER: page = new XFE_PrefsPageMailNewsNserver(this); break; + case PAGE_TYPE_MAILNEWS_NSERVER: + page = new XFE_PrefsPageNServer(this); + break; case PAGE_TYPE_MAILNEWS_ADDRBOOK: page = new XFE_PrefsPageMailNewsAddrBook(this); + break; + case PAGE_TYPE_MAILNEWS_ADDRESS: + page = new XFE_PrefsPageAddress(this); + break; + case PAGE_TYPE_MAILNEWS_COPIES: + page = new XFE_PrefsPageMailNewsCopies(this); + break; + case PAGE_TYPE_MAILNEWS_HTML: + page = new XFE_PrefsPageMailNewsHTML(this); + break; + case PAGE_TYPE_MAILNEWS_RECEIPTS: + page = new XFE_PrefsPageMailNewsReceipts(this); break; #endif // MOZ_MAIL_NEWS #ifdef EDITOR @@ -1693,6 +1878,17 @@ void XFE_PrefsDialog::newPage(XFE_PrefsPage *&page, page = new XFE_PrefsPageOfflineNews(this); break; #endif /* PREFS_UNSUPPORTED */ +#ifdef MOZ_LI + case PAGE_TYPE_LI: + page = new XFE_PrefsPageLIGeneral(this); + break; + case PAGE_TYPE_LI_SERVER: + page = new XFE_PrefsPageLIServer(this); + break; + case PAGE_TYPE_LI_FILES: + page = new XFE_PrefsPageLIFiles(this); + break; +#endif } } @@ -1877,7 +2073,7 @@ Boolean XFE_PrefsDialog::categoryDataFunc(Widget /* widget */, static char label[256]; data->type[dataColumn] = FE_OUTLINE_String; if (entry->leaf) - sprintf(label, " %s", entry->categoryName); + PR_snprintf(label, sizeof(label)," %s", entry->categoryName); else strcpy(label, entry->categoryName); data->str[dataColumn] = label; diff --git a/mozilla/cmd/xfe/src/PrefsDialog.h b/mozilla/cmd/xfe/src/PrefsDialog.h index b16b94ae433..b60d3beb60e 100644 --- a/mozilla/cmd/xfe/src/PrefsDialog.h +++ b/mozilla/cmd/xfe/src/PrefsDialog.h @@ -33,6 +33,7 @@ #ifndef _xfe_prefsdialog_h #define _xfe_prefsdialog_h +#include "rosetta.h" #include "outline.h" #include "Dialog.h" #include "xeditor.h" @@ -42,6 +43,10 @@ #ifdef MOZ_LDAP #include "dirprefs.h" #endif +#ifdef MOZ_MAIL_NEWS +#include "PrefsDialogMServer.h" +#include "PrefsMailFolderDlg.h" +#endif #define PREFS_SET_GLOBALPREF_TEXT(SLOT1,SLOT2) \ { \ @@ -256,6 +261,7 @@ public: // Constructors, Destructors XFE_PrefsPage(XFE_PrefsDialog *dialog); + XFE_PrefsPage(Widget w); virtual ~XFE_PrefsPage(); // Manipulators @@ -737,11 +743,12 @@ private: }; #ifdef MOZ_MAIL_NEWS -// ************************* XFE_PrefsPageMailNewsComposition ************************* -class XFE_PrefsPageMailNewsComposition : public XFE_PrefsPage +// Incoming Mail Servers Data +class XFE_PrefsIncomingMServer { public: +<<<<<<< PrefsDialog.h // Constructors, Destructors @@ -766,12 +773,105 @@ public: private: // Data - - PrefsDataMailNewsComposition *m_prefsDataMailNewsComposition; - - void setFccMenu(Boolean); +======= + XFE_PrefsIncomingMServer(Widget incomingServerBox, XFE_PrefsPage *page); + virtual ~XFE_PrefsIncomingMServer(); + XFE_PrefsPage *getPage() { return prefsPage; }; + void refresh_incoming(); + XP_Bool has_pop(); + XP_Bool has_imap(); + XP_Bool has_many_imap(); + +private: + void select_incoming(); + + static void cb_select_incoming(Widget w, XtPointer closure, + XtPointer callData); + static void cb_new_incoming(Widget w, XtPointer closure, + XtPointer callData); + static void cb_edit_incoming(Widget w, XtPointer closure, + XtPointer callData); + static void cb_delete_incoming(Widget w, XtPointer closure, + XtPointer callData); + static void cb_refresh(Widget w, XtPointer closure, XtPointer callData); + + XFE_PrefsMServerDialog *m_mserver_dialog; + XFE_PrefsPage* prefsPage; + void newIncoming(); + void editIncoming(); + void deleteIncoming(); + Widget m_incoming; + Widget m_button_form; + Widget m_new_button; + Widget m_edit_button; + Widget m_delete_button; + }; +// Outgoing Server Data +class XFE_PrefsOutgoingServer +{ +public: + XFE_PrefsOutgoingServer(Widget outgoingServerBox); + Widget get_server_name() { return m_servername_text; }; + Widget get_user_name() { return m_username_text; }; + HG02621 + private: + + Widget m_outgoing; + + // Labels + Widget m_servername_text; // Text field + Widget m_username_text; // Text field + + HG19282 +}; + +// Local mail directory data +class XFE_PrefsLocalMailDir +{ +public: + XFE_PrefsLocalMailDir(Widget localMailDirBox, XFE_PrefsPage *page); + static void cb_choose(Widget w, XtPointer closure, + XtPointer callData); + Widget get_local_dir_text() { return m_local_dir_text; }; + XFE_PrefsPage *getPage() { return prefsPage; }; + +private: + XFE_PrefsPage *prefsPage; + Widget m_local_dir_text; +}; +>>>>>>> 3.1.14.1 + +<<<<<<< PrefsDialog.h + PrefsDataMailNewsComposition *m_prefsDataMailNewsComposition; +======= +>>>>>>> 3.1.14.1 + + // News Servers Data +class XFE_PrefsNewsServer +{ +public: + XFE_PrefsNewsServer(Widget ServerBox, XFE_PrefsPage *page); + XFE_PrefsPage *getPage() { return prefsPage; }; + +private: + static void cb_option(Widget, XtPointer, XtPointer); + static void cb_new_news_server(Widget w, XtPointer closure, + XtPointer callData); + static void cb_edit_news_server(Widget w, XtPointer closure, + XtPointer callData); + static void cb_delete_news_server(Widget w, XtPointer closure, + XtPointer callData); + + XFE_PrefsPage *prefsPage; + Widget news_servers; + Widget button_form; + Widget new_button; + Widget edit_button; + Widget delete_button; +}; + // ************************* XFE_PrefsPageMailNewsMserver ************************* class XFE_PrefsPageMailNewsMserver : public XFE_PrefsPage @@ -791,10 +891,6 @@ public: virtual void save(); virtual Boolean verify(); - // Gets - - PrefsDataMailNewsMserver *getData(); - // Callbacks - page Mail News/Mail Server static void cb_browseApplication(Widget, XtPointer, XtPointer); @@ -803,17 +899,21 @@ public: static void cb_toggleApplication(Widget, XtPointer, XtPointer); private: + XFE_PrefsIncomingMServer *xfe_incoming; + XFE_PrefsOutgoingServer *xfe_outgoing; + XFE_PrefsLocalMailDir *xfe_local_mail; + // Data - PrefsDataMailNewsMserver *m_prefsDataMailNewsMserver; }; -// ************************* XFE_PrefsPageMailNewsNserver ************************* +// ************************* XFE_PrefsPageMailNewsCopies ****************** -class XFE_PrefsPageMailNewsNserver : public XFE_PrefsPage +class XFE_PrefsPageMailNewsCopies : public XFE_PrefsPage { public: +<<<<<<< PrefsDialog.h // Constructors, Destructors @@ -835,7 +935,7 @@ public: // Callbacks - page Mail News/News Server static void cb_browse(Widget, XtPointer, XtPointer); - static void cb_toggleSecure(Widget, XtPointer, XtPointer); + HG92727 private: @@ -849,7 +949,93 @@ private: class XFE_PrefsPageMailNewsAddrBook : public XFE_PrefsPage, public XFE_Outlinable { public: +======= + + XFE_PrefsPageMailNewsCopies(XFE_PrefsDialog *dialog); + virtual ~XFE_PrefsPageMailNewsCopies(); + + virtual void create(); + + MSG_FolderInfo *GetFolderInfoFromPath(char *path, + MSG_FolderInfo *parent=NULL); + virtual void init(); + virtual void install(); + virtual void save(); + virtual Boolean verify(); + +private: + MSG_FolderInfo *m_mailFcc, *m_newsFcc, *m_draftsFcc, *m_templatesFcc; + MSG_Master *m_master; + XFE_PrefsMailFolderDialog *m_chooseDialog; + + MSG_FolderInfo *chooseFcc(int l10n_name, MSG_FolderInfo *selected_folder); + XmString VerboseFolderName(MSG_FolderInfo *,int folder_string_id=0); + MSG_FolderInfo *GetSpecialFolder(char *name, int l10n_name); + + static void cb_chooseMailFcc(Widget, XtPointer closure,XtPointer); + static void cb_chooseNewsFcc(Widget, XtPointer closure, XtPointer); + static void cb_chooseDraftsFcc(Widget, XtPointer closure, XtPointer); + static void cb_chooseTemplatesFcc(Widget, XtPointer closure, XtPointer); + + static void cb_gotMailFcc(Widget, XtPointer, XtPointer); + static void cb_gotNewsFcc(Widget, XtPointer, XtPointer); + static void cb_gotDraftsFcc(Widget, XtPointer, XtPointer); + + static void cb_gotTemplatesFcc(Widget, XtPointer, XtPointer); + + Widget createMailFrame(Widget parent, Widget attachTo); + Widget createNewsFrame(Widget parent, Widget attachTo); + Widget createDTFrame(Widget parent, Widget attachTo); + Widget m_mail_self_toggle; + Widget m_mail_other_toggle; + Widget m_mail_other_text; + Widget m_mail_fcc_toggle; + Widget m_mail_choose_button; + + Widget m_news_self_toggle; + Widget m_news_other_toggle; + Widget m_news_other_text; + Widget m_news_fcc_toggle; + Widget m_news_choose_button; + + Widget m_drafts_save_label; + Widget m_drafts_choose_button; + + Widget m_templates_save_label; + Widget m_templates_choose_button; + + }; + + // ************************* XFE_PrefsPageMailNewsHTML ****************** + + +class XFE_PrefsPageMailNewsHTML : public XFE_PrefsPage +{ +public: + + XFE_PrefsPageMailNewsHTML(XFE_PrefsDialog *dialog); + virtual ~XFE_PrefsPageMailNewsHTML(); + + virtual void create(); + virtual void init(); + virtual void install(); + virtual void save(); + virtual Boolean verify(); + +private: + Widget createUseHTMLFrame(Widget parent, Widget attachTo); + Widget createNoHTMLFrame(Widget parent, Widget attachTo); + Widget m_usehtml_toggle; + Widget m_nohtml_ask_toggle; + Widget m_nohtml_text_toggle; + Widget m_nohtml_html_toggle; + Widget m_nohtml_both_toggle; + +}; +>>>>>>> 3.1.14.1 + +<<<<<<< PrefsDialog.h // Constructors, Destructors XFE_PrefsPageMailNewsAddrBook(XFE_PrefsDialog *dialog); @@ -912,7 +1098,10 @@ public: static void cb_toggleNameOrder(Widget, XtPointer, XtPointer); private: +======= +>>>>>>> 3.1.14.1 +<<<<<<< PrefsDialog.h // Data static const int OUTLINER_COLUMN_NAME; @@ -921,6 +1110,36 @@ private: PrefsDataMailNewsAddrBook *m_prefsDataMailNewsAddrBook; int m_rowIndex; +======= +// ************************* XFE_PrefsPageMailNewsReceipts ****************** + + +class XFE_PrefsPageMailNewsReceipts : public XFE_PrefsPage +{ +public: + + XFE_PrefsPageMailNewsReceipts(XFE_PrefsDialog *dialog); + virtual ~XFE_PrefsPageMailNewsReceipts(); + + virtual void create(); + virtual void init(); + virtual void install(); + virtual void save(); + virtual Boolean verify(); + + +private: + Widget createRequestReceiptsFrame(Widget parent, Widget attachTo); + Widget createReceiptsArriveFrame(Widget parent, Widget attachTo); + Widget createReceiveReceiptsFrame(Widget parent, Widget attachTo); + Widget m_dsn_toggle; + Widget m_mdn_toggle; + Widget m_both_toggle; + Widget m_inbox_toggle; + Widget m_sentmail_toggle; + Widget m_never_toggle; + Widget m_some_toggle; +>>>>>>> 3.1.14.1 }; #endif /* MOZ_MAIL_NEWS */ diff --git a/mozilla/cmd/xfe/src/PrefsDialogAppl.h b/mozilla/cmd/xfe/src/PrefsDialogAppl.h index a2b95c9f81e..d5849d58a94 100644 --- a/mozilla/cmd/xfe/src/PrefsDialogAppl.h +++ b/mozilla/cmd/xfe/src/PrefsDialogAppl.h @@ -16,6 +16,7 @@ * Reserved. */ /* ** */ +/* Insert copyright and license here 19** */ #ifndef __xfe_prefsdialogappl_h #define __xfe_prefsdialogappl_h @@ -81,3 +82,5 @@ extern int xfe_prefsAppl_get_static_app_count(); #endif + + diff --git a/mozilla/cmd/xfe/src/PrefsDialogGeneral.cpp b/mozilla/cmd/xfe/src/PrefsDialogGeneral.cpp index 8ac9fb63d07..88a25054ee0 100644 --- a/mozilla/cmd/xfe/src/PrefsDialogGeneral.cpp +++ b/mozilla/cmd/xfe/src/PrefsDialogGeneral.cpp @@ -2869,6 +2869,54 @@ XFE_PrefsPageGeneralAppl::~XFE_PrefsPageGeneralAppl() delete m_prefsDataGeneralAppl; } + +/* + * mimetype_is_locked + */ +static int +mimetype_is_locked(char* pref_name) +{ + char buf[1024]; + + strcpy(buf, pref_name); + strcat(buf, ".mimetype"); + + return PREF_PrefIsLocked(buf); +} + + +/* + * selection_cb + * Invoked when a row in the application panel is selected. + * Greys out the 'Edit' and 'Delete' buttons if that mimetype is + * locked by preferences. + */ +static void +selection_cb(Widget w, XtPointer closure, XtPointer callData) +{ + XmLGridCallbackStruct* cb = (XmLGridCallbackStruct*) callData; + PrefsDataGeneralAppl* fep = (PrefsDataGeneralAppl*) closure; + NET_cdataStruct* cd = NULL; + int row; + + if ( cb == NULL ) return; + + row = cb->row - xfe_prefsAppl_get_static_app_count(); + + if ( row < 0 ) return; + + cd = xfe_prefsDialogAppl_get_mime_data_at_pos(row); + + if ( cd && cd->pref_name && mimetype_is_locked(cd->pref_name) ) { + XtSetSensitive(fep->edit_button, FALSE); + XtSetSensitive(fep->delete_button, FALSE); + } else { + XtSetSensitive(fep->edit_button, TRUE); + XtSetSensitive(fep->delete_button, TRUE); + } +} + + // Member: create // Description: Creates page for GeneralAppl // Inputs: @@ -2930,6 +2978,8 @@ void XFE_PrefsPageGeneralAppl::create() XtSetArg(av[ac], XmNallowColumnResize, True); ac++; XtSetArg(av[ac], XmNheight, 250); ac++; kids[i++] = helpers_list = XmLCreateGrid(form1, "helperApp", av, ac); +/* DEM */ + XtAddCallback(helpers_list, XmNselectCallback, selection_cb, fep); fep->helpers_list = helpers_list; XtVaSetValues(helpers_list, XmNcolumnSizePolicy, XmVARIABLE, NULL); XtVaSetValues(helpers_list, XmNlayoutFrozen, True, NULL); diff --git a/mozilla/cmd/xfe/src/PrefsDialogMailnews.cpp b/mozilla/cmd/xfe/src/PrefsDialogMailnews.cpp index 3c9bf01950a..5d9b3aa8a03 100644 --- a/mozilla/cmd/xfe/src/PrefsDialogMailnews.cpp +++ b/mozilla/cmd/xfe/src/PrefsDialogMailnews.cpp @@ -20,6 +20,7 @@ Created: Linda Wei , 17-Sep-96. */ +#include "rosetta.h" #include "MozillaApp.h" #include "felocale.h" #include "structs.h" @@ -34,16 +35,13 @@ extern "C" { } #include "PrefsDialog.h" #ifdef MOZ_MAIL_NEWS -#include "PrefsMserverMore.h" -#include "PrefsMsgMore.h" #include "ColorDialog.h" -#include "PrefsLdapProp.h" #include "dirprefs.h" #include "addrbk.h" -#include "dirprefs.h" #include "xp_list.h" #endif #include "prefapi.h" +#include "xp_mem.h" #include #include @@ -62,6 +60,10 @@ extern "C" { #include #include +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + #define COLOR_STRING_BLACK "black" extern int XFE_EMPTY_DIR; @@ -84,12 +86,22 @@ extern int XFE_PREFS_LABEL_SIZE_NORMAL; extern int XFE_PREFS_LABEL_SIZE_BIGGER; extern int XFE_PREFS_LABEL_SIZE_SMALLER; extern int XFE_EMPTY_EMAIL_ADDR; +extern int XFE_FOLDER_ON_SERVER_FORMAT; +extern int XFE_DRAFTS_ON_SERVER; +extern int XFE_TEMPLATES_ON_SERVER; extern int MK_MSG_MAIL_DIRECTORY_CHANGED; +extern int XFE_MAIL_SELF_FORMAT; +extern int MK_MSG_SENT_L10N_NAME; +extern int MK_MSG_DRAFTS_L10N_NAME; +extern int MK_MSG_TEMPLATES_L10N_NAME; +extern int MK_POP3_ONLY_ONE; +extern int MK_MSG_REMOVE_MAILHOST_CONFIRM; #define OUTLINER_GEOMETRY_PREF "preferences.dir.outliner_geometry" extern "C" { + #ifdef MOZ_MAIL_NEWS void MIME_ConformToStandard(XP_Bool conform_p); void MSG_SetBiffStatFile(const char* filename); @@ -99,10 +111,7 @@ extern "C" void NET_SetPopUsername(const char *username); void fe_browse_file_of_text(MWContext *context, Widget text_field, Boolean dirp); void fe_installMailNews(); - void fe_installMailNewsComposition(); void fe_installMailNewsMserver(); - void fe_installMailNewsNserver(); - void fe_installMailNewsAddrBook(); XP_List *FE_GetDirServers(); ABook *fe_GetABook(MWContext *context); void fe_showABCardPropertyDlg(Widget parent, @@ -113,12 +122,6 @@ extern "C" static void fe_set_quoted_text_styles(PrefsDataMailNews *); static void fe_set_quoted_text_sizes(PrefsDataMailNews *); - static void fe_fcc_add_folders(XP_List *paths, XP_List *folders, - MSG_FolderInfo *info, - char *default_folder_path, - int default_folder_index, int depth); - static char *fe_GetFolderPathFromInfo(MSG_FolderInfo *f); - static char *fe_GetFolderNameFromInfo(MSG_FolderInfo *f); #endif // MOZ_MAIL_NEWS char *XP_GetString(int i); void fe_installMailNewsIdentity(); @@ -564,7 +567,8 @@ void XFE_PrefsPageMailNews::init() prefs->citation_color : COLOR_STRING_BLACK; if (! LO_ParseRGB(color_string, &color.red, &color.green, &color.blue)) LO_ParseRGB(COLOR_STRING_BLACK, &color.red, &color.green, &color.blue); - sprintf(buf, "#%02x%02x%02x", color.red, color.green, color.blue); + PR_snprintf(buf, sizeof(buf), "#%02x%02x%02x", + color.red, color.green, color.blue); XtVaGetValues(fep->quoted_text_color_button, XmNuserData, &orig_citation_color, NULL); if (orig_citation_color) XtFree(orig_citation_color); @@ -1418,3182 +1422,2239 @@ void XFE_PrefsPageMailNewsIdentity::cb_toggleAttachCard(Widget /* w */, #endif // MOZ_MAIL_NEWS #ifdef MOZ_MAIL_NEWS -// ************************************************************************ -// ********************** Mail News/Composition ************************ -// ************************************************************************ - -// Member: XFE_PrefsPageMailNewsComposition -// Description: Constructor -// Inputs: -// Side effects: - -XFE_PrefsPageMailNewsComposition::XFE_PrefsPageMailNewsComposition(XFE_PrefsDialog *dialog) - : XFE_PrefsPage(dialog), - m_prefsDataMailNewsComposition(0) -{ -} - -// Member: ~XFE_PrefsPageMailNewsComposition -// Description: Destructor -// Inputs: -// Side effects: - -XFE_PrefsPageMailNewsComposition::~XFE_PrefsPageMailNewsComposition() -{ - delete m_prefsDataMailNewsComposition; -} - -// Member: create -// Description: Creates page for MailNews/Composition -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsComposition::create() -{ - Widget kids[100]; - Arg av[50]; - int ac; - int i; - - PrefsDataMailNewsComposition *fep = NULL; - - fep = new PrefsDataMailNewsComposition; - memset(fep, 0, sizeof(PrefsDataMailNewsComposition)); - m_prefsDataMailNewsComposition = fep; - - fep->context = getContext(); - fep->prompt_dialog = getPrefsDialog()->getDialogChrome(); - - Widget form; - - ac = 0; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - form = XmCreateForm (m_wPageForm, "mailnewsCompose", av, ac); - XtManageChild (form); - m_wPage = fep->page = form; - - // Message Properties - - Widget frame1; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_NONE); ac++; - frame1 = XmCreateFrame (form, "mailnewsCompFrame", av, ac); - - Widget form1; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - form1 = XmCreateForm (frame1, "mailnewsCompBox", av, ac); - - Widget label1; - - ac = 0; - XtSetArg (av [ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; - label1 = XmCreateLabelGadget (frame1, "msgPropLabel", av, ac); - - ac = 0; - i = 0; - - // Auto quote original message - - Widget send_html_msg_toggle; - Widget auto_quote_toggle; - Widget wrap_label; - Widget wrap_length_text; - Widget char_label; - - kids[i++] = send_html_msg_toggle = - XmCreateToggleButtonGadget(form1, "sendHtmlMsgToggle", av, ac); - - kids[i++] = auto_quote_toggle = - XmCreateToggleButtonGadget(form1, "autoQuoteToggle", av, ac); - - kids[i++] = wrap_label = - XmCreateLabelGadget(form1, "wrapLabel", av, ac); - - kids[i++] = char_label = - XmCreateLabelGadget(form1, "charLabel", av, ac); - - kids[i++] = wrap_length_text = - fe_CreateTextField(form1, "wrapLengthText", av, ac); - - fep->auto_quote_toggle = auto_quote_toggle; - fep->send_html_msg_toggle = send_html_msg_toggle; - fep->wrap_length_text = wrap_length_text; - - XtVaSetValues(send_html_msg_toggle, - XmNindicatorType, XmN_OF_MANY, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(auto_quote_toggle, - XmNindicatorType, XmN_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, send_html_msg_toggle, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - int labels_height; - labels_height = XfeVaGetTallestWidget(wrap_label, - wrap_length_text, - NULL); - - XtVaSetValues(wrap_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, auto_quote_toggle, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(wrap_length_text, - XmNcolumns, 3, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, wrap_label, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, wrap_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(char_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, wrap_label, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, wrap_length_text, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtManageChildren(kids, i); - XtManageChild(label1); - XtManageChild(form1); - XtManageChild(frame1); - - // Copies of outgoing messages - - Widget frame2; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; - XtSetArg (av [ac], XmNtopWidget, frame1); ac++; - XtSetArg (av [ac], XmNtopOffset, 8); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_NONE); ac++; - frame2 = XmCreateFrame (form, "ccFrame", av, ac); - - Widget form2; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - form2 = XmCreateForm (frame2, "ccBox", av, ac); - - Widget label2; - - ac = 0; - XtSetArg (av [ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; - label2 = XmCreateLabelGadget (frame2, "ccLabel", av, ac); - - // Email a copy of outgoing message to - - Widget email_label; - Widget mail_msg_label; - Widget news_msg_label; - Widget mail_email_self_toggle; - Widget mail_email_other_label; - Widget mail_email_other_text; - Widget news_email_self_toggle; - Widget news_email_other_label; - Widget news_email_other_text; - - ac = 0; - i = 0; - - kids[i++] = email_label = - XmCreateLabelGadget(form2, "emailLabel", av, ac); - - kids[i++] = mail_msg_label = - XmCreateLabelGadget(form2, "mailMsgLabel", av, ac); - - kids[i++] = news_msg_label = - XmCreateLabelGadget(form2, "newsMsgLabel", av, ac); - - kids[i++] = mail_email_self_toggle = - XmCreateToggleButtonGadget(form2, "mEmailSelfToggle", av, ac); - - kids[i++] = news_email_self_toggle = - XmCreateToggleButtonGadget(form2, "nEmailSelfToggle", av, ac); - - kids[i++] = mail_email_other_label = - XmCreateLabelGadget(form2, "mEmailOtherLabel", av, ac); - - kids[i++] = news_email_other_label = - XmCreateLabelGadget(form2, "nEmailOtherLabel", av, ac); - - kids[i++] = mail_email_other_text = - fe_CreateTextField(form2, "mEmailOtherText", av, ac); - - kids[i++] = news_email_other_text = - fe_CreateTextField(form2, "nEmailOtherText", av, ac); - - fep->mail_email_self_toggle = mail_email_self_toggle; - fep->mail_email_other_text = mail_email_other_text; - fep->news_email_self_toggle = news_email_self_toggle; - fep->news_email_other_text = news_email_other_text; - - XtVaSetValues(email_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, auto_quote_toggle, - XmNtopOffset, 8, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - int labels_width; - labels_width = XfeVaGetWidestWidget(mail_msg_label, - news_msg_label, - NULL); - - labels_height = XfeVaGetTallestWidget(mail_msg_label, - mail_email_self_toggle, - mail_email_other_label, - mail_email_other_text, - NULL); - - XtVaSetValues(mail_msg_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNwidth, labels_width, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, email_label, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 26, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(mail_email_self_toggle, - XmNindicatorType, XmN_OF_MANY, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, mail_msg_label, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, mail_msg_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(mail_email_other_label, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, mail_msg_label, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, mail_email_self_toggle, - XmNleftOffset, 8, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(mail_email_other_text, - XmNcolumns, 20, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, mail_msg_label, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, mail_email_other_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(news_msg_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNwidth, labels_width, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, mail_msg_label, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, mail_msg_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(news_email_self_toggle, - XmNindicatorType, XmN_OF_MANY, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, news_msg_label, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, mail_email_self_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(news_email_other_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, news_msg_label, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, mail_email_other_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(news_email_other_text, - XmNcolumns, 20, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, news_msg_label, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, mail_email_other_text, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - // FCC - - Visual *v = 0; - Colormap cmap = 0; - Cardinal depth = 0; - - XtVaGetValues(getPrefsDialog()->getPrefsParent(), - XtNvisual, &v, - XtNcolormap, &cmap, - XtNdepth, &depth, - 0); - - Widget fcc_label; - Widget mail_fcc_toggle; - Widget mail_fcc_combo; - Widget news_fcc_toggle; - Widget news_fcc_combo; - - ac = 0; - kids[i++] = fcc_label = - XmCreateLabelGadget(form2, "fccLabel", av, ac); - - kids[i++] = mail_fcc_toggle = - XmCreateToggleButtonGadget(form2, "mailFolderToggle", av, ac); - - kids[i++] = news_fcc_toggle = - XmCreateToggleButtonGadget(form2, "newsFolderToggle", av, ac); - - ac = 0; - XtSetArg(av[ac], XmNvisual, v); ac++; - XtSetArg(av[ac], XmNdepth, depth); ac++; - XtSetArg(av[ac], XmNcolormap, cmap); ac++; - XtSetArg(av[ac], XmNmoveSelectedItemUp, False); ac++; - XtSetArg(av[ac], XmNtype, XmDROP_DOWN_LIST_BOX); ac++; - XtSetArg(av[ac], XmNarrowType, XmMOTIF); ac++; - kids[i++] = mail_fcc_combo = DtCreateComboBox(form2, "mailFccCombo", av, ac); - - ac = 0; - XtSetArg(av[ac], XmNvisual, v); ac++; - XtSetArg(av[ac], XmNdepth, depth); ac++; - XtSetArg(av[ac], XmNcolormap, cmap); ac++; - XtSetArg(av[ac], XmNmoveSelectedItemUp, False); ac++; - XtSetArg(av[ac], XmNtype, XmDROP_DOWN_LIST_BOX); ac++; - XtSetArg(av[ac], XmNarrowType, XmMOTIF); ac++; - kids[i++] = news_fcc_combo = DtCreateComboBox(form2, "newsFccCombo", av, ac); - - fep->mail_fcc_toggle = mail_fcc_toggle; - fep->mail_fcc_combo = mail_fcc_combo; - fep->news_fcc_toggle = news_fcc_toggle; - fep->news_fcc_combo = news_fcc_combo; - - XtVaSetValues(fcc_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, news_msg_label, - XmNtopOffset, 8, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - int labels_width2; - labels_width2 = XfeVaGetWidestWidget(mail_fcc_toggle, - news_fcc_toggle, - NULL); - - int labels_height2; - labels_height2 = XfeVaGetTallestWidget(mail_fcc_toggle, - mail_fcc_combo, - NULL); - - XtVaSetValues(mail_fcc_toggle, - XmNindicatorType, XmN_OF_MANY, - XmNheight, labels_height2, - XmNwidth, labels_width2, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, fcc_label, - XmNtopOffset, 8, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 16, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(mail_fcc_combo, - XmNheight, labels_height2, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, mail_fcc_toggle, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, mail_fcc_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(news_fcc_toggle, - XmNindicatorType, XmN_OF_MANY, - XmNwidth, labels_width2, - XmNheight, labels_height2, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, mail_fcc_toggle, - XmNtopOffset, 8, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, mail_fcc_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(news_fcc_combo, - XmNheight, labels_height2, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, news_fcc_toggle, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, mail_fcc_combo, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtManageChildren(kids, i); - XtManageChild(label2); - XtManageChild(form2); - XtManageChild(frame2); - - Widget more_button; - - ac = 0; - i = 0; - - kids[i++] = more_button = - XmCreatePushButtonGadget(form, "moreButton", av, ac); - - XtVaSetValues(more_button, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, frame2, - XmNtopOffset, 8, - XmNleftAttachment, XmATTACH_NONE, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - XtAddCallback(more_button, XmNactivateCallback, cb_more, this); - - XtManageChildren(kids, i); - - setCreated(TRUE); -} - -// Member: init -// Description: Initializes page for MailNewsComposition -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsComposition::init() -{ - XP_ASSERT(m_prefsDataMailNewsComposition); - - PrefsDataMailNewsComposition *fep = m_prefsDataMailNewsComposition; - XFE_GlobalPrefs *prefs = &fe_globalPrefs; - char buf[1024]; - - // BCC - - XtVaSetValues(fep->mail_email_self_toggle, XmNset, prefs->mailbccself_p, 0); - fe_SetTextField(fep->mail_email_other_text, prefs->mail_bcc); - - XtVaSetValues(fep->news_email_self_toggle, XmNset, prefs->newsbccself_p, 0); - fe_SetTextField(fep->news_email_other_text, prefs->news_bcc); - - // FCC - - XtVaSetValues(fep->mail_fcc_toggle, XmNset, prefs->mailfcc_p, 0); - setFccMenu(TRUE); - - XtVaSetValues(fep->news_fcc_toggle, XmNset, prefs->newsfcc_p, 0); - setFccMenu(FALSE); - - XtVaSetValues(fep->auto_quote_toggle, XmNset, prefs->autoquote_reply, 0); - - // send_html_msg_toggle - - XtVaSetValues(fep->send_html_msg_toggle, XmNset, prefs->send_html_msg, 0); - - // wrap length - - PR_snprintf(buf, sizeof(buf), "%d", prefs->msg_wrap_length); - XtVaSetValues(fep->wrap_length_text, XmNvalue, buf, 0); - - - // If the preference is locked, grey it out. - XtSetSensitive(fep->mail_email_self_toggle, - !PREF_PrefIsLocked("mail.cc_self")); - XtSetSensitive(fep->mail_email_other_text, - !PREF_PrefIsLocked("mail.default_cc")); - XtSetSensitive(fep->news_email_self_toggle, - !PREF_PrefIsLocked("news.cc_self")); - XtSetSensitive(fep->news_email_other_text, - !PREF_PrefIsLocked("news.default_cc")); - XtSetSensitive(fep->mail_fcc_toggle, - !PREF_PrefIsLocked("mail.use_fcc")); - XtSetSensitive(fep->mail_fcc_combo, - !PREF_PrefIsLocked("mail.default_fcc")); - XtSetSensitive(fep->news_fcc_toggle, - !PREF_PrefIsLocked("news.use_fcc")); - XtSetSensitive(fep->news_fcc_combo, - !PREF_PrefIsLocked("news.default_fcc")); - XtSetSensitive(fep->auto_quote_toggle, - !PREF_PrefIsLocked("mail.auto_quote")); - XtSetSensitive(fep->send_html_msg_toggle, - !PREF_PrefIsLocked("mail.send_html")); - XtSetSensitive(fep->wrap_length_text, - !PREF_PrefIsLocked("mailnews.wraplength")); - - setInitialized(TRUE); -} - -// Member: install -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsComposition::install() -{ - fe_installMailNewsComposition(); -} - -// Member: save -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsComposition::save() -{ - PrefsDataMailNewsComposition *fep = m_prefsDataMailNewsComposition; - - XP_ASSERT(fep); - - // BCC - - PREFS_SET_GLOBALPREF_TEXT(mail_bcc, mail_email_other_text); - PREFS_SET_GLOBALPREF_TEXT(news_bcc, news_email_other_text); - XtVaGetValues(fep->mail_email_self_toggle, - XmNset, &fe_globalPrefs.mailbccself_p, - 0); - XtVaGetValues(fep->news_email_self_toggle, - XmNset, &fe_globalPrefs.newsbccself_p, - 0); - - // FCC - - if (fe_globalPrefs.mail_fcc) { - free(fe_globalPrefs.mail_fcc); - fe_globalPrefs.mail_fcc = 0; - } - - if (fe_globalPrefs.news_fcc) { - free(fe_globalPrefs.news_fcc); - fe_globalPrefs.news_fcc = 0; - } - - XtVaGetValues(fep->mail_fcc_toggle, - XmNset, &fe_globalPrefs.mailfcc_p, - 0); - XtVaGetValues(fep->news_fcc_toggle, - XmNset, &fe_globalPrefs.newsfcc_p, - 0); - - // If there is no folder, unselect the fcc toggle - - if ((fe_globalPrefs.mailfcc_p) && - (XP_ListCount(fep->mail_fcc_folders) == 0)) - fe_globalPrefs.mailfcc_p = FALSE; - - if ((fe_globalPrefs.newsfcc_p) && - (XP_ListCount(fep->news_fcc_folders) == 0)) - fe_globalPrefs.newsfcc_p = FALSE; - - // Find out which folder was selected - - int pos; - - if ((fe_globalPrefs.mailfcc_p) && - (XP_ListCount(fep->mail_fcc_folders) > 0)){ - XtVaGetValues(fep->mail_fcc_combo, XmNselectedPosition, &pos, 0); - fe_globalPrefs.mail_fcc = - XP_STRDUP((char *)XP_ListGetObjectNum(fep->mail_fcc_paths, pos+1)); - } - else - fe_globalPrefs.mail_fcc = XP_STRDUP(""); - - if ((fe_globalPrefs.newsfcc_p) && - (XP_ListCount(fep->news_fcc_folders) > 0)){ - XtVaGetValues(fep->news_fcc_combo, XmNselectedPosition, &pos, 0); - fe_globalPrefs.news_fcc = - XP_STRDUP((char *)XP_ListGetObjectNum(fep->news_fcc_paths, pos+1)); - } - else - fe_globalPrefs.news_fcc = XP_STRDUP(""); - - // Auto quote when replying - - XtVaGetValues(fep->auto_quote_toggle, - XmNset, &fe_globalPrefs.autoquote_reply, - 0); - - // Send HTML messages - - XtVaGetValues(fep->send_html_msg_toggle, - XmNset, &fe_globalPrefs.send_html_msg, - 0); - - // Wrap length - - char c; - char *s = 0; - int n; - - XtVaGetValues (fep->wrap_length_text, XmNvalue, &s, 0); - if (1 == sscanf (s, " %d %c", &n, &c) && - n > 0) - fe_globalPrefs.msg_wrap_length = n; - if (s) XtFree(s); - - // Install preferences - - install(); -} - -// Member: getData -// Description: -// Inputs: -// Side effects: - -PrefsDataMailNewsComposition *XFE_PrefsPageMailNewsComposition::getData() -{ - return m_prefsDataMailNewsComposition; -} - -// Member: setFccMenu -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsComposition::setFccMenu(Boolean isMail) -{ - PrefsDataMailNewsComposition *fep = m_prefsDataMailNewsComposition; - XFE_GlobalPrefs *prefs = &fe_globalPrefs; - - Widget combo = isMail ? fep->mail_fcc_combo : fep->news_fcc_combo; - XP_List *folders = isMail ? fep->mail_fcc_folders : fep->news_fcc_folders; - XP_List *paths = isMail ? fep->mail_fcc_paths : fep->news_fcc_paths; - char *pref_folder_path = isMail ? prefs->mail_fcc : prefs->news_fcc; - - // Remove existing children - - XmString xms; - int i; - char *path; - char *folder; - - if (folders) { - int count = XP_ListCount(folders); - if (count > 0) { - DtComboBoxDeleteAllItems(combo); - for (i = 0; i < count; i++) { - folder = (char *)XP_ListGetObjectNum(folders, i+1); - path = (char *)XP_ListGetObjectNum(paths, i+1); - XP_FREEIF(folder); - XP_FREEIF(path); - } - } - XP_ListDestroy(folders); - XP_ListDestroy(paths); - } - - if (isMail) { - fep->mail_fcc_folders = XP_ListNew(); - fep->mail_fcc_paths = XP_ListNew(); - } - else { - fep->news_fcc_folders = XP_ListNew(); - fep->news_fcc_paths = XP_ListNew(); - } - folders = isMail ? fep->mail_fcc_folders : fep->news_fcc_folders; - paths = isMail ? fep->mail_fcc_paths : fep->news_fcc_paths; - - // Put the preferred folder as the first one on the list if there is one - - char *default_folder_path = (pref_folder_path && XP_STRLEN(pref_folder_path) > 0) ? - pref_folder_path : 0; - int default_folder_index = (-1); - - if (default_folder_path) { - XP_ListAddObjectToEnd(folders, XP_STRDUP(default_folder_path)); - XP_ListAddObjectToEnd(paths, XP_STRDUP(default_folder_path)); - default_folder_index = 0; - } - - // Now read in all folders - - int depth = 0; - int num_sub_folders = 0; - MSG_FolderInfo **children = 0; - MSG_FolderInfo *localMailTree = MSG_GetLocalMailTree(fe_getMNMaster()); - - num_sub_folders = MSG_GetFolderChildren(fe_getMNMaster(), localMailTree, NULL, 0); - - if (num_sub_folders > 0) { - children = (MSG_FolderInfo **)XP_CALLOC(num_sub_folders, sizeof(MSG_FolderInfo*)); - num_sub_folders = - MSG_GetFolderChildren(fe_getMNMaster(), localMailTree, children, num_sub_folders); - } - - for (i = 0; i < num_sub_folders; i++) { - fe_fcc_add_folders(paths, folders, children[i], default_folder_path, - default_folder_index, depth); - } - - - int count = XP_ListCount(folders); - if (count > 0) { - for (i = 0; i < count; i++) { - char *folder_name = (char *)XP_ListGetObjectNum(folders, i+1); - xms = XmStringCreateLtoR(folder_name, XmFONTLIST_DEFAULT_TAG); - DtComboBoxAddItem(combo, xms, 0, True); - if (i == 0) DtComboBoxSelectItem(combo, xms); - XmStringFree(xms); - } - } - else { - xms = XmStringCreateLtoR("", XmFONTLIST_DEFAULT_TAG); - XtVaSetValues(combo, XmNlabelString, xms, 0); - XmStringFree(xms); - } - - if (children) XP_FREE(children); -} - -// Member: cb_more -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsComposition::cb_more(Widget /* w */, - XtPointer closure, - XtPointer /* callData */) -{ - XFE_PrefsPageMailNewsComposition *thePage = (XFE_PrefsPageMailNewsComposition *)closure; - XFE_PrefsDialog *theDialog = thePage->getPrefsDialog(); - Widget mainw = theDialog->getBaseWidget(); - - // Instantiate a mail server more dialog - - XFE_PrefsMsgMoreDialog *theMoreDialog = 0; - - if ((theMoreDialog = - new XFE_PrefsMsgMoreDialog(theDialog, mainw, "prefsMsgMore")) == 0) { - fe_perror(thePage->getContext(), XP_GetString(XFE_OUT_OF_MEMORY_URL)); - return; - } - - // Initialize and pop up the more dialog - - theMoreDialog->initPage(); - theMoreDialog->show(); -} - -static void fe_fcc_add_folders(XP_List *paths, - XP_List *folders, - MSG_FolderInfo *info, - char *default_folder_path, - int default_folder_index, - int depth) -{ - int num_sub_folders; - int i; - MSG_FolderInfo **children = 0; - char *this_folder_path = fe_GetFolderPathFromInfo(info); - char *this_folder_name = fe_GetFolderNameFromInfo(info); - char folder_buf[256]; - - // Create the button if this is different from the default folder - - *folder_buf = '\0'; - for (i = 0; i < depth; i++) - XP_STRCAT(folder_buf, " "); - XP_STRCAT(folder_buf, this_folder_name); - - if ((default_folder_path != 0) && - ((XP_STRCMP(default_folder_path, this_folder_path) == 0))) { - // The default folder path is a folder in the mail directory. - // Replace the label with folder name. - - char *folder_name = (char *)XP_ListGetObjectNum(folders, default_folder_index+1); - XP_ListRemoveObject(folders, folder_name); - char *folder_path = (char *)XP_ListGetObjectNum(paths, default_folder_index+1); - XP_ListRemoveObject(paths, folder_path); - - // add the default to the front of the list - XP_ListAddObject(folders, XP_STRDUP(folder_buf)); - XP_ListAddObject(paths, XP_STRDUP(this_folder_path)); - } - else { - // If there is no default folder path, make Sent as the one that gets displayed - if ((default_folder_path == 0) && - (XP_STRCMP(this_folder_name, - XP_GetString(XFE_PREFS_MAIL_FOLDER_SENT)) == 0)) { - // add the Sent folder to the front of the list - XP_ListAddObject(folders, XP_STRDUP(folder_buf)); - XP_ListAddObject(paths, XP_STRDUP(this_folder_path)); - } - else { - // add this folder to the end of the list - XP_ListAddObjectToEnd(folders, XP_STRDUP(folder_buf)); - XP_ListAddObjectToEnd(paths, XP_STRDUP(this_folder_path)); - } - } - - num_sub_folders = MSG_GetFolderChildren(fe_getMNMaster(), info, NULL, 0); - - if (num_sub_folders > 0) { - children = (MSG_FolderInfo **)XP_CALLOC(num_sub_folders, sizeof(MSG_FolderInfo*)); - num_sub_folders = MSG_GetFolderChildren(fe_getMNMaster(), info, children, num_sub_folders); - } - - for (i = 0; i < num_sub_folders; i ++) { - fe_fcc_add_folders(paths, folders, children[i], default_folder_path, - default_folder_index, depth+1); - } - - if (num_sub_folders > 0) - XP_FREE(children); -} - -static char *fe_GetFolderPathFromInfo(MSG_FolderInfo *f) { - return (char*)MSG_GetFolderNameFromID(f); -} - -static char *fe_GetFolderNameFromInfo(MSG_FolderInfo *f) { - char *name = 0; - char *path = (char*)MSG_GetFolderNameFromID(f); - if (strrchr(path, '/')) - name = strrchr(path, '/') + 1; - else - name = path; - return name; -} // ************************************************************************ // ************************ Mail News/Mail Server ************************* // ************************************************************************ +void +XFE_PrefsIncomingMServer::select_incoming() +{ + + // Turn on neccessary buttons if something is selected + if (m_edit_button) { + int count = 0; + XtVaGetValues(m_incoming, XmNselectedItemCount, &count, 0); + + if ( count > 0 ) { + XtSetSensitive(m_edit_button, True); + XtSetSensitive(m_delete_button, True); + } else { + XtSetSensitive(m_edit_button, False); + XtSetSensitive(m_delete_button, False); + } + } +} + +// When something is selected on the server list +void +XFE_PrefsIncomingMServer::cb_select_incoming(Widget /*w*/, + XtPointer clientData, + XtPointer) +{ + XFE_PrefsIncomingMServer *theClass = (XFE_PrefsIncomingMServer *) + clientData; + + // Refresh the list + theClass->select_incoming(); +} + +// Add a new incoming mail server +void +XFE_PrefsIncomingMServer::cb_new_incoming(Widget /*w*/, + XtPointer clientData, + XtPointer) +{ + // Get the main window + XFE_PrefsIncomingMServer *theClass = + (XFE_PrefsIncomingMServer *) clientData; + theClass->newIncoming(); +} + +void XFE_PrefsIncomingMServer::newIncoming() { + XFE_PrefsPage *thePage = getPage(); + XFE_PrefsDialog *theDialog = thePage->getPrefsDialog(); + Widget mainw = theDialog->getBaseWidget(); + + int total_servers; + + // Check if a POP server has already been configured. If so, this is an + // error. + if (has_pop()) { + FE_Message(thePage->getContext(), + XP_GetString(MK_POP3_ONLY_ONE)); + return; + } + + XtVaGetValues(m_incoming, + XmNitemCount, &total_servers, + NULL); + + // Create the popup + // why does this line keep crashing?! + // if (m_mserver_dialog) delete m_mserver_dialog; + m_mserver_dialog = + new XFE_PrefsMServerDialog(mainw, NULL, + (total_servers==0), + thePage->getContext()); + + XtAddCallback(m_mserver_dialog->getChrome(), XmNokCallback, + cb_refresh, (XtPointer)this); + m_mserver_dialog->show(); +} + +// Edit an existing incoming mail server +void +XFE_PrefsIncomingMServer::cb_edit_incoming(Widget /*w*/, + XtPointer clientData, + XtPointer) +{ + + // Get the main window + XFE_PrefsIncomingMServer *theClass = + (XFE_PrefsIncomingMServer *) clientData; + theClass->editIncoming(); +} + +void XFE_PrefsIncomingMServer::editIncoming() { + XmString *selected_strings; + char *name; + int total_servers; + + XFE_PrefsPage *thePage = getPage(); + XFE_PrefsDialog *theDialog = thePage->getPrefsDialog(); + Widget mainw = theDialog->getBaseWidget(); + + // Get the selected count + int selected_count = 0; + XtVaGetValues(m_incoming, + XmNitemCount, &total_servers, + XmNselectedItems, &selected_strings, + XmNselectedItemCount, &selected_count, + NULL); + + // Only when there is a current hostname selected, we will allow EDITing + if (selected_count <= 0) return; + + // Get the current hostname + XmStringGetLtoR(selected_strings[0], + XmSTRING_DEFAULT_CHARSET, + &name); + + // Create the popup + // Why does this line keep crashing?! + // if (m_mserver_dialog) delete m_mserver_dialog; + m_mserver_dialog = + new XFE_PrefsMServerDialog(mainw, name, + (total_servers==1), + getPage()->getContext()); + + XtAddCallback(m_mserver_dialog->getChrome(), XmNokCallback, + cb_refresh, (XtPointer)this); + m_mserver_dialog->show(); +} + +// Delete an incoming mail server +void +XFE_PrefsIncomingMServer::cb_delete_incoming(Widget /*w*/, + XtPointer clientData, + XtPointer ) +{ + // Get the main window + XFE_PrefsIncomingMServer *theClass = (XFE_PrefsIncomingMServer *) + clientData; + theClass->deleteIncoming(); +} + +void +XFE_PrefsIncomingMServer::deleteIncoming() { + + XmString *selected_strings; + char *name; + char *pop_name; + XFE_PrefsPage *thePage = getPage(); + XFE_PrefsDialog *theDialog = thePage->getPrefsDialog(); + Widget mainw = theDialog->getBaseWidget(); + + // Get the selected count + int selected_count = 0; + XtVaGetValues(m_incoming, XmNselectedItems, &selected_strings, + XmNselectedItemCount, &selected_count, 0); + + // Do nothing if nothing is selected + if (!selected_count) + return; + + int32 server_type; + PREF_GetIntPref("mail.server_type", &server_type); + if ((server_type==TYPE_IMAP) && + !fe_Confirm_2(mainw, XP_GetString(MK_MSG_REMOVE_MAILHOST_CONFIRM))) + return; + + // Get the current hostname + XmStringGetLtoR(selected_strings[0], + XmSTRING_DEFAULT_CHARSET, + &name); + PREF_CopyCharPref("network.hosts.pop_server", &pop_name); + + if (strcmp(name, pop_name)) { + MSG_Master* master = fe_getMNMaster(); + + int total = MSG_GetIMAPHosts(master, NULL, 0); + + if (total) { + MSG_IMAPHost** hosts = NULL; + + hosts = new MSG_IMAPHost* [total]; + + XP_ASSERT(hosts != NULL); + + // Get the list of IMAP hosts + total = MSG_GetIMAPHosts(master, hosts, total); + + // Loop over all the IMAP hosts + for (int i = 0; i < total; i++) { + MSG_Host *p = MSG_GetMSGHostFromIMAPHost(hosts[i]); + if (strcmp(name, MSG_GetHostName(p)) == 0) { + MSG_DeleteIMAPHost(master, hosts[i]); + } + } + + if (hosts) + delete [] hosts; + } + } else { + // What do I do here ? + PREF_SetCharPref("network.hosts.pop_server", + ""); + } + + XP_FREE(pop_name); + + // Refresh the list + refresh_incoming(); +} + +void +XFE_PrefsIncomingMServer::cb_refresh(Widget /*w*/, + XtPointer clientData, + XtPointer /* callData */) +{ + XFE_PrefsIncomingMServer *theClass = (XFE_PrefsIncomingMServer *) + clientData; + if (theClass->m_mserver_dialog) + XtRemoveCallback(theClass->m_mserver_dialog->getChrome(), + XmNokCallback, cb_refresh, clientData); + theClass->refresh_incoming(); +} + +// Refreshes the incoming server list +void +XFE_PrefsIncomingMServer::refresh_incoming() +{ + XmString str; + char *server_ptr=NULL; + // Clear the list + XmListDeleteAllItems(m_incoming); + if (has_pop()) { + + // Get the POP server + PREF_CopyCharPref("network.hosts.pop_server", &server_ptr); + + // Create a string + str = XmStringCreateLocalized(server_ptr); + + // Add it to the end of the list + XmListAddItem(m_incoming, str, 0); + + // Free the string + XmStringFree(str); + + XP_FREEIF(server_ptr); + + return; + } + + // IMAP + MSG_Master *master=fe_getMNMaster(); + + int total = MSG_GetIMAPHosts(master, NULL, 0); + + if (!total) return; + MSG_IMAPHost** hosts=NULL; + + hosts = new MSG_IMAPHost* [total]; + + XP_ASSERT(hosts != NULL); + + // Get the list of IMAP hosts + total = MSG_GetIMAPHosts(master, hosts, total); + + for (int i=0;igetPage(); + XFE_PrefsDialog *theDialog = thePage->getPrefsDialog(); + + fe_browse_file_of_text(theDialog->getContext(), local->m_local_dir_text, + True); +} + +// Local mail directory +XFE_PrefsLocalMailDir::XFE_PrefsLocalMailDir(Widget localMailDirBox, + XFE_PrefsPage *page) + : prefsPage(page) +{ + + Widget kids[6]; + int i = 0; + + kids[i++] = XmCreateLabelGadget(localMailDirBox, + "localMailDir", + NULL, 0); + + // Get the local_dir from the prefs + kids[i++] = m_local_dir_text = fe_CreateTextField(localMailDirBox, + "localMailText", + NULL, 0); + + kids[i++] = XmCreatePushButtonGadget(localMailDirBox, "chooseButton", + NULL, 0); + + + + XtVaSetValues(kids[0], + XmNleftAttachment, XmATTACH_FORM, + NULL); + + XtVaSetValues(kids[1], + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, kids[0], + XmNrightAttachment, XmATTACH_WIDGET, + XmNrightWidget, kids[2], + NULL); + + XtVaSetValues(kids[2], + XmNrightAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + NULL); + + XtAddCallback(kids[2], XmNactivateCallback, + cb_choose, this); + + XtManageChildren(kids, i); +} + // Member: XFE_PrefsPageMailNewsMserver // Description: Constructor // Inputs: // Side effects: - + XFE_PrefsPageMailNewsMserver::XFE_PrefsPageMailNewsMserver(XFE_PrefsDialog *dialog) - : XFE_PrefsPage(dialog), - m_prefsDataMailNewsMserver(0) + : XFE_PrefsPage(dialog) { } - + // Member: ~XFE_PrefsPageMailNewsMserver // Description: Destructor // Inputs: // Side effects: - + XFE_PrefsPageMailNewsMserver::~XFE_PrefsPageMailNewsMserver() { - delete m_prefsDataMailNewsMserver; } - + // Member: create // Description: Creates page for MailNews/Mail server // Inputs: // Side effects: - + void XFE_PrefsPageMailNewsMserver::create() { - Widget kids[100]; - Arg av[50]; - int ac; - int i; - - PrefsDataMailNewsMserver *fep = NULL; - - fep = new PrefsDataMailNewsMserver; - memset(fep, 0, sizeof(PrefsDataMailNewsMserver)); - m_prefsDataMailNewsMserver = fep; - - fep->context = getContext(); - fep->prompt_dialog = getPrefsDialog()->getDialogChrome(); - - Widget form; - - ac = 0; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - form = XmCreateForm (m_wPageForm, "mailnewsMserver", av, ac); - XtManageChild (form); - m_wPage = fep->page = form; - - Widget frame1; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_NONE); ac++; - frame1 = XmCreateFrame (form, "mServerFrame", av, ac); - - Widget form1; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - form1 = XmCreateForm (frame1, "mServerBox", av, ac); - - Widget server_label; - Widget pop_user_name_label; - Widget pop_user_name_text; - Widget incoming_mail_server_label; - Widget incoming_mail_server_text; - Widget outgoing_mail_server_label; - Widget outgoing_mail_server_text; - - // POP user name and Incoming/outgoing mail server - - ac = 0; - i = 0; - - kids[i++] = server_label = - XmCreateLabelGadget(form1, "serverLabel", av, ac); - - kids[i++] = pop_user_name_label = - XmCreateLabelGadget(form1, "popUserNameLabel", av, ac); - - kids[i++] = incoming_mail_server_label = - XmCreateLabelGadget(form1, "incomingMailServerLabel", av, ac); - - kids[i++] = outgoing_mail_server_label = - XmCreateLabelGadget(form1, "outgoingMailServerLabel", av, ac); - - kids[i++] = pop_user_name_text = - fe_CreateTextField(form1, "popUserNameText", av, ac); - - kids[i++] = incoming_mail_server_text = - fe_CreateTextField(form1, "incomingMailServerText", av, ac); - - kids[i++] = outgoing_mail_server_text = - fe_CreateTextField(form1, "outgoingMailServerText", av, ac); - - fep->pop_user_name_text = pop_user_name_text; - fep->incoming_mail_server_text = incoming_mail_server_text; - fep->outgoing_mail_server_text = outgoing_mail_server_text; - - // Mail server type - - Widget server_type_label; - Widget pop3_toggle; - Widget movemail_toggle; - Widget imap_toggle; - - - kids[i++] = server_type_label = - XmCreateLabelGadget(form1, "serverTypeLabel", av, ac); - - kids[i++] = pop3_toggle = - XmCreateToggleButtonGadget(form1, "pop3Toggle", av, ac); - - kids[i++] = movemail_toggle = - XmCreateToggleButtonGadget(form1, "moveMailToggle", av, ac); - - kids[i++] = imap_toggle = - XmCreateToggleButtonGadget(form1, "imapToggle", av, ac); - - fep->pop3_toggle = pop3_toggle; - fep->movemail_toggle = movemail_toggle; - fep->imap_toggle = imap_toggle; - - Widget leave_msg_on_server_toggle; - // Widget imap_local_copies_toggle; - Widget imap_server_ssl_toggle; - Widget delete_is_move_to_trash_toggle; - - kids[i++] = leave_msg_on_server_toggle = - XmCreateToggleButtonGadget(form1, "leaveMsgToggle", av, ac); - - // kids[i++] = imap_local_copies_toggle = - // XmCreateToggleButtonGadget(form1, "imapLocalCopiesToggle", av, ac); - - kids[i++] = imap_server_ssl_toggle = - XmCreateToggleButtonGadget(form1, "imapServerSslToggle", av, ac); - - kids[i++] = delete_is_move_to_trash_toggle = - XmCreateToggleButtonGadget(form1, "imapDeleteToggle", av, ac); - - fep->leave_msg_on_server_toggle = leave_msg_on_server_toggle; - // fep->imap_local_copies_toggle = imap_local_copies_toggle; - fep->imap_server_ssl_toggle = imap_server_ssl_toggle; - fep->delete_is_move_to_trash_toggle = delete_is_move_to_trash_toggle; - - Widget built_in_app_toggle; - Widget external_app_toggle; - Widget external_app_text; - Widget external_app_browse_button; - - kids[i++] = built_in_app_toggle = - XmCreateToggleButtonGadget(form1, "builtInAppToggle", av, ac); - - kids[i++] = external_app_toggle = - XmCreateToggleButtonGadget(form1, "externalAppToggle", av, ac); - - kids[i++] = external_app_text = - fe_CreateTextField(form1, "externalAppText", av, ac); - - kids[i++] = external_app_browse_button = - XmCreatePushButtonGadget(form1, "externalAppBrowse", av, ac); - - fep->built_in_app_toggle = built_in_app_toggle; - fep->external_app_toggle = external_app_toggle; - fep->external_app_text = external_app_text; - fep->external_app_browse_button = external_app_browse_button; - - - // Attachments - - int labels_width; - int labels_height; - int labels_height2; - - labels_width = XfeVaGetWidestWidget(pop_user_name_label, - incoming_mail_server_label, - outgoing_mail_server_label, - NULL); - - labels_height = XfeVaGetTallestWidget(incoming_mail_server_label, - incoming_mail_server_text, - NULL); - - XtVaSetValues(server_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(pop_user_name_label, - XmNheight, labels_height, - RIGHT_JUSTIFY_VA_ARGS(pop_user_name_label,labels_width), - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, server_label, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(pop_user_name_text, - XmNheight, labels_height, - XmNcolumns, 25, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, pop_user_name_label, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, labels_width, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(outgoing_mail_server_label, - RIGHT_JUSTIFY_VA_ARGS(outgoing_mail_server_label,labels_width), - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, pop_user_name_label, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(outgoing_mail_server_text, - XmNcolumns, 25, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, outgoing_mail_server_label, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, labels_width, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(incoming_mail_server_label, - RIGHT_JUSTIFY_VA_ARGS(incoming_mail_server_label,labels_width), - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, outgoing_mail_server_label, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(incoming_mail_server_text, - XmNcolumns, 25, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, incoming_mail_server_label, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, labels_width, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(server_type_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, incoming_mail_server_text, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(pop3_toggle, - XmNindicatorType, XmONE_OF_MANY, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, server_type_label, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(leave_msg_on_server_toggle, - XmNindicatorType, XmN_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, pop3_toggle, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 16, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(movemail_toggle, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNindicatorType, XmONE_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, leave_msg_on_server_toggle, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, pop3_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - labels_height2 = XfeVaGetTallestWidget(external_app_toggle, - external_app_text, - external_app_browse_button, - NULL); - - XtVaSetValues(built_in_app_toggle, - XmNindicatorType, XmONE_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, movemail_toggle, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 16, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(external_app_toggle, - XmNindicatorType, XmONE_OF_MANY, - XmNheight, labels_height2, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, built_in_app_toggle, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, built_in_app_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(external_app_text, - XmNheight, labels_height2, - XmNcolumns, 20, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, external_app_toggle, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, external_app_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(external_app_browse_button, - XmNheight, labels_height2, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, external_app_toggle, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, external_app_text, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(imap_toggle, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNindicatorType, XmONE_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, external_app_toggle, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, movemail_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(delete_is_move_to_trash_toggle, - XmNindicatorType, XmN_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, imap_toggle, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, leave_msg_on_server_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(imap_server_ssl_toggle, - XmNindicatorType, XmN_OF_MANY, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, delete_is_move_to_trash_toggle, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, leave_msg_on_server_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - // Add callbacks - - XtAddCallback(pop3_toggle, XmNvalueChangedCallback, - cb_toggleServerType, fep); - XtAddCallback(movemail_toggle, XmNvalueChangedCallback, - cb_toggleServerType, fep); - XtAddCallback(imap_toggle, XmNvalueChangedCallback, - cb_toggleServerType, fep); - - XtAddCallback(built_in_app_toggle, XmNvalueChangedCallback, - cb_toggleApplication, fep); - XtAddCallback(external_app_toggle, XmNvalueChangedCallback, - cb_toggleApplication, fep); - - XtAddCallback(external_app_browse_button, XmNactivateCallback, - cb_browseApplication, this); - - XtManageChildren (kids, i); - XtManageChild(form1); - XtManageChild(frame1); - - Widget more_button; - - ac = 0; - i = 0; - - kids[i++] = more_button = - XmCreatePushButtonGadget(form, "moreButton", av, ac); - - XtVaSetValues(more_button, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, frame1, - XmNtopOffset, 8, - XmNleftAttachment, XmATTACH_NONE, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtAddCallback(more_button, XmNactivateCallback, - cb_more, this); - - XtManageChildren(kids, i); - - setCreated(TRUE); + Arg av[50]; + int ac; + + + Widget form; + + ac = 0; + XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; + form = XmCreateForm (m_wPageForm, "mailnewsMserver", av, ac); + m_wPage = form; + + // Incoming mail servers + Widget frame1; + + ac = 0; + XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; + frame1 = XmCreateFrame (form, "iServerFrame", av, ac); + + Widget form1; + + ac = 0; + XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + form1 = XmCreateForm (frame1, "iServerBox", av, ac); + + Widget label1; + + ac = 0; + XtSetArg (av [ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + label1 = XmCreateLabelGadget (frame1, "incomingServerLabel", av, ac); + + // Outgoing mail server + Widget frame2; + + ac = 0; + XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; + XtSetArg (av [ac], XmNtopWidget, frame1); ac++; + + frame2 = XmCreateFrame (form, "oServerFrame", av, ac); + + Widget form2; + + ac = 0; + XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + form2 = XmCreateForm (frame2, "oServerBox", av, ac); + + Widget label2; + + ac = 0; + XtSetArg (av [ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + label2 = XmCreateLabelGadget (frame2, "outgoingServerLabel", av, ac); + + // Local mail directory + Widget frame3; + + ac = 0; + XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; + XtSetArg (av [ac], XmNtopWidget, frame2); ac++; + frame3 = XmCreateFrame (form, "localFrame", av, ac); + + Widget form3; + + ac = 0; + XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; + form3 = XmCreateForm (frame3, "localBox", av, ac); + + Widget label3; + + ac = 0; + XtSetArg (av [ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + label3 = XmCreateLabelGadget (frame3, "localMailDirLabel", av, ac); + + // Create the objects corresponding to the frames + xfe_incoming = new XFE_PrefsIncomingMServer(form1, this); + xfe_outgoing = new XFE_PrefsOutgoingServer(form2); + xfe_local_mail = new XFE_PrefsLocalMailDir(form3, this); + + XtManageChild(label1); + XtManageChild(form1); + XtManageChild(frame1); + + XtManageChild(label2); + XtManageChild(form2); + XtManageChild(frame2); + + XtManageChild(label3); + XtManageChild(form3); + XtManageChild(frame3); + + setCreated(TRUE); } - + // Member: init // Description: Initializes page for MailNewsMserver // Inputs: // Side effects: - + void XFE_PrefsPageMailNewsMserver::init() { - XP_ASSERT(m_prefsDataMailNewsMserver); - - PrefsDataMailNewsMserver *fep = m_prefsDataMailNewsMserver; - XFE_GlobalPrefs *prefs = &fe_globalPrefs; - XP_Bool b; - Boolean sensitive; - - fe_SetTextField(fep->incoming_mail_server_text, prefs->pop3_host); - fe_SetTextField(fep->outgoing_mail_server_text, prefs->mailhost); - fe_SetTextField(fep->pop_user_name_text, prefs->pop3_user_id); - XtVaSetValues(fep->leave_msg_on_server_toggle, XmNset, prefs->pop3_leave_mail_on_server, 0); - // XtVaSetValues(fep->imap_local_copies_toggle, XmNset, prefs->imap_local_copies, 0); - XtVaSetValues(fep->imap_server_ssl_toggle, XmNset, prefs->imap_server_ssl, 0); - XtVaSetValues(fep->delete_is_move_to_trash_toggle, XmNset, prefs->imap_delete_is_move_to_trash, 0); - XtVaSetValues (fep->built_in_app_toggle, XmNset, prefs->builtin_movemail_p, 0); - XtVaSetValues (fep->external_app_toggle, XmNset, !prefs->builtin_movemail_p, 0); - - sensitive = !PREF_PrefIsLocked("mail.server_type"); - XtSetSensitive(fep->movemail_toggle, sensitive); - XtSetSensitive(fep->pop3_toggle, sensitive); - XtSetSensitive(fep->imap_toggle, sensitive); - - if (prefs->mail_server_type == MAIL_SERVER_MOVEMAIL) { - XtVaSetValues(fep->movemail_toggle, XmNset, True, 0); - XtVaSetValues(fep->pop3_toggle, XmNset, False, 0); - XtVaSetValues(fep->imap_toggle, XmNset, False, 0); - XtVaSetValues(fep->pop_user_name_text, XmNsensitive, False, 0); - XtVaSetValues(fep->incoming_mail_server_text, XmNsensitive, False, 0); - b = prefs->builtin_movemail_p; - sensitive = !PREF_PrefIsLocked("mail.use_builtin_movemail"); - XtVaSetValues (fep->built_in_app_toggle, XmNset, b && sensitive, 0); - XtVaSetValues (fep->external_app_toggle, XmNset, !b && sensitive, 0); - sensitive = !PREF_PrefIsLocked("mail.movemail_program"); - XtVaSetValues (fep->external_app_text, XmNsensitive, !b && sensitive, 0); - XtVaSetValues(fep->external_app_browse_button, XmNsensitive, !b && sensitive, 0); - } - else if (prefs->mail_server_type == MAIL_SERVER_POP3) { - // Pop 3 - XtVaSetValues(fep->pop3_toggle, XmNset, True, 0); - XtVaSetValues(fep->movemail_toggle, XmNset, False, 0); - XtVaSetValues(fep->imap_toggle, XmNset, False, 0); - sensitive = !PREF_PrefIsLocked("network.hosts.pop_server"); - XtVaSetValues(fep->incoming_mail_server_text, XmNsensitive, sensitive, 0); - sensitive = !PREF_PrefIsLocked("mail.pop_name"); - XtVaSetValues(fep->pop_user_name_text, XmNsensitive, sensitive, 0); - XtVaSetValues(fep->built_in_app_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_text, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_browse_button, XmNsensitive, False, 0); - } - else if (prefs->mail_server_type == MAIL_SERVER_IMAP) { - XtVaSetValues(fep->movemail_toggle, XmNset, False, 0); - XtVaSetValues(fep->pop3_toggle, XmNset, False, 0); - XtVaSetValues(fep->imap_toggle, XmNset, True, 0); - XtVaSetValues(fep->built_in_app_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_text, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_browse_button, XmNsensitive, False, 0); - sensitive = !PREF_PrefIsLocked("mail.pop_name"); - XtVaSetValues(fep->pop_user_name_text, XmNsensitive, sensitive, 0); - sensitive = !PREF_PrefIsLocked("network.hosts.pop_server"); - XtVaSetValues(fep->incoming_mail_server_text, XmNsensitive, sensitive, 0); - } - - - sensitive = ( prefs->mail_server_type == MAIL_SERVER_POP3 && - !PREF_PrefIsLocked("mail.leave_on_server") ); - XtSetSensitive(fep->leave_msg_on_server_toggle, sensitive); - - // sensitive = ( prefs->mail_server_type == MAIL_SERVER_IMAP && - // !PREF_PrefIsLocked("mail.imap.local_copies") ); - // XtSetSensitive(fep->imap_local_copies_toggle, sensitive); - - sensitive = ( prefs->mail_server_type == MAIL_SERVER_IMAP && - !PREF_PrefIsLocked("mail.imap.server_ssl") ); - XtSetSensitive(fep->imap_server_ssl_toggle, sensitive); - - sensitive = ( prefs->mail_server_type == MAIL_SERVER_IMAP && - !PREF_PrefIsLocked("mail.imap.delete_is_move_to_trash") ); - XtSetSensitive(fep->delete_is_move_to_trash_toggle, sensitive); - - XtSetSensitive(fep->outgoing_mail_server_text, - !PREF_PrefIsLocked("network.hosts.smtp_server")); - - fe_SetTextField(fep->external_app_text, prefs->movemail_program); - - setInitialized(TRUE); + + char *charval; + int32 intval; + + // Fill in the outgoing server and the user name field + PREF_CopyCharPref("network.hosts.smtp_server", &charval); + fe_SetTextField(xfe_outgoing->get_server_name(), charval); + XP_FREE(charval); + + PREF_CopyCharPref("mail.smtp_name", &charval); + fe_SetTextField(xfe_outgoing->get_user_name(), charval); + XP_FREE(charval); + + HG82160 + + // Fill in the local mail directory field + PREF_CopyCharPref("mail.directory", &charval); + fe_SetTextField(xfe_local_mail->get_local_dir_text(), charval); + XP_FREE(charval); + + setInitialized(TRUE); } - + // Member: verify // Description: // Inputs: // Side effects: - + Boolean XFE_PrefsPageMailNewsMserver::verify() { - char buf[10000]; - char *buf2; - char *warning; - int size; - int orig_mail_server_type = fe_globalPrefs.mail_server_type; - int new_mail_server_type=0; // Initialized to avoid warning - RK - Boolean b; - - XP_ASSERT(m_prefsDataMailNewsMserver); - PrefsDataMailNewsMserver *fep = m_prefsDataMailNewsMserver; - - // Pop up a dialog warning the user that he has to exit - // in order for mail server prefs to take effect. - - XtVaGetValues(fep->pop3_toggle, XmNset, &b, 0); - if (b) new_mail_server_type = MAIL_SERVER_POP3; - - XtVaGetValues(fep->movemail_toggle, XmNset, &b, 0); - if (b) new_mail_server_type = MAIL_SERVER_MOVEMAIL; - - XtVaGetValues(fep->imap_toggle, XmNset, &b, 0); - if (b) new_mail_server_type = MAIL_SERVER_IMAP; - - if (new_mail_server_type != orig_mail_server_type) { - if (! XFE_Confirm(getContext(), XP_GetString(MK_MSG_MAIL_DIRECTORY_CHANGED))) { - // revert to old prefs if the user changes his mind - init(); - return FALSE; - } - } - - buf2 = buf; - strcpy (buf, XP_GetString(XFE_WARNING)); - buf2 = buf + XP_STRLEN(buf); - warning = buf2; - size = buf + sizeof (buf) - warning; - - PREFS_CHECK_HOST(fep->outgoing_mail_server_text, XP_GetString(XFE_MAIL_HOST), - warning, size); - - if (*buf2) { - FE_Alert (getContext(), fe_StringTrim (buf)); - return FALSE; - } - else { - return TRUE; - } + + // Don't verify for now. + return TRUE; } - + // Member: install // Description: // Inputs: // Side effects: - + void XFE_PrefsPageMailNewsMserver::install() { - fe_installMailNewsMserver(); + fe_installMailNewsMserver(); } - + // Member: save // Description: // Inputs: // Side effects: - + void XFE_PrefsPageMailNewsMserver::save() { - PrefsDataMailNewsMserver *fep = m_prefsDataMailNewsMserver; - Boolean b; - - XP_ASSERT(fep); - - // Mail server and type - - // POP3 - - XtVaGetValues(fep->leave_msg_on_server_toggle, XmNset, &b, 0); - fe_globalPrefs.pop3_leave_mail_on_server = b; - - XtVaGetValues(fep->pop3_toggle, XmNset, &b, 0); - if (b) { - fe_globalPrefs.mail_server_type = MAIL_SERVER_POP3; - } - - // Movemail - XtVaGetValues(fep->movemail_toggle, XmNset, &b, 0); - fe_globalPrefs.use_movemail_p = b; - if (b) { - fe_globalPrefs.mail_server_type = MAIL_SERVER_MOVEMAIL; - } - - // IMAP - // XtVaGetValues(fep->imap_local_copies_toggle, XmNset, &b, 0); - // fe_globalPrefs.imap_local_copies = b; - XtVaGetValues(fep->imap_server_ssl_toggle, XmNset, &b, 0); - fe_globalPrefs.imap_server_ssl = b; - - XtVaGetValues(fep->delete_is_move_to_trash_toggle, XmNset, &b, 0); - fe_globalPrefs.imap_delete_is_move_to_trash = b; - - XtVaGetValues(fep->imap_toggle, XmNset, &b, 0); - if (b) { - fe_globalPrefs.mail_server_type = MAIL_SERVER_IMAP; - } - - - PREFS_SET_GLOBALPREF_TEXT(movemail_program, external_app_text); - PREFS_SET_GLOBALPREF_TEXT(pop3_host, incoming_mail_server_text); - PREFS_SET_GLOBALPREF_TEXT(pop3_user_id, pop_user_name_text); - PREFS_SET_GLOBALPREF_TEXT(mailhost, outgoing_mail_server_text); - - if (fe_globalPrefs.use_movemail_p) { - XtVaGetValues(fep->built_in_app_toggle, XmNset, &b, 0); - fe_globalPrefs.builtin_movemail_p = b; - } - - // Install preferences - - install(); + + PREF_SetCharPref("network.hosts.smtp_server", + fe_GetTextField(xfe_outgoing->get_server_name())); + + PREF_SetCharPref("mail.smtp_name", + fe_GetTextField(xfe_outgoing->get_user_name())); + + PREF_SetCharPref("mail.directory", + fe_GetTextField(xfe_local_mail->get_local_dir_text())); + + + HG92799 + + install(); } - -// Member: getData -// Description: -// Inputs: -// Side effects: - -PrefsDataMailNewsMserver *XFE_PrefsPageMailNewsMserver::getData() -{ - return m_prefsDataMailNewsMserver; -} - -// Member: cb_browseApplication -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsMserver::cb_browseApplication(Widget /* w */, - XtPointer closure, - XtPointer /* callData */) -{ - XFE_PrefsPageMailNewsMserver *thePage = (XFE_PrefsPageMailNewsMserver *)closure; - XFE_PrefsDialog *theDialog = thePage->getPrefsDialog(); - PrefsDataMailNewsMserver *fep = thePage->getData(); - - fe_browse_file_of_text(theDialog->getContext(), fep->external_app_text, False); -} - -// Member: cb_more -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsMserver::cb_more(Widget /* w */, - XtPointer closure, - XtPointer /* callData */) -{ - XFE_PrefsPageMailNewsMserver *thePage = (XFE_PrefsPageMailNewsMserver *)closure; - XFE_PrefsDialog *theDialog = thePage->getPrefsDialog(); - Widget mainw = theDialog->getBaseWidget(); - - // while (!XtIsWMShell(mainw) && (XtParent(mainw)!=0)) - // mainw = XtParent(mainw); - - // Instantiate a mail server more dialog - - XFE_PrefsMserverMoreDialog *theMoreDialog = 0; - - if ((theMoreDialog = - new XFE_PrefsMserverMoreDialog(theDialog, mainw, "prefsMserverMore")) == 0) { - fe_perror(thePage->getContext(), XP_GetString(XFE_OUT_OF_MEMORY_URL)); - return; - } - - // Initialize and pop up the more dialog - - theMoreDialog->initPage(); - theMoreDialog->show(); -} - -// Member: cb_toggleServerType -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsMserver::cb_toggleServerType(Widget w, - XtPointer closure, - XtPointer callData) -{ - XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)callData; - PrefsDataMailNewsMserver *fep = (PrefsDataMailNewsMserver *)closure; - Boolean sensitive; - - if (! cb->set) { - XtVaSetValues(w, XmNset, True, 0); - } - else if (w == fep->pop3_toggle) { - XtVaSetValues(fep->movemail_toggle, XmNset, False, 0); - XtVaSetValues(fep->imap_toggle, XmNset, False, 0); - XtVaSetValues(fep->built_in_app_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_text, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_browse_button, XmNsensitive, False, 0); - XtVaSetValues(fep->pop_user_name_text, - XmNsensitive, !PREF_PrefIsLocked("mail.pop_name"), 0); - XtVaSetValues(fep->incoming_mail_server_text, - XmNsensitive, !PREF_PrefIsLocked("network.hosts.pop_server"), 0); - XtVaSetValues(fep->leave_msg_on_server_toggle, - XmNsensitive, !PREF_PrefIsLocked("mail.leave_on_server"), - 0); - - XtVaSetValues(fep->imap_server_ssl_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->delete_is_move_to_trash_toggle, XmNsensitive, False, 0); - } - else if (w == fep->movemail_toggle) { - XtVaSetValues(fep->pop3_toggle, XmNset, False, 0); - XtVaSetValues(fep->imap_toggle, XmNset, False, 0); - sensitive = !PREF_PrefIsLocked("mail.use_builtin_movemail"); - XtVaSetValues(fep->built_in_app_toggle, XmNsensitive, sensitive, 0); - XtVaSetValues(fep->external_app_toggle, XmNsensitive, sensitive, 0); - sensitive = !PREF_PrefIsLocked("mail.movemail_program"); - XtVaSetValues(fep->external_app_text, XmNsensitive, sensitive, 0); - XtVaSetValues(fep->external_app_browse_button, XmNsensitive, sensitive, 0); - XtVaSetValues(fep->pop_user_name_text, XmNsensitive, False, 0); - XtVaSetValues(fep->incoming_mail_server_text, XmNsensitive, False, 0); - XtVaSetValues(fep->leave_msg_on_server_toggle, XmNsensitive, False, 0); - // XtVaSetValues(fep->imap_local_copies_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->imap_server_ssl_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->delete_is_move_to_trash_toggle, XmNsensitive, False, 0); - } - else if (w == fep->imap_toggle) { - XtVaSetValues(fep->movemail_toggle, XmNset, False, 0); - XtVaSetValues(fep->pop3_toggle, XmNset, False, 0); - XtVaSetValues(fep->built_in_app_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_toggle, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_text, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_browse_button, XmNsensitive, False, 0); - sensitive = !PREF_PrefIsLocked("mail.pop_name"); - XtVaSetValues(fep->pop_user_name_text, XmNsensitive, sensitive, 0); - sensitive = !PREF_PrefIsLocked("network.hosts.pop_server"); - XtVaSetValues(fep->incoming_mail_server_text, XmNsensitive, sensitive, 0); - XtVaSetValues(fep->leave_msg_on_server_toggle, XmNsensitive, False, 0); - // XtVaSetValues(fep->imap_local_copies_toggle, - // XmNsensitive, !PREF_PrefIsLocked("mail.imap.local_copies"), 0); - XtVaSetValues(fep->imap_server_ssl_toggle, - XmNsensitive, !PREF_PrefIsLocked("mail.imap.server_ssl"), 0); - XtVaSetValues(fep->delete_is_move_to_trash_toggle, - XmNsensitive, !PREF_PrefIsLocked("mail.imap.delete_is_move_to_trash"), 0); - } - else - abort(); -} - -// Member: cb_toggleApplication -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsMserver::cb_toggleApplication(Widget w, - XtPointer closure, - XtPointer callData) -{ - XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)callData; - PrefsDataMailNewsMserver *fep = (PrefsDataMailNewsMserver *)closure; - - if (! cb->set) { - XtVaSetValues(w, XmNset, True, 0); - } - else if (w == fep->built_in_app_toggle) { - XtVaSetValues(fep->external_app_toggle, XmNset, False, 0); - XtVaSetValues(fep->external_app_text, XmNsensitive, False, 0); - XtVaSetValues(fep->external_app_browse_button, XmNsensitive, False, 0); - } - else if (w == fep->external_app_toggle) { - XtVaSetValues(fep->built_in_app_toggle, XmNset, False, 0); - XtVaSetValues(fep->external_app_text, XmNsensitive, True, 0); - XtVaSetValues(fep->external_app_browse_button, XmNsensitive, True, 0); - } - else - abort(); -} - + +#endif + +#ifdef MOZ_MAIL_NEWS // ************************************************************************ -// ************************ Mail News/News Server ************************* +// ************************ Mail Message Copies *************************** // ************************************************************************ - -// Member: XFE_PrefsPageMailNewsNserver -// Description: Constructor + + // Member: XFE_PrefsPageMailNewsCopies + // Description: Constructor + // Inputs: + // Side effects: + +XFE_PrefsPageMailNewsCopies::XFE_PrefsPageMailNewsCopies(XFE_PrefsDialog *dialog) + : XFE_PrefsPage(dialog) +{ + m_master = fe_getMNMaster(); + XP_ASSERT(m_master); + + m_chooseDialog = NULL; +} + +// Member: ~XFE_PrefsPageMailNewsCopies +// Description: destructor // Inputs: // Side effects: - -XFE_PrefsPageMailNewsNserver::XFE_PrefsPageMailNewsNserver(XFE_PrefsDialog *dialog) - : XFE_PrefsPage(dialog), - m_prefsDataMailNewsNserver(0) + +XFE_PrefsPageMailNewsCopies::~XFE_PrefsPageMailNewsCopies() { + if (m_chooseDialog) delete m_chooseDialog; } - -// Member: ~XFE_PrefsPageMailNewsNserver -// Description: Destructor -// Inputs: -// Side effects: - -XFE_PrefsPageMailNewsNserver::~XFE_PrefsPageMailNewsNserver() -{ - delete m_prefsDataMailNewsNserver; -} - + // Member: create -// Description: Creates page for MailNews/News server +// Description: Creates widgets // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsNserver::create() + +void XFE_PrefsPageMailNewsCopies::create() { - Widget kids[100]; - Arg av[50]; - int ac; - int i; - - PrefsDataMailNewsNserver *fep = NULL; - - fep = new PrefsDataMailNewsNserver; - memset(fep, 0, sizeof(PrefsDataMailNewsNserver)); - m_prefsDataMailNewsNserver = fep; - - fep->context = getContext(); - fep->prompt_dialog = getPrefsDialog()->getDialogChrome(); - - Widget form; - - ac = 0; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - form = XmCreateForm (m_wPageForm, "mailnewsNserver", av, ac); - XtManageChild (form); - m_wPage = fep->page = form; - - Widget frame1; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_NONE); ac++; - frame1 = XmCreateFrame (form, "nServerFrame", av, ac); - - Widget form1; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_NONE); ac++; - form1 = XmCreateForm (frame1, "nServerBox", av, ac); - - Widget news_server_label; - Widget nntp_server_label; - Widget port_label; - - ac = 0; - i = 0; - - kids[i++] = news_server_label = - XmCreateLabelGadget(form1, "newsServerLabel", av, ac); - - kids[i++] = port_label = - XmCreateLabelGadget(form1, "portLabel", av, ac); - - kids[i++] = nntp_server_label = - XmCreateLabelGadget(form1, "nntpServerLabel", av, ac); - - kids[i++] = fep->nntp_server_text = - fe_CreateTextField(form1, "nntpServerText", av, ac); - - kids[i++] = fep->port_text = - fe_CreateTextField(form1, "serverPortText", av, ac); - - kids[i++] = fep->secure_toggle = - XmCreateToggleButtonGadget(form1, "secure", av, ac); - - XtVaSetValues(news_server_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(nntp_server_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, news_server_label, - XmNtopOffset, 4, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, news_server_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(fep->nntp_server_text, - XmNcolumns, 35, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, nntp_server_label, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, news_server_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - int labels_height; - labels_height = XfeVaGetTallestWidget(port_label, - fep->port_text, - fep->secure_toggle, - NULL); - - XtVaSetValues(port_label, - XmNheight, labels_height, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, fep->nntp_server_text, - XmNtopOffset, 4, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, news_server_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(fep->port_text, - XmNheight, labels_height, - XmNcolumns, 5, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, port_label, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, port_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(fep->secure_toggle, - XmNheight, labels_height, - XmNindicatorType, XmN_OF_MANY, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, port_label, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, fep->port_text, - XmNleftOffset, 24, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - - XtManageChildren (kids, i); - XtManageChild(form1); - XtManageChild(frame1); - - Widget frame2; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; - XtSetArg (av [ac], XmNtopWidget, frame1); ac++; - XtSetArg (av [ac], XmNtopOffset, 8); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_NONE); ac++; - frame2 = XmCreateFrame(form, "newsDirFrame", av, ac); - - Widget form2; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - form2 = XmCreateForm (frame2, "newsDirBox", av, ac); - - Widget news_dir_label; - Widget browse_button; - Widget msg_label; - - ac = 0; - i = 0; - - kids[i++] = news_dir_label = - XmCreateLabelGadget(form2, "newsDirLabel", av, ac); - - kids[i++] = msg_label = - XmCreateLabelGadget(form2, "msgLabel", av, ac); - - kids[i++] = fep->news_dir_text = - fe_CreateTextField(form2, "newsDirText", av, ac); - - kids[i++] = fep->msg_size_text = - fe_CreateTextField(form2, "msgSizeText", av, ac); - - kids[i++] = fep->notify_toggle = - XmCreateToggleButtonGadget(form2, "notify", av, ac); - - kids[i++] = fep->browse_button = browse_button = - XmCreatePushButtonGadget(form2, "browse", av, ac); - - XtVaSetValues(news_dir_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(fep->news_dir_text, - XmNcolumns, 35, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, news_dir_label, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, news_dir_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(browse_button, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, fep->news_dir_text, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, fep->news_dir_text, - XmNleftOffset, 16, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNbottomWidget, fep->news_dir_text, - NULL); - - labels_height = XfeVaGetTallestWidget(fep->notify_toggle, - fep->msg_size_text, - msg_label, - NULL); - - XtVaSetValues(fep->notify_toggle, - XmNtopOffset, 4, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, fep->news_dir_text, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(fep->msg_size_text, - XmNcolumns, 6, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, fep->notify_toggle, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, fep->notify_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNbottomWidget, fep->notify_toggle, - NULL); - - XtVaSetValues(msg_label, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, fep->notify_toggle, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, fep->msg_size_text, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNbottomWidget, fep->msg_size_text, - NULL); - - XtAddCallback(fep->secure_toggle, XmNvalueChangedCallback, cb_toggleSecure, fep); - XtAddCallback(browse_button, XmNactivateCallback, cb_browse, this); - - XtManageChildren(kids, i); - XtManageChild(form2); - XtManageChild(frame2); - - setCreated(TRUE); + Arg av[50]; + int ac; + + Widget copies_form; + + + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + + m_wPage = copies_form = + XmCreateForm(m_wPageForm, "mailnewsCopies", av,ac); + XtManageChild(copies_form); + + Widget mail_frame = createMailFrame(copies_form, NULL); + Widget news_frame = createNewsFrame(copies_form, mail_frame); + /* Widget dt_frame = */ createDTFrame(copies_form,news_frame); + + // callbacks + XtAddCallback(m_mail_choose_button, XmNactivateCallback, + cb_chooseMailFcc, this); + XtAddCallback(m_news_choose_button, XmNactivateCallback, + cb_chooseNewsFcc, this); + XtAddCallback(m_drafts_choose_button, XmNactivateCallback, + cb_chooseDraftsFcc, this); + XtAddCallback(m_templates_choose_button, XmNactivateCallback, + cb_chooseTemplatesFcc, this); + + setCreated(TRUE); +} + +// Member: create +// Description: Creates widgets +// Inputs: +// Side effects: + +Widget XFE_PrefsPageMailNewsCopies::createMailFrame(Widget parent, + Widget /* attachTo */) +{ + + Widget kids[50]; + Arg av[20]; + int ac; + int i=0; + + XP_ASSERT(parent); + + // Mail copies frame + // top frame, attached to form everywhere but bottom + Widget mail_frame; + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + mail_frame = + XmCreateFrame(parent,"mailFrame",av,ac); + + Widget mail_form; + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + mail_form = + XmCreateForm(mail_frame,"mailForm",av,ac); + + Widget mail_label; + ac=0; + XtSetArg(av[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + mail_label = + XmCreateLabelGadget(mail_frame, "mailCopies",av,ac); + + ac=0; + + kids[i++] = m_mail_self_toggle = + XmCreateToggleButtonGadget(mail_form,"mailSelfToggle", av, ac); + + kids[i++] = m_mail_other_text = + fe_CreateTextField(mail_form,"mailOtherText", av, ac); + + kids[i++] = m_mail_fcc_toggle = + XmCreateToggleButtonGadget(mail_form,"mailFccToggle",av,ac); + + kids[i++] = m_mail_choose_button = + XmCreatePushButtonGadget(mail_form,"mailChooseButton",av,ac); + + kids[i++] = m_mail_other_toggle = + XmCreateToggleButtonGadget(mail_form,"mailOtherToggle",av,ac); + + // place the widgets + int max_height1 = XfeVaGetTallestWidget(m_mail_fcc_toggle, + m_mail_choose_button, + NULL); + int max_height2 = XfeVaGetTallestWidget(m_mail_other_text, + m_mail_other_toggle, + NULL); + + + + XtVaSetValues(m_mail_fcc_toggle, + XmNheight, max_height1, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNleftAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_mail_choose_button, + XmNheight, max_height1, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, m_mail_fcc_toggle, + XmNleftAttachment, XmATTACH_NONE, + XmNrightAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_mail_self_toggle, + XmNheight, max_height1, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, m_mail_fcc_toggle, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_mail_other_toggle, + XmNheight, max_height2, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, m_mail_self_toggle, + XmNrightAttachment, XmATTACH_NONE, + XmNleftAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_mail_other_text, + XmNheight, max_height2, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, m_mail_other_toggle, + XmNrightAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, m_mail_other_toggle, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtManageChildren(kids,i); + XtManageChild(mail_frame); + XtManageChild(mail_form); + XtManageChild(mail_label); + + return mail_frame; } - + + + +// Member: create +// Description: Creates widgets +// Inputs: +// Side effects: + +Widget XFE_PrefsPageMailNewsCopies::createNewsFrame(Widget parent, + Widget attachTo) +{ + + Widget kids[100]; + Arg av[50]; + int ac; + int i=0; + XP_ASSERT(parent); + // News copies frame + // middle frame, attached to mail copies frame and drafts frame + Widget news_frame; + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; + XtSetArg(av[ac], XmNtopWidget, attachTo); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + news_frame = XmCreateFrame(parent,"newsFrame",av,ac); + + Widget news_form; + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + news_form = XmCreateForm(news_frame,"newsForm",av,ac); + + Widget news_label; + ac=0; + XtSetArg(av[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + news_label = XmCreateLabelGadget(news_frame, "newsCopies",av,ac); + + ac=0; + + kids[i++] = m_news_self_toggle = + XmCreateToggleButtonGadget(news_form,"newsSelfToggle", av, ac); + + kids[i++] = m_news_other_text = + fe_CreateTextField(news_form,"newsOtherText", av, ac); + + kids[i++] = m_news_fcc_toggle = + XmCreateToggleButtonGadget(news_form,"newsFccToggle",av,ac); + + kids[i++] = m_news_choose_button = + XmCreatePushButtonGadget(news_form,"newsChooseButton",av,ac); + + kids[i++] = m_news_other_toggle = + XmCreateToggleButtonGadget(news_form,"newsOtherToggle",av,ac); + + // place the widgets + int max_height1 = XfeVaGetTallestWidget(m_news_fcc_toggle, + m_news_choose_button, + NULL); + int max_height2 = XfeVaGetTallestWidget(m_news_other_text, + m_news_other_toggle, + NULL); + + + + XtVaSetValues(m_news_fcc_toggle, + XmNheight, max_height1, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNleftAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_news_choose_button, + XmNheight, max_height1, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, m_news_fcc_toggle, + XmNleftAttachment, XmATTACH_NONE, + XmNrightAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_news_self_toggle, + XmNheight, max_height1, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, m_news_fcc_toggle, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_news_other_toggle, + XmNheight, max_height2, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, m_news_self_toggle, + XmNrightAttachment, XmATTACH_NONE, + XmNleftAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_news_other_text, + XmNheight, max_height2, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, m_news_other_toggle, + XmNrightAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, m_news_other_toggle, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtManageChildren(kids,i); + XtManageChild(news_frame); + XtManageChild(news_form); + XtManageChild(news_label); + + + return news_frame; +} + + +// Member: create +// Description: Creates widgets +// Inputs: +// Side effects: + +Widget XFE_PrefsPageMailNewsCopies::createDTFrame(Widget parent, + Widget attachTo) +{ + + Widget kids[100]; + Arg av[50]; + int ac; + int i=0; + + XP_ASSERT(parent); + + // Drafts/Templates frame + // bottom frame, attached to news copies and bottom + Widget dt_frame; + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; + XtSetArg(av[ac], XmNtopWidget, attachTo); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + dt_frame = XmCreateFrame(parent,"dtFrame",av,ac); + + Widget dt_form; + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + dt_form = XmCreateForm(dt_frame,"dtForm",av,ac); + + Widget dt_label; + ac=0; + XtSetArg(av[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + dt_label = XmCreateLabelGadget(dt_frame, "dtCopies",av,ac); + + ac=0; + kids[i++] = m_drafts_save_label = + XmCreateLabelGadget(dt_form,"dSaveLabel",av,ac); + kids[i++] = m_drafts_choose_button = + XmCreatePushButtonGadget(dt_form, "dFccButton", av, ac); + + kids[i++] = m_templates_save_label = + XmCreateLabelGadget(dt_form,"tSaveLabel",av,ac); + kids[i++] = m_templates_choose_button = + XmCreatePushButtonGadget(dt_form, "tFccButton", av, ac); + + + int max_height1 = XfeVaGetTallestWidget(m_drafts_save_label, + m_drafts_choose_button, + NULL); + int max_height2 = XfeVaGetTallestWidget(m_templates_save_label, + m_templates_choose_button, + NULL); + + XtVaSetValues(m_drafts_save_label, + XmNheight, max_height1, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_drafts_choose_button, + XmNheight, max_height1, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, m_drafts_save_label, + XmNrightAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_templates_save_label, + XmNheight, max_height2, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, m_drafts_save_label, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(m_templates_choose_button, + XmNheight, max_height2, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, m_templates_save_label, + XmNrightAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtManageChildren(kids,i); + XtManageChild(dt_frame); + XtManageChild(dt_form); + XtManageChild(dt_label); + + return dt_frame; +} + // Member: init -// Description: Initializes page for MailNewsNserver +// Description: // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsNserver::init() + +void XFE_PrefsPageMailNewsCopies::init() { - XP_ASSERT(m_prefsDataMailNewsNserver); - - PrefsDataMailNewsNserver *fep = m_prefsDataMailNewsNserver; - XFE_GlobalPrefs *prefs = &fe_globalPrefs; - Boolean sensitive; - char buf[256]; - - // News server - - XtVaSetValues(fep->nntp_server_text, - XmNsensitive, !PREF_PrefIsLocked("network.hosts.nntp_server"), - 0); - fe_SetTextField(fep->nntp_server_text, prefs->newshost); - - PR_snprintf(buf, sizeof(buf), "%d", prefs->news_server_port); - XtVaSetValues(fep->port_text, - XmNsensitive, !PREF_PrefIsLocked("news.server_port"), - 0); - fe_SetTextField(fep->port_text, buf); - - XtVaSetValues(fep->secure_toggle, - XmNset, prefs->news_server_secure, - XmNsensitive, !PREF_PrefIsLocked("news.server_is_secure"), - 0); - - // News folder and download - - fe_SetTextField(fep->news_dir_text, prefs->newsrc_directory); - sensitive = !PREF_PrefIsLocked("news.directory"); - XtSetSensitive(fep->news_dir_text, sensitive); - XtSetSensitive(fep->browse_button, sensitive); - - XtVaSetValues(fep->notify_toggle, XmNset, prefs->news_notify_on, 0); - PR_snprintf(buf, sizeof(buf), "%d", prefs->news_max_articles); - XtVaSetValues(fep->msg_size_text, XmNvalue, buf, 0); - - XtSetSensitive(fep->notify_toggle, !PREF_PrefIsLocked("news.notify.on")); - XtSetSensitive(fep->msg_size_text, !PREF_PrefIsLocked("news.notify.size")); - - setInitialized(TRUE); + + // values to grab from preference + Bool boolval; + Bool locked; + char *charval; + char *bcc, *email, *bcc_format; + XmString xmstr; // temp compound string for labels + + // get e-mail address for "BCC: userid@company.com" fields + PREF_CopyCharPref("mail.identity.useremail", &email); + bcc_format=XP_GetString(XFE_MAIL_SELF_FORMAT); + bcc = PR_smprintf(bcc_format, email); + + // outgoing mail messages + // 1. Toggle self + xmstr = XmStringCreateLocalized(bcc); + PREF_GetBoolPref("mail.cc_self",&boolval); + locked = PREF_PrefIsLocked("mail.cc_self"); + XtVaSetValues(m_mail_self_toggle, + XmNset, boolval, + XmNlabelString, xmstr, + XmNsensitive,!locked, + NULL); + XmStringFree(xmstr); + + // 2. toggle and value of fcc + PREF_GetBoolPref("mail.use_imap_sentmail", &boolval); + if (boolval) + PREF_CopyCharPref("mail.imap_sentmail_path", &charval); + else { + // prepend "mailbox:" onto path + PREF_CopyCharPref("mail.default_fcc", &charval); + char *url=(char *)XP_CALLOC(strlen(charval)+9, sizeof(char)); + XP_STRCPY(url,"mailbox:"); + XP_STRCAT(url,charval); + XP_FREE(charval); + charval=url; + } + + m_mailFcc = GetSpecialFolder(charval, MK_MSG_SENT_L10N_NAME); + xmstr = VerboseFolderName(m_mailFcc); + + PREF_GetBoolPref("mail.use_fcc",&boolval); + locked = PREF_PrefIsLocked("mail.use_fcc"); + XtVaSetValues(m_mail_fcc_toggle, + XmNset, boolval, + XmNlabelString, xmstr, + XmNsensitive, !locked, + NULL); + XmStringFree(xmstr); + XP_FREE(charval); + + // 2.1 fcc button + locked = PREF_PrefIsLocked("mail.default_fcc"); + XtVaSetValues(m_mail_choose_button, + XmNsensitive, !locked, + NULL); + + // 3. CC + PREF_CopyCharPref("mail.default_cc",&charval); + locked = PREF_PrefIsLocked("mail.default_cc"); + XtVaSetValues(m_mail_other_text, + XmNvalue, charval, + XmNsensitive,!locked, + NULL); + XP_FREE(charval); + + // outgoing news messages + // 1. Toggle self + + xmstr = XmStringCreateLocalized(bcc); + PREF_GetBoolPref("news.cc_self",&boolval); + locked = PREF_PrefIsLocked("news.cc_self"); + XtVaSetValues(m_news_self_toggle, + XmNset, boolval, + XmNlabelString, xmstr, + XmNsensitive,!locked, + NULL); + XmStringFree(xmstr); + + // TODO: format as "Fcc %s on %s" + // 2. toggle and value of fcc + PREF_GetBoolPref("news.use_imap_sentmail", &boolval); + if (boolval) // new style - use imap URL + PREF_CopyCharPref("news.imap_sentmail_path", &charval); + else { // old style - use local path + PREF_CopyCharPref("news.default_fcc", &charval); + char *url=(char *)XP_CALLOC(strlen(charval)+9, sizeof(char)); + XP_STRCPY(url,"mailbox:"); + XP_STRCAT(url,charval); + XP_FREE(charval); + charval=url; + } + + m_newsFcc=GetSpecialFolder(charval, MK_MSG_SENT_L10N_NAME); + xmstr = VerboseFolderName(m_newsFcc); + + PREF_GetBoolPref("news.use_fcc",&boolval); + locked = PREF_PrefIsLocked("news.use_fcc"); + XtVaSetValues(m_news_fcc_toggle, + XmNset, boolval, + XmNlabelString, xmstr, + XmNsensitive, !locked, + NULL); + XmStringFree(xmstr); + XP_FREE(charval); + + // 2.1 fcc button + locked = PREF_PrefIsLocked("news.default_fcc"); + XtVaSetValues(m_news_choose_button, + XmNsensitive,!locked, + NULL); + + // 3. CC + PREF_CopyCharPref("news.default_cc",&charval); + locked = PREF_PrefIsLocked("news.default_cc"); + fe_SetTextField(m_news_other_text, charval); + XP_FREE(charval); + + // storage for drafts and templates + PREF_CopyCharPref("mail.default_drafts",&charval); + + m_draftsFcc = GetSpecialFolder(charval, MK_MSG_DRAFTS_L10N_NAME); + xmstr = VerboseFolderName(m_draftsFcc, XFE_DRAFTS_ON_SERVER); + + XtVaSetValues(m_drafts_save_label, + XmNlabelString, xmstr, + NULL); + XmStringFree(xmstr); + XP_FREE(charval); + + PREF_CopyCharPref("mail.default_templates",&charval); + m_templatesFcc = GetSpecialFolder(charval, MK_MSG_TEMPLATES_L10N_NAME); + xmstr = VerboseFolderName(m_templatesFcc, XFE_TEMPLATES_ON_SERVER); + XtVaSetValues(m_templates_save_label, + XmNlabelString, xmstr, + NULL); + XmStringFree(xmstr); + XP_FREE(charval); + + XP_FREE(email); + XP_FREE(bcc); + + setInitialized(TRUE); } - + + +// Member: install +// Description: +// Inputs: +// Side effects: + +void XFE_PrefsPageMailNewsCopies::install() +{ +} + + +// Member: save +// Description: +// Inputs: +// Side effects: + +void XFE_PrefsPageMailNewsCopies::save() +{ + Bool boolval; + char *charval; + URL_Struct *url; + + // Mail + boolval = XmToggleButtonGadgetGetState(m_mail_self_toggle); + PREF_SetBoolPref("mail.cc_self",boolval); + + boolval = XmToggleButtonGadgetGetState(m_mail_fcc_toggle); + PREF_SetBoolPref("mail.use_fcc",boolval); + + charval = XmTextFieldGetString(m_mail_other_text); + PREF_SetCharPref("mail.default_cc",charval); + XtFree(charval); + + if (MSG_GetHostForFolder(m_mailFcc)) { + url=MSG_ConstructUrlForFolder(NULL, m_mailFcc); + XP_ASSERT(url); + if (url) { + PREF_SetBoolPref("mail.use_imap_sentmail",True); + PREF_SetCharPref("mail.imap_sentmail_path",url->address); + NET_FreeURLStruct(url); + } + } else { + charval = (char *)MSG_GetFolderNameFromID(m_mailFcc); + PREF_SetCharPref("mail.default_fcc", charval); + // don't need to free charval + PREF_SetBoolPref("mail.use_imap_sentmail",False); + } + + + // News + boolval = XmToggleButtonGadgetGetState(m_news_self_toggle); + PREF_SetBoolPref("news.cc_self",boolval); + + boolval = XmToggleButtonGadgetGetState(m_news_fcc_toggle); + PREF_SetBoolPref("news.use_fcc",boolval); + + charval = XmTextFieldGetString(m_news_other_text); + PREF_SetCharPref("news.default_cc",charval); + XtFree(charval); + + if (MSG_GetHostForFolder(m_newsFcc)) { + url=MSG_ConstructUrlForFolder(NULL, m_newsFcc); + XP_ASSERT(url); + if (url) { + PREF_SetBoolPref("news.use_imap_sentmail",True); + PREF_SetCharPref("news.imap_sentmail_path",url->address); + NET_FreeURLStruct(url); + } + } else { + charval = (char *)MSG_GetFolderNameFromID(m_newsFcc); + PREF_SetCharPref("news.default_fcc", charval); + // don't need to free charval + PREF_SetBoolPref("news.use_imap_sentmail",False); + } + + url=MSG_ConstructUrlForFolder(NULL, m_draftsFcc); + PREF_SetCharPref("mail.default_drafts",url->address); + NET_FreeURLStruct(url); + + url=MSG_ConstructUrlForFolder(NULL, m_templatesFcc); + PREF_SetCharPref("mail.default_templates",url->address); + NET_FreeURLStruct(url); + + install(); +} + // Member: verify // Description: // Inputs: // Side effects: - -Boolean XFE_PrefsPageMailNewsNserver::verify() + +Boolean XFE_PrefsPageMailNewsCopies::verify() { - char buf[10000]; - char *buf2; - char *warning; - struct stat st; - int size; - - buf2 = buf; - strcpy (buf, XP_GetString(XFE_WARNING)); - buf2 = buf + XP_STRLEN(buf); - warning = buf2; - size = buf + sizeof (buf) - warning; - - XP_ASSERT(m_prefsDataMailNewsNserver); - PrefsDataMailNewsNserver *fep = m_prefsDataMailNewsNserver; - - PREFS_CHECK_HOST (fep->nntp_server_text, - XP_GetString(XFE_NEWS_HOST), warning, size); - PREFS_CHECK_DIR (fep->news_dir_text, - XP_GetString(XFE_NEWS_DIR), - warning, size); - - if (*buf2) { - FE_Alert(getContext(), fe_StringTrim (buf)); - return FALSE; - } - else { - return TRUE; - } + return TRUE; } - -// Member: install -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsNserver::install() + + +XmString XFE_PrefsPageMailNewsCopies::VerboseFolderName(MSG_FolderInfo *pFolder, int format_string_id) { - fe_installMailNewsNserver(); + MSG_FolderLine folderLine, hostFolderLine; + MSG_FolderInfo *hostFolder; + MSG_Host *host; + XmString xmstr; + char *verbose_folder; + + XP_ASSERT(pFolder); + + host=MSG_GetHostForFolder(pFolder); + if (host) + hostFolder=MSG_GetFolderInfoForHost(host); + else + hostFolder=MSG_GetLocalMailTree(m_master); + + XP_ASSERT(hostFolder); + + MSG_GetFolderLineById(m_master, pFolder, &folderLine); + MSG_GetFolderLineById(m_master, hostFolder, &hostFolderLine); + + if (format_string_id==0) format_string_id=XFE_FOLDER_ON_SERVER_FORMAT; + + char *folder_format=XP_GetString(format_string_id); + verbose_folder=PR_smprintf(folder_format, + folderLine.prettyName, + hostFolderLine.name); + xmstr = XmStringCreateLocalized(verbose_folder); + XP_FREE(verbose_folder); + + return xmstr; } - -// Member: save -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsNserver::save() + +MSG_FolderInfo *XFE_PrefsPageMailNewsCopies::GetSpecialFolder(char *url, int l10n_name) { + + MSG_FolderInfo *folder; + if (url) { + folder = MSG_GetFolderInfoFromURL(m_master, url, TRUE); + if (folder) return folder; + } + + // the messaging library wouldn't give it to us, + // so we'll build it ourselves. + + char *folder_name=XP_GetString(l10n_name); + XP_ASSERT(folder_name); + + char *mail_dir; + PREF_CopyCharPref("mail.directory",&mail_dir); + + // concatinate "mailbox:" + mail_dir + "/" + folder_name + char *magic_url=(char *)XP_CALLOC(9+strlen(mail_dir)+1+ + strlen(folder_name)+1, + sizeof(char)); + + XP_STRCPY(magic_url,"mailbox:"); + XP_STRCAT(magic_url,mail_dir); + + // make sure there is exactly one '/' + // MSG_GetFolderInfoFromURL doesn't like '//' + char *slash=XP_STRRCHR(magic_url,'/'); + if (slash) { + slash++; + if (*slash!='\0') + XP_STRCAT(magic_url,"/"); + } + XP_STRCAT(magic_url,folder_name); + + folder = MSG_GetFolderInfoFromURL(m_master,magic_url, TRUE); + XP_ASSERT(folder); + XP_FREE(mail_dir); + XP_FREE(magic_url); + return folder; + +} + + +// global callback for all of the Choose Folder.. buttons +MSG_FolderInfo *XFE_PrefsPageMailNewsCopies::chooseFcc(int l10n_name, MSG_FolderInfo *selected_folder) { + + XFE_PrefsDialog *theDialog = getPrefsDialog(); + Widget mainw = theDialog->getBaseWidget(); + + if (m_chooseDialog==NULL) { + m_chooseDialog = new XFE_PrefsMailFolderDialog(mainw, m_master, getContext()); + m_chooseDialog->initPage(); + } + m_chooseDialog->setFolder(selected_folder,l10n_name); + return m_chooseDialog->prompt(); + +} + +void XFE_PrefsPageMailNewsCopies::cb_chooseMailFcc(Widget, XtPointer closure,XtPointer) { - PrefsDataMailNewsNserver *fep = m_prefsDataMailNewsNserver; - - XP_ASSERT(fep); - - PREFS_SET_GLOBALPREF_TEXT(newshost, nntp_server_text); - - XP_FREEIF(fe_globalPrefs.newsrc_directory); - char *s = fe_GetTextField(fep->news_dir_text); - fe_globalPrefs.newsrc_directory = s ? s : XP_STRDUP(""); - - Boolean b; - - XtVaGetValues(fep->notify_toggle, XmNset, &b, 0); - fe_globalPrefs.news_notify_on = b; - - XtVaGetValues(fep->secure_toggle, XmNset, &b, 0); - fe_globalPrefs.news_server_secure = b; - - char *text; - char dummy; - int size = 0; - int port = 0; - - XtVaGetValues(fep->msg_size_text, XmNvalue, &text, 0); - if (1 == sscanf(text, " %d %c", &size, &dummy) && - size >= 0) - fe_globalPrefs.news_max_articles = size; - if (text) XtFree(text); - - XtVaGetValues(fep->port_text, XmNvalue, &text, 0); - if (1 == sscanf(text, " %d %c", &port, &dummy) && - port >= 0) - fe_globalPrefs.news_server_port = port; - if (text) XtFree(text); - - // Install preferences - - install(); + XFE_PrefsPageMailNewsCopies *prefsPage= + (XFE_PrefsPageMailNewsCopies*)closure; + + prefsPage->m_mailFcc = + prefsPage->chooseFcc(MK_MSG_SENT_L10N_NAME,prefsPage->m_mailFcc); + XmString xmstr=prefsPage->VerboseFolderName(prefsPage->m_mailFcc); + XtVaSetValues(prefsPage->m_mail_fcc_toggle,XmNlabelString,xmstr,NULL); + XmStringFree(xmstr); } - -// Member: getData -// Description: -// Inputs: -// Side effects: - -PrefsDataMailNewsNserver *XFE_PrefsPageMailNewsNserver::getData() + +void XFE_PrefsPageMailNewsCopies::cb_chooseNewsFcc(Widget, XtPointer closure, XtPointer) { - return m_prefsDataMailNewsNserver; + XFE_PrefsPageMailNewsCopies *prefsPage= + (XFE_PrefsPageMailNewsCopies*)closure; + + prefsPage->m_newsFcc = + prefsPage->chooseFcc(MK_MSG_SENT_L10N_NAME,prefsPage->m_newsFcc); + XmString xmstr=prefsPage->VerboseFolderName(prefsPage->m_newsFcc); + XtVaSetValues(prefsPage->m_news_fcc_toggle,XmNlabelString,xmstr,NULL); + XmStringFree(xmstr); } - -// Member: cb_browse -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsNserver::cb_browse(Widget /* w */, - XtPointer closure, - XtPointer /* callData */) + +void XFE_PrefsPageMailNewsCopies::cb_chooseDraftsFcc(Widget, XtPointer closure, XtPointer) { - XFE_PrefsPageMailNewsNserver *thePage = (XFE_PrefsPageMailNewsNserver *)closure; - XFE_PrefsDialog *theDialog = thePage->getPrefsDialog(); - PrefsDataMailNewsNserver *fep = thePage->getData(); - - fe_browse_file_of_text(theDialog->getContext(), fep->news_dir_text, True); + XFE_PrefsPageMailNewsCopies *prefsPage= + (XFE_PrefsPageMailNewsCopies*)closure; + + prefsPage->m_draftsFcc = + prefsPage->chooseFcc(MK_MSG_DRAFTS_L10N_NAME,prefsPage->m_draftsFcc); + XmString xmstr=prefsPage->VerboseFolderName(prefsPage->m_draftsFcc, XFE_DRAFTS_ON_SERVER); + XtVaSetValues(prefsPage->m_drafts_save_label,XmNlabelString,xmstr,NULL); + XmStringFree(xmstr); } - -// Member: cb_toggleSecure -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsNserver::cb_toggleSecure(Widget /*w*/, - XtPointer closure, - XtPointer callData) + +void XFE_PrefsPageMailNewsCopies::cb_chooseTemplatesFcc(Widget, XtPointer closure, XtPointer) { - XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)callData; - PrefsDataMailNewsNserver *fep = (PrefsDataMailNewsNserver *)closure; - char *port_text = 0; - char *trimmed_port_text; - int port_number; - char buf[256]; - - port_text = fe_GetTextField(fep->port_text); - if (port_text) { - trimmed_port_text = fe_StringTrim(port_text); - if (XP_STRLEN(trimmed_port_text) == 0) { - port_number = (cb->set) ? SECURE_NEWS_PORT : NEWS_PORT; - } - else { - port_number = atoi(trimmed_port_text); - if (cb->set && port_number == NEWS_PORT) - port_number = SECURE_NEWS_PORT; - else if (! cb->set && port_number == SECURE_NEWS_PORT) - port_number = NEWS_PORT; - } - XtFree(port_text); - } - else { - port_number = (cb->set) ? SECURE_NEWS_PORT : NEWS_PORT; - } - - PR_snprintf(buf, sizeof(buf), "%d", port_number); - fe_SetTextField(fep->port_text, buf); + XFE_PrefsPageMailNewsCopies *prefsPage= + (XFE_PrefsPageMailNewsCopies*)closure; + + prefsPage->m_templatesFcc = + prefsPage->chooseFcc(MK_MSG_TEMPLATES_L10N_NAME,prefsPage->m_templatesFcc); + XmString xmstr=prefsPage->VerboseFolderName(prefsPage->m_templatesFcc,XFE_DRAFTS_ON_SERVER); + XtVaSetValues(prefsPage->m_templates_save_label,XmNlabelString,xmstr,NULL); + XmStringFree(xmstr); } - + +#endif /* MOZ_MAIL_NEWS */ + + +#ifdef MOZ_MAIL_NEWS + // ************************************************************************ -// *********************** Mail News/Address Book ************************* +// ************************ Mail Message HTML *************************** // ************************************************************************ - -const int XFE_PrefsPageMailNewsAddrBook::OUTLINER_COLUMN_NAME = 0; -const int XFE_PrefsPageMailNewsAddrBook::OUTLINER_COLUMN_MAX_LENGTH = 256; -const int XFE_PrefsPageMailNewsAddrBook::OUTLINER_INIT_POS = (-1); -#define STRING_COL_NAME "Name" - -// Member: XFE_PrefsPageMailNewsAddrBook -// Description: Constructor -// Inputs: -// Side effects: - -XFE_PrefsPageMailNewsAddrBook::XFE_PrefsPageMailNewsAddrBook(XFE_PrefsDialog *dialog) - : XFE_PrefsPage(dialog), - m_prefsDataMailNewsAddrBook(0), - m_rowIndex(0) + + // Member: XFE_PrefsPageMailNewsHTML + // Description: Constructor + // Inputs: + // Side effects: + +XFE_PrefsPageMailNewsHTML::XFE_PrefsPageMailNewsHTML(XFE_PrefsDialog *dialog) + : XFE_PrefsPage(dialog) { } - -// Member: ~XFE_PrefsPageMailNewsAddrBook -// Description: Destructor + +// Member: ~XFE_PrefsPageMailNewsHTML +// Description: destructor // Inputs: // Side effects: - -XFE_PrefsPageMailNewsAddrBook::~XFE_PrefsPageMailNewsAddrBook() + +XFE_PrefsPageMailNewsHTML::~XFE_PrefsPageMailNewsHTML() { - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - - if (fep) { - delete fep->dir_outliner; - if (fep->directories) - XP_ListDestroy(fep->directories); - // Note: do not destroy deleted_directories. It's taken care of by - // DIR_DeleteServerList, which is called by DIR_CleanUpServerPreferences - } - delete m_prefsDataMailNewsAddrBook; } - + // Member: create -// Description: Creates page for MailNews/Address Book +// Description: Creates widgets // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsAddrBook::create() + +void XFE_PrefsPageMailNewsHTML::create() { - Widget kids[100]; - Arg av[50]; - int ac; - int i; - - PrefsDataMailNewsAddrBook *fep = NULL; - - fep = new PrefsDataMailNewsAddrBook; - memset(fep, 0, sizeof(PrefsDataMailNewsAddrBook)); - m_prefsDataMailNewsAddrBook = fep; - - fep->context = getContext(); - fep->prompt_dialog = getPrefsDialog()->getDialogChrome(); - - Widget form; - - ac = 0; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - form = XmCreateForm (m_wPageForm, "mailnewsAddrBook", av, ac); - XtManageChild (form); - m_wPage = fep->page = form; - - Widget frame1; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_NONE); ac++; - frame1 = XmCreateFrame (form, "addrBookFrame", av, ac); - - Widget form1; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - form1 = XmCreateForm (frame1, "addrBookBox", av, ac); - - Widget addr_book_label; - Widget dir_list; - Widget up_button; - Widget down_button; - Widget add_button; - Widget edit_button; - Widget delete_button; - - ac = 0; - i = 0; - - kids[i++] = addr_book_label = - XmCreateLabelGadget(form1, "addrBookLabel", av, ac); - - kids[i++] = up_button = - XmCreateArrowButtonGadget(form1, "upButton", av, ac); - - kids[i++] = down_button = - XmCreateArrowButtonGadget(form1, "downButton", av, ac); - - kids[i++] = add_button = - XmCreatePushButtonGadget(form1, "newButton", av, ac); - - kids[i++] = edit_button = - XmCreatePushButtonGadget(form1, "editButton", av, ac); - - kids[i++] = delete_button = - XmCreatePushButtonGadget(form1, "deleteButton", av, ac); - - // Outliner - - int num_columns = 1; - static int default_column_widths[] = {40}; - XFE_Outliner *outliner; - - outliner = new XFE_Outliner("dirList", // name - this, // outlinable - getPrefsDialog(), // top level - form1, // parent - FALSE, // constant size - FALSE, // has headings - num_columns, // number of columns - num_columns, // number of visible columns - default_column_widths, // default column widths - OUTLINER_GEOMETRY_PREF - ); - - dir_list = fep->dir_list = outliner->getBaseWidget(); - - XtVaSetValues(outliner->getBaseWidget(), - XtVaTypedArg, XmNblankBackground, XmRString, "white", 6, - XmNvisibleRows, 10, - NULL); - XtVaSetValues(outliner->getBaseWidget(), - XmNcellDefaults, True, - XtVaTypedArg, XmNcellBackground, XmRString, "white", 6, - NULL); - - outliner->setColumnResizable(OUTLINER_COLUMN_NAME, False); - outliner->show(); - - fep->add_button = add_button; - fep->edit_button = edit_button; - fep->delete_button = delete_button; - fep->up_button = up_button; - fep->down_button = down_button; - fep->dir_outliner = outliner; - - XtVaSetValues(addr_book_label, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - Pixel parent_bg; - XtVaGetValues(getPrefsDialog()->getDialogChrome(), XmNbackground, &parent_bg, 0); - - XtVaSetValues(dir_list, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, addr_book_label, - XmNtopOffset, 4, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - Dimension list_height; - Dimension up_button_height; - int down_button_top_offset; - int up_button_top_offset; - - XtVaGetValues(down_button, - XmNtopOffset, &down_button_top_offset, - NULL); - - list_height = XfeHeight(dir_list); - up_button_height = XfeHeight(up_button); - up_button_top_offset = list_height/2 - up_button_height - down_button_top_offset/2; - - XtVaSetValues(up_button, - XmNarrowDirection, XmARROW_UP, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, dir_list, - XmNtopOffset, up_button_top_offset, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, dir_list, - XmNleftOffset, 8, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(down_button, - XmNarrowDirection, XmARROW_DOWN, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, up_button, - XmNtopOffset, 4, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, up_button, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - int labels_width; - labels_width = XfeVaGetWidestWidget(add_button, - edit_button, - delete_button, - NULL); - - XtVaSetValues(add_button, - XmNwidth, labels_width, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, dir_list, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, up_button, - XmNleftOffset, 24, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(edit_button, - XmNwidth, labels_width, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, add_button, - XmNtopOffset, 4, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, add_button, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(delete_button, - XmNwidth, labels_width, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, edit_button, - XmNtopOffset, 4, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, add_button, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtManageChildren (kids, i); - XtManageChild(form1); - XtManageChild(frame1); - - // Show full names as - - Widget frame2; - - ac = 0; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; - XtSetArg (av [ac], XmNtopWidget, frame1); ac++; - XtSetArg (av [ac], XmNtopOffset, 8); ac++; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_NONE); ac++; - frame2 = XmCreateFrame (form, "frame2", av, ac); - - Widget form2; - - ac = 0; - XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; - XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; - form2 = XmCreateForm (frame2, "toolbarBox", av, ac); - - Widget label2; - - ac = 0; - XtSetArg (av [ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; - label2 = XmCreateLabelGadget (frame2, "fullNameLabel", av, ac); - - Widget first_last_toggle; - Widget last_first_toggle; - Widget first_last_label; - Widget last_first_label; - - ac = 0; - i = 0; - - kids[i++] = first_last_toggle = - XmCreateToggleButtonGadget(form2, "firstLastToggle", av, ac); - - kids[i++] = last_first_toggle = - XmCreateToggleButtonGadget(form2, "lastFirstToggle", av, ac); - - kids[i++] = first_last_label = - XmCreateLabelGadget(form2, "firstLastLabel", av, ac); - - kids[i++] = last_first_label = - XmCreateLabelGadget(form2, "lastFirstLabel", av, ac); - - fep->first_last_toggle = first_last_toggle; - fep->last_first_toggle = last_first_toggle; - - int labels_width2; - - labels_width2 = XfeVaGetWidestWidget(first_last_toggle, - last_first_toggle, - NULL); - - int labels_height; - - labels_height = XfeVaGetTallestWidget(first_last_toggle, - first_last_label, - NULL); - - XtVaSetValues(first_last_toggle, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNindicatorType, XmONE_OF_MANY, - XmNwidth, labels_width2, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 16, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(first_last_label, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, first_last_toggle, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, first_last_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(last_first_toggle, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNindicatorType, XmONE_OF_MANY, - XmNwidth, labels_width2, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, first_last_toggle, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, first_last_toggle, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(last_first_label, - XmNheight, labels_height, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopWidget, last_first_toggle, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftWidget, first_last_label, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtManageChildren (kids, i); - XtManageChild(label2); - XtManageChild(form2); - XtManageChild(frame2); - - // Add callbacks - - XtAddCallback(up_button, XmNactivateCallback, cb_promote, this); - XtAddCallback(down_button, XmNactivateCallback, cb_demote, this); - XtAddCallback(add_button, XmNactivateCallback, cb_add, this); - XtAddCallback(edit_button, XmNactivateCallback, cb_edit, this); - XtAddCallback(delete_button, XmNactivateCallback, cb_delete, this); - - XtAddCallback(first_last_toggle, XmNvalueChangedCallback, cb_toggleNameOrder, fep); - XtAddCallback(last_first_toggle, XmNvalueChangedCallback, cb_toggleNameOrder, fep); - - setCreated(TRUE); + Arg av[50]; + int ac; + + Widget html_form; + + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + + m_wPage = html_form = + XmCreateForm(m_wPageForm, "mailnewsHTML", av,ac); + XtManageChild(html_form); + + Widget usehtml_frame=createUseHTMLFrame(html_form, NULL); + /* Widget nohtml_frame= */ createNoHTMLFrame(html_form, usehtml_frame); + + setCreated(TRUE); +} + +Widget XFE_PrefsPageMailNewsHTML::createUseHTMLFrame(Widget parent, + Widget attachTo) +{ + Widget kids[100]; + Arg av[50]; + int ac; + int i=0; + + XP_ASSERT(parent); + + Widget usehtml_frame; + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; + XtSetArg(av[ac], XmNtopWidget, attachTo); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + usehtml_frame = + XmCreateFrame(parent,"useHTMLFrame",av,ac); + + Widget usehtml_form; + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + usehtml_form = + XmCreateForm(usehtml_frame,"useHTMLForm",av,ac); + + Widget usehtml_label; + ac=0; + XtSetArg(av[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + usehtml_label = + XmCreateLabelGadget(usehtml_frame, "useHTML",av,ac); + + // child Widgets + + Widget usehtml_toggle; + kids[i++] = usehtml_toggle = + XmCreateToggleButtonGadget(usehtml_form, "useHTMLToggle",av,ac); + + m_usehtml_toggle=usehtml_toggle; + + XtVaSetValues(usehtml_toggle, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtManageChildren(kids,i); + XtManageChild(usehtml_frame); + XtManageChild(usehtml_form); + XtManageChild(usehtml_label); + + return usehtml_frame; +} + +Widget XFE_PrefsPageMailNewsHTML::createNoHTMLFrame(Widget parent, + Widget attachTo) +{ + Widget kids[100]; + Arg av[50]; + int ac; + int i=0; + + XP_ASSERT(parent); + + Widget nohtml_frame; + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; + XtSetArg(av[ac], XmNtopWidget, attachTo); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + nohtml_frame = + XmCreateFrame(parent,"noHTMLFrame",av,ac); + + Widget nohtml_form; + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + nohtml_form = + XmCreateForm(nohtml_frame,"noHTMLForm",av,ac); + + + Widget nohtml_label; + + ac=0; + XtSetArg(av[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + nohtml_label = + XmCreateLabelGadget(nohtml_frame, "noHTML",av,ac); + + Widget nohtml_radio_rb; + Widget nohtml_override_label; + + ac=0; + kids[i++] = nohtml_radio_rb = + XmCreateRadioBox(nohtml_form, "noHTMLRB", av, ac); + kids[i++] = nohtml_override_label = + XmCreateLabelGadget(nohtml_form,"noHTMLoverride", av, ac); + + XtVaSetValues(nohtml_radio_rb, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtVaSetValues(nohtml_override_label, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, nohtml_radio_rb, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + XtManageChildren(kids,i); + + i=0; + ac=0; + kids[i++] = m_nohtml_ask_toggle = + XmCreateToggleButtonGadget(nohtml_radio_rb, "noHTMLAsk", av, ac); + kids[i++] = m_nohtml_text_toggle = + XmCreateToggleButtonGadget(nohtml_radio_rb, "noHTMLText", av, ac); + kids[i++] = m_nohtml_html_toggle = + XmCreateToggleButtonGadget(nohtml_radio_rb, "noHTMLHTML", av, ac); + kids[i++] = m_nohtml_both_toggle = + XmCreateToggleButtonGadget(nohtml_radio_rb, "noHTMLBoth", av, ac); + + XtManageChildren(kids,i); + XtManageChild(nohtml_radio_rb); + XtManageChild(nohtml_frame); + XtManageChild(nohtml_form); + XtManageChild(nohtml_label); + + return nohtml_frame; } - // Member: init -// Description: Initializes page for MailNewsAddrBook +// Description: // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsAddrBook::init() + +void XFE_PrefsPageMailNewsHTML::init() { - XP_ASSERT(m_prefsDataMailNewsAddrBook); - - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - XFE_GlobalPrefs *prefs = &fe_globalPrefs; - Boolean sensitive; - - if (! fep->deleted_directories) fep->deleted_directories = XP_ListNew(); - fep->directories = FE_GetDirServers(); - fep->num_directories = XP_ListCount(fep->directories); - - fep->dir_outliner->change(0, fep->num_directories, fep->num_directories); - setSelectionPos(OUTLINER_INIT_POS); - - sensitive = !PREF_PrefIsLocked("mail.addr_book.lastnamefirst"); - XtVaSetValues(fep->first_last_toggle, - XmNset, !prefs->addr_book_lastname_first, - XmNsensitive, sensitive, - 0); - XtVaSetValues(fep->last_first_toggle, - XmNset, prefs->addr_book_lastname_first, - XmNsensitive, sensitive, - 0); - - setInitialized(TRUE); + + Bool boolval; + Bool locked; + int32 intval; + + + PREF_GetBoolPref("mail.html_compose",&boolval); + locked = PREF_PrefIsLocked("mail.html_compose"); + XtVaSetValues(m_usehtml_toggle, + XmNset, boolval, + XmNsensitive, !locked, + NULL); + + PREF_GetIntPref("mail.default_html_action",&intval); + locked = PREF_PrefIsLocked("mail.default_html_action"); + XtVaSetValues(m_nohtml_ask_toggle, + XmNset, (intval == HTML_ACTION_ASK), + XmNsensitive, !locked, + NULL); + XtVaSetValues(m_nohtml_text_toggle, + XmNset, (intval == HTML_ACTION_TEXT), + XmNsensitive, !locked, + NULL); + XtVaSetValues(m_nohtml_html_toggle, + XmNset, (intval == HTML_ACTION_HTML), + XmNsensitive, !locked, + NULL); + XtVaSetValues(m_nohtml_both_toggle, + XmNset, (intval == HTML_ACTION_BOTH), + XmNsensitive, !locked, + NULL); + + setInitialized(TRUE); } - + // Member: install // Description: // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsAddrBook::install() + +void XFE_PrefsPageMailNewsHTML::install() { - XP_ASSERT(m_prefsDataMailNewsAddrBook); - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - - // directory listing - - DIR_SaveServerPreferences(fep->directories); - DIR_CleanUpServerPreferences(fep->deleted_directories); - fe_installMailNewsAddrBook(); } - + + // Member: save // Description: // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsAddrBook::save() + +void XFE_PrefsPageMailNewsHTML::save() { - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - Boolean b; - - // XP_ASSERT(fep); - - XtVaGetValues(fep->last_first_toggle, XmNset, &b, 0); - fe_globalPrefs.addr_book_lastname_first = b; - - // Install preferences - - install(); + Bool boolval; + + boolval = XmToggleButtonGadgetGetState(m_usehtml_toggle); + PREF_SetBoolPref("mail.html_compose",boolval); + + boolval = XmToggleButtonGadgetGetState(m_nohtml_ask_toggle); + if (boolval) PREF_SetIntPref("mail.default_html_action",HTML_ACTION_ASK); + + boolval = XmToggleButtonGadgetGetState(m_nohtml_text_toggle); + if (boolval) PREF_SetIntPref("mail.default_html_action",HTML_ACTION_TEXT); + + boolval = XmToggleButtonGadgetGetState(m_nohtml_html_toggle); + if (boolval) PREF_SetIntPref("mail.default_html_action",HTML_ACTION_HTML); + + boolval = XmToggleButtonGadgetGetState(m_nohtml_both_toggle); + if (boolval) PREF_SetIntPref("mail.default_html_action",HTML_ACTION_BOTH); + + install(); + + } - -// Member: insertDir + +// Member: verify // Description: // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsAddrBook::insertDir(DIR_Server *dir) + +Boolean XFE_PrefsPageMailNewsHTML::verify() { - // First figure out where to insert it - - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - int pos = 0; - int count = fep->num_directories; - - if (count > 0) { - // Check if there is any selection - uint32 sel_count = 0; - const int *indices = 0; - fep->dir_outliner->getSelection(&indices, (int *) &sel_count); - if (sel_count > 0 && indices) { - pos = indices[0]; - } - } - - // Insert at pos - - insertDirAtPos(pos, dir); + return TRUE; } - -// Member: insertDirAtPos + +#endif /* MOZ_MAIL_NEWS */ + +#ifdef MOZ_MAIL_NEWS + +// ************************************************************************ +// ************************ Mail News Return Receipts ******************** +// ************************************************************************ + + // Member: XFE_PrefsPageMailNewsReceipts + // Description: Constructor + // Inputs: + // Side effects: + +XFE_PrefsPageMailNewsReceipts::XFE_PrefsPageMailNewsReceipts(XFE_PrefsDialog *dialog) + : XFE_PrefsPage(dialog) +{ +} + +// Member: ~XFE_PrefsPageMailNewsReceipts +// Description: destructor +// Inputs: +// Side effects: + +XFE_PrefsPageMailNewsReceipts::~XFE_PrefsPageMailNewsReceipts() +{ +} + +// Member: create +// Description: Creates widgets +// Inputs: +// Side effects: + +void XFE_PrefsPageMailNewsReceipts::create() +{ + Arg av[10]; + int ac; + + + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + + Widget receipts_form; + m_wPage = receipts_form= + XmCreateForm(m_wPageForm, "mailnewsReceipts", av,ac); + + Widget frame1, frame2, frame3, kids[5]; + int i =0; + kids[i++]=frame1=createRequestReceiptsFrame(receipts_form, NULL); + XtVaSetValues(frame1, XmNtopAttachment, XmATTACH_FORM, 0); + + kids[i++]=frame2=createReceiptsArriveFrame(receipts_form, frame1); + kids[i++]=frame3=createReceiveReceiptsFrame(receipts_form, frame2); + + XtManageChildren(kids,i); + XtManageChild(receipts_form); + + setCreated(TRUE); +} + +Widget XFE_PrefsPageMailNewsReceipts::createRequestReceiptsFrame(Widget parent, + Widget attachTo) +{ + Widget kids[10]; + Arg av[10]; + int ac; + int i=0; + + XP_ASSERT(parent); + + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; + XtSetArg(av[ac], XmNtopWidget, attachTo); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Widget frame + = XmCreateFrame(parent,"requestReceiptsFrame",av,ac); + + ac=0; + XtSetArg(av[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + Widget label + = XmCreateLabelGadget(frame, "requestReceiptsLabel",av,ac); + + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Widget form + = XmCreateForm(frame,"requestReceiptsForm",av,ac); + + // child Widgets + + ac=0; + Widget radioBox= + XmCreateRadioBox(form, "requestReceiptsRB", av, ac); + + XtVaSetValues(radioBox, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + + i=0; + ac=0; + kids[i++] = m_dsn_toggle = + XmCreateToggleButtonGadget(radioBox, "dsn", av, ac); + kids[i++] = m_mdn_toggle = + XmCreateToggleButtonGadget(radioBox, "mdn", av, ac); + kids[i++] = m_both_toggle = + XmCreateToggleButtonGadget(radioBox, "both", av, ac); + + XtManageChildren(kids,i); + XtManageChild(radioBox); + XtManageChild(form); + XtManageChild(label); + + return frame; +} + +Widget XFE_PrefsPageMailNewsReceipts::createReceiptsArriveFrame(Widget parent, + Widget attachTo) +{ + Widget kids[10]; + Arg av[50]; + int ac; + int i=0; + + XP_ASSERT(parent); + + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; + XtSetArg(av[ac], XmNtopWidget, attachTo); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Widget frame + = XmCreateFrame(parent,"receiptsArriveFrame",av,ac); + + ac=0; + XtSetArg(av[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + Widget label + = XmCreateLabelGadget(frame, "receiptsArriveLabel",av,ac); + + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Widget form + = XmCreateForm(frame,"receiptsArriveForm",av,ac); + + // child Widgets + + ac=0; + Widget radioBox= + XmCreateRadioBox(form, "receiptsArriveRB", av, ac); + + XtVaSetValues(radioBox, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + + + i=0; + ac=0; + kids[i++] = m_inbox_toggle = + XmCreateToggleButtonGadget(radioBox, "inbox", av, ac); + kids[i++] = m_sentmail_toggle = + XmCreateToggleButtonGadget(radioBox, "sentmail", av, ac); + + XtManageChildren(kids,i); + XtManageChild(radioBox); + XtManageChild(form); + XtManageChild(label); + + return frame; +} +Widget XFE_PrefsPageMailNewsReceipts::createReceiveReceiptsFrame(Widget parent, + Widget attachTo) +{ + Widget kids[10]; + Arg av[50]; + int ac; + int i=0; + + XP_ASSERT(parent); + + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; + XtSetArg(av[ac], XmNtopWidget, attachTo); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Widget frame + = XmCreateFrame(parent,"receiveReceiptsFrame",av,ac); + + ac=0; + XtSetArg(av[ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; + Widget label + = XmCreateLabelGadget(frame, "receiveReceiptsLabel",av,ac); + + ac=0; + XtSetArg(av[ac], XmNtopAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNleftAttachment, XmATTACH_FORM); ac++; + XtSetArg(av[ac], XmNrightAttachment, XmATTACH_FORM); ac++; + Widget form + = XmCreateForm(frame,"receiveReceiptsForm",av,ac); + + // child Widgets + + ac=0; + Widget radioBox= + XmCreateRadioBox(form, "receiveReceiptsRB", av, ac); + + XtVaSetValues(radioBox, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_NONE, + XmNbottomAttachment, XmATTACH_NONE, + NULL); + i=0; + ac=0; + kids[i++] = m_never_toggle = + XmCreateToggleButtonGadget(radioBox, "never", av, ac); + kids[i++] = m_some_toggle = + XmCreateToggleButtonGadget(radioBox, "some", av, ac); + + XtManageChildren(kids,i); + XtManageChild(radioBox); + XtManageChild(form); + XtManageChild(label); + + return frame; +} + +// Member: init // Description: // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsAddrBook::insertDirAtPos(int pos, DIR_Server *dir) + +void XFE_PrefsPageMailNewsReceipts::init() { - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - int count = fep->num_directories; - DIR_Server *prev_dir; - - // Insert dir at position - - if (count > 0) { - prev_dir = (DIR_Server*)XP_ListGetObjectNum(fep->directories,pos+1); - XP_ListInsertObjectAfter(fep->directories, prev_dir, dir); - } - else { - XP_ListAddObjectToEnd(fep->directories, dir); - } - fep->num_directories = XP_ListCount(fep->directories); - - // Repaint - - fep->dir_outliner->change(0, fep->num_directories, fep->num_directories); - - // Set selection - - setSelectionPos(pos); + + Bool boolval; + Bool locked; + int32 intval; + + // Request Receipts + + PREF_GetIntPref("mail.request.return_receipt",&intval); + locked = PREF_PrefIsLocked("mail.request.return_receipt"); + + XtVaSetValues(m_dsn_toggle, + XmNset, (intval == RETURN_RECEIPTS_DSN), + XmNsensitive, !locked, + NULL); + XtVaSetValues(m_mdn_toggle, + XmNset, (intval == RETURN_RECEIPTS_MDN), + XmNsensitive, !locked, + NULL); + XtVaSetValues(m_both_toggle, + XmNset, (intval == RETURN_RECEIPTS_BOTH), + XmNsensitive, !locked, + NULL); + + + // Receipts Arrives + PREF_GetIntPref("mail.incorporate.return_receipt",&intval); + locked = PREF_PrefIsLocked("mail.incorporate.return_receipt"); + + XtVaSetValues(m_inbox_toggle, + XmNset, (intval == RECEIPTS_ARRIVE_INBOX), + XmNsensitive, !locked, + NULL); + + XtVaSetValues(m_sentmail_toggle, + XmNset, (intval == RECEIPTS_ARRIVE_SENTMAIL), + XmNsensitive, !locked, + NULL); + + // Receive Receipts + PREF_GetBoolPref("mail.request.return_receipt_on",&boolval); + locked = PREF_PrefIsLocked("mail.request.return_receipt_on"); + + XtVaSetValues(m_never_toggle, + XmNset, boolval, + XmNsensitive, !locked, + NULL); + + XtVaSetValues(m_some_toggle, + XmNset, !boolval, + XmNsensitive, !locked, + NULL); + + setInitialized(TRUE); } - -// Member: deleteDirAtPos + +// Member: install // Description: // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsAddrBook::deleteDirAtPos(int pos) + +void XFE_PrefsPageMailNewsReceipts::install() { - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - int count = fep->num_directories; - - if (pos >= count) return; - - // Remove the directory at pos - - if (pos >= fep->num_directories) return; - DIR_Server *dir = (DIR_Server*)XP_ListGetObjectNum(fep->directories,pos+1); - - DIR_Server *copy; - DIR_CopyServer(dir, ©); - XP_ListAddObjectToEnd(fep->deleted_directories, copy); - - if (! XP_ListRemoveObject(fep->directories, dir)) return; - fep->num_directories = XP_ListCount(fep->directories); - - // Repaint - - fep->dir_outliner->change(0, fep->num_directories, fep->num_directories); - - // Set selection if there is more than one entry - - if (fep->num_directories > 0) { - if (pos >= fep->num_directories) pos--; - setSelectionPos(pos); - } - else { - setSelectionPos(OUTLINER_INIT_POS); - } } - -// Member: swapDirs + + +// Member: save // Description: // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsAddrBook::swapDirs(int pos1, int pos2, int sel_pos) + +void XFE_PrefsPageMailNewsReceipts::save() { - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - int count = fep->num_directories; - DIR_Server *dir1; - DIR_Server *dir2; - XP_List *ptr1; - XP_List *ptr2; - - if ((pos1 >= count) || - (pos2 >= count) || - (sel_pos >= count)) - return; - - // Swap - - dir1 = (DIR_Server*)XP_ListGetObjectNum(fep->directories,pos1+1); - ptr1 = XP_ListFindObject(fep->directories, dir1); - - dir2 = (DIR_Server*)XP_ListGetObjectNum(fep->directories,pos2+1); - ptr2 = XP_ListFindObject(fep->directories, dir2); - - ptr1->object = (void *)dir2; - ptr2->object = (void *)dir1; - - // Repaint - - fep->dir_outliner->change(0, fep->num_directories, fep->num_directories); - - // Set selection if there is more than one entry - - setSelectionPos(sel_pos); + Bool boolval; + + boolval = XmToggleButtonGadgetGetState(m_dsn_toggle); + if (boolval) PREF_SetIntPref("mail.request.return_receipt", RETURN_RECEIPTS_DSN); + + boolval = XmToggleButtonGadgetGetState(m_mdn_toggle); + if (boolval) PREF_SetIntPref("mail.request.return_receipt", RETURN_RECEIPTS_MDN); + + boolval = XmToggleButtonGadgetGetState(m_both_toggle); + if (boolval) PREF_SetIntPref("mail.request.return_receipt", RETURN_RECEIPTS_BOTH); + + boolval = XmToggleButtonGadgetGetState(m_inbox_toggle); + if (boolval) PREF_SetIntPref("mail.incorporate.return_receipt", RECEIPTS_ARRIVE_INBOX); + + boolval = XmToggleButtonGadgetGetState(m_sentmail_toggle); + if (boolval) PREF_SetIntPref("mail.incorporate.return_receipt", RECEIPTS_ARRIVE_SENTMAIL); + + boolval = XmToggleButtonGadgetGetState(m_never_toggle); + PREF_SetBoolPref("mail.request.return_receipt_on",boolval); + + install(); + + } - -// Member: setSelelctionPos + +// Member: verify // Description: // Inputs: // Side effects: - -void XFE_PrefsPageMailNewsAddrBook::setSelectionPos(int pos) + +Boolean XFE_PrefsPageMailNewsReceipts::verify() { - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - int count = fep->num_directories; - - if (pos >= count) return; - - if (pos == OUTLINER_INIT_POS) { - XtVaSetValues(fep->delete_button, XmNsensitive, False, NULL); - XtVaSetValues(fep->up_button, XmNsensitive, False, NULL); - XtVaSetValues(fep->down_button, XmNsensitive, False, NULL); - XtVaSetValues(fep->edit_button, XmNsensitive, False, NULL); - } - else { - // Grey out the Delete/Edit button if it is Personal Address Book - DIR_Server *dir = (DIR_Server*)XP_ListGetObjectNum(fep->directories,pos+1); - fep->dir_outliner->selectItemExclusive(pos); - XtVaSetValues(fep->delete_button, XmNsensitive, - (count != 0 && dir->dirType != PABDirectory), NULL); - XtVaSetValues(fep->edit_button, XmNsensitive, - (count != 0 && dir->dirType != PABDirectory), NULL); - XtVaSetValues(fep->up_button, XmNsensitive, (pos != 0), NULL); - XtVaSetValues(fep->down_button, XmNsensitive, (pos != (count-1)), NULL); - } + return TRUE; } -// Member: deselelctionPos -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsAddrBook::deselectPos(int pos) -{ - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - int count = fep->num_directories; - - if (pos >= count) return; - - fep->dir_outliner->deselectItem(pos); -} - -// Member: getData -// Description: -// Inputs: -// Side effects: - -PrefsDataMailNewsAddrBook *XFE_PrefsPageMailNewsAddrBook::getData() -{ - return m_prefsDataMailNewsAddrBook; -} - -// Member: cb_promote -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsAddrBook::cb_promote(Widget /* w */, - XtPointer closure, - XtPointer /* callData */) -{ - XFE_PrefsPageMailNewsAddrBook *thePage = (XFE_PrefsPageMailNewsAddrBook *)closure; - PrefsDataMailNewsAddrBook *fep = thePage->getData(); - int count = fep->num_directories; - int pos = 0; - uint32 sel_count = 0; - const int *indices = 0; - - if (count == 0) return; - - fep->dir_outliner->getSelection(&indices, (int *) &sel_count); - if (sel_count > 0 && indices) { - pos = indices[0]; - if (pos != 0) { - thePage->deselectPos(pos); - thePage->swapDirs(pos, pos-1, pos-1); - } - } -} - -// Member: cb_demote -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsAddrBook::cb_demote(Widget /* w */, - XtPointer closure, - XtPointer /* callData */) -{ - XFE_PrefsPageMailNewsAddrBook *thePage = (XFE_PrefsPageMailNewsAddrBook *)closure; - PrefsDataMailNewsAddrBook *fep = thePage->getData(); - int count = fep->num_directories; - int pos = 0; - uint32 sel_count = 0; - const int *indices = 0; - - if (count == 0) return; - - fep->dir_outliner->getSelection(&indices, (int *) &sel_count); - if (sel_count > 0 && indices) { - pos = indices[0]; - if (pos != (count-1)) { - thePage->deselectPos(pos); - thePage->swapDirs(pos, pos+1, pos+1); - } - } -} - -// Member: cb_add -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsAddrBook::cb_add(Widget /* w */, - XtPointer closure, - XtPointer /* callData */) -{ - XFE_PrefsPageMailNewsAddrBook *thePage = (XFE_PrefsPageMailNewsAddrBook *)closure; - XFE_PrefsDialog *theDialog = thePage->getPrefsDialog(); - Widget mainw = theDialog->getBaseWidget(); - - // while (!XtIsWMShell(mainw) && (XtParent(mainw)!=0)) - // mainw = XtParent(mainw); - - // Instantiate an LDAP dialog - - XFE_PrefsLdapPropDialog *theLdapPropDialog = 0; - - if ((theLdapPropDialog = - new XFE_PrefsLdapPropDialog(theDialog, thePage, mainw, "prefsLdapProp")) == 0) { - fe_perror(thePage->getContext(), XP_GetString(XFE_OUT_OF_MEMORY_URL)); - return; - } - - // Initialize and pop up the LDAP dialog - - theLdapPropDialog->initPage(0); - theLdapPropDialog->show(); -} - -// Member: cb_edit -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsAddrBook::cb_edit(Widget /* w */, - XtPointer closure, - XtPointer /* callData */) -{ - XFE_PrefsPageMailNewsAddrBook *thePage = (XFE_PrefsPageMailNewsAddrBook *)closure; - XFE_PrefsDialog *theDialog = thePage->getPrefsDialog(); - PrefsDataMailNewsAddrBook *fep = thePage->getData(); - Widget mainw = theDialog->getBaseWidget(); - int pos = 0; - uint32 sel_count = 0; - const int *indices = 0; - DIR_Server *server; - - // Find the entry that's selected - - fep->dir_outliner->getSelection(&indices, (int *) &sel_count); - if (sel_count > 0 && indices) { - pos = indices[0]; - if (pos >= fep->num_directories) return; - server = (DIR_Server*)XP_ListGetObjectNum(fep->directories,pos+1); - } - else - return; - - // while (!XtIsWMShell(mainw) && (XtParent(mainw)!=0)) - // mainw = XtParent(mainw); - - // Instantiate an LDAP dialog - - XFE_PrefsLdapPropDialog *theLdapPropDialog = 0; - - if ((theLdapPropDialog = - new XFE_PrefsLdapPropDialog(theDialog, thePage, mainw, "prefsLdapProp")) == 0) { - fe_perror(thePage->getContext(), XP_GetString(XFE_OUT_OF_MEMORY_URL)); - return; - } - - // Initialize and pop up the LDAP dialog - - theLdapPropDialog->initPage(server); - theLdapPropDialog->show(); -} - -// Member: cb_delete -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsAddrBook::cb_delete(Widget /* w */, - XtPointer closure, - XtPointer /* callData */) -{ - XFE_PrefsPageMailNewsAddrBook *thePage = (XFE_PrefsPageMailNewsAddrBook *)closure; - PrefsDataMailNewsAddrBook *fep = thePage->getData(); - int count = fep->num_directories; - int pos = 0; - uint32 sel_count = 0; - const int *indices = 0; - - if (count == 0) return; - - fep->dir_outliner->getSelection(&indices, (int *) &sel_count); - if (sel_count > 0 && indices) { - pos = indices[0]; - thePage->deleteDirAtPos(pos); - } -} - -// Member: cb_toggleNameOrder -// Description: -// Inputs: -// Side effects: - -void XFE_PrefsPageMailNewsAddrBook::cb_toggleNameOrder(Widget w, - XtPointer closure, - XtPointer callData) -{ - XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)callData; - PrefsDataMailNewsAddrBook *fep = (PrefsDataMailNewsAddrBook *)closure; - - if (! cb->set) { - XtVaSetValues(w, XmNset, True, 0); - } - else if (w == fep->first_last_toggle) { - XtVaSetValues(fep->last_first_toggle, XmNset, False, 0); - } - else if (w == fep->last_first_toggle) { - XtVaSetValues(fep->first_last_toggle, XmNset, False, 0); - } - else - abort(); -} - -/* Outlinable interface methods */ - -void *XFE_PrefsPageMailNewsAddrBook::ConvFromIndex(int /* index */) -{ - return (void *)NULL; -} - -int XFE_PrefsPageMailNewsAddrBook::ConvToIndex(void * /* item */) -{ - return 0; -} - -char*XFE_PrefsPageMailNewsAddrBook::getColumnName(int column) -{ - switch (column){ - case OUTLINER_COLUMN_NAME: - return STRING_COL_NAME; - default: - XP_ASSERT(0); - return 0; - } -} - -char *XFE_PrefsPageMailNewsAddrBook::getColumnHeaderText(int column) -{ - switch (column) - { - case OUTLINER_COLUMN_NAME: - return ""; - default: - XP_ASSERT(0); - return 0; - } -} - -fe_icon *XFE_PrefsPageMailNewsAddrBook::getColumnHeaderIcon(int /* column */) -{ - return 0; - -} - -EOutlinerTextStyle XFE_PrefsPageMailNewsAddrBook::getColumnHeaderStyle(int /* column */) -{ - return OUTLINER_Default; -} - -// This method acquires one line of data. -void *XFE_PrefsPageMailNewsAddrBook::acquireLineData(int line) -{ - m_rowIndex = line; - return (void *)1; -} - -void XFE_PrefsPageMailNewsAddrBook::getTreeInfo(Boolean * /* expandable */, - Boolean * /* is_expanded */, - int * /* depth */, - OutlinerAncestorInfo ** /* ancestor */) -{ - // No-op -} - - -EOutlinerTextStyle XFE_PrefsPageMailNewsAddrBook::getColumnStyle(int /*column*/) -{ - return OUTLINER_Default; -} - -char *XFE_PrefsPageMailNewsAddrBook::getColumnText(int column) -{ - PrefsDataMailNewsAddrBook *fep = m_prefsDataMailNewsAddrBook; - static char line[OUTLINER_COLUMN_MAX_LENGTH+1]; - - *line = 0; - DIR_Server *dir = (DIR_Server*)XP_ListGetObjectNum(fep->directories,m_rowIndex+1); - if (! dir) return line; - - switch (column) { - case OUTLINER_COLUMN_NAME: - sprintf(line, "%s", dir->description); - break; - - default: - break; - } - - return line; -} - -fe_icon *XFE_PrefsPageMailNewsAddrBook::getColumnIcon(int /* column */) -{ - return 0; -} - -void XFE_PrefsPageMailNewsAddrBook::releaseLineData() -{ - // No-op -} - -void XFE_PrefsPageMailNewsAddrBook::Buttonfunc(const OutlineButtonFuncData *data) -{ - int row = data->row; - - if (row < 0) { - // header - return; - } - - setSelectionPos(data->row); -} - -void XFE_PrefsPageMailNewsAddrBook::Flippyfunc(const OutlineFlippyFuncData * /* data */) -{ - // No-op -} - -XFE_Outliner *XFE_PrefsPageMailNewsAddrBook::getOutliner() -{ - return m_prefsDataMailNewsAddrBook->dir_outliner; -} #endif // MOZ_MAIL_NEWS // ************************************************************************ diff --git a/mozilla/cmd/xfe/src/PropertySheetView.cpp b/mozilla/cmd/xfe/src/PropertySheetView.cpp index bdec82ed068..baa08c4abeb 100644 --- a/mozilla/cmd/xfe/src/PropertySheetView.cpp +++ b/mozilla/cmd/xfe/src/PropertySheetView.cpp @@ -106,10 +106,10 @@ XFE_PropertyTabView* XFE_PropertySheetView::addTab(int tabNameId) return tab; }/* XFE_PropertySheetView::addTab */ -void XFE_PropertySheetView::addTab(XFE_PropertyTabView* tab) +void XFE_PropertySheetView::addTab(XFE_PropertyTabView* tab, XP_Bool show) { addView(tab); - tab->show(); + if (show) tab->show(); }/* XFE_PropertySheetView::addTab */ void XFE_PropertySheetView::setDlgValues() diff --git a/mozilla/cmd/xfe/src/PropertySheetView.h b/mozilla/cmd/xfe/src/PropertySheetView.h index 40ae7ed55fd..36bbf5c46e0 100644 --- a/mozilla/cmd/xfe/src/PropertySheetView.h +++ b/mozilla/cmd/xfe/src/PropertySheetView.h @@ -41,7 +41,7 @@ public: // XFE_PropertyTabView* addTab(int tabNameId); - void addTab(XFE_PropertyTabView* tab); + void addTab(XFE_PropertyTabView* tab, XP_Bool show=TRUE); virtual void setDlgValues(); virtual void getDlgValues(); diff --git a/mozilla/cmd/xfe/src/PropertyTabView.cpp b/mozilla/cmd/xfe/src/PropertyTabView.cpp index 326a24ba76e..8f75de32c9a 100644 --- a/mozilla/cmd/xfe/src/PropertyTabView.cpp +++ b/mozilla/cmd/xfe/src/PropertyTabView.cpp @@ -31,6 +31,10 @@ XFE_PropertyTabView::XFE_PropertyTabView(XFE_Component *top, XFE_View *view, /* the parent view */ int tab_string_id): XFE_View(top, view) { + Widget folder; + WidgetList tabs; + int ntabs; + m_labelWidth = 0; /* Create tab @@ -38,12 +42,37 @@ XFE_PropertyTabView::XFE_PropertyTabView(XFE_Component *top, XmString xmstr; xmstr = XmStringCreate(XP_GetString(tab_string_id ), XmFONTLIST_DEFAULT_TAG); + + // Get the folder + folder = view->getBaseWidget(); + Widget form = XmLFolderAddTabForm(view->getBaseWidget(), xmstr); XmStringFree(xmstr); + // Get the tab list + XtVaGetValues(folder, XmNtabCount, &ntabs, NULL); + XtVaGetValues(folder, XmNtabWidgetList, &tabs, NULL); + + // Save the tab + m_tab = tabs[ntabs - 1]; + setBaseWidget(form); } XFE_PropertyTabView::~XFE_PropertyTabView() { } + +void +XFE_PropertyTabView::hide() +{ + XtUnmanageChild(getBaseWidget()); + XtUnmanageChild(m_tab); +} + +void +XFE_PropertyTabView::show() +{ + XtManageChild(m_tab); + XtManageChild(getBaseWidget()); +} diff --git a/mozilla/cmd/xfe/src/PropertyTabView.h b/mozilla/cmd/xfe/src/PropertyTabView.h index 26e690a4702..73fe5bcf1c2 100644 --- a/mozilla/cmd/xfe/src/PropertyTabView.h +++ b/mozilla/cmd/xfe/src/PropertyTabView.h @@ -40,6 +40,8 @@ public: virtual void setDlgValues() {}; virtual void getDlgValues() {}; virtual void apply(){}; + virtual void hide(); + virtual void show(); protected: Dimension m_labelWidth; @@ -47,6 +49,7 @@ protected: private: /* m_widget is the tab form */ + Widget m_tab; }; /* XFE_PropertyTabView */ /* Offsets between widgets when hardwired is needed diff --git a/mozilla/cmd/xfe/src/SubAllView.cpp b/mozilla/cmd/xfe/src/SubAllView.cpp index c2dddc824ae..19eb0336ef7 100644 --- a/mozilla/cmd/xfe/src/SubAllView.cpp +++ b/mozilla/cmd/xfe/src/SubAllView.cpp @@ -82,179 +82,188 @@ XFE_SubAllView::XFE_SubAllView(XFE_Component *toplevel_component, m_outliner->setMultiSelectAllowed( True ); m_outliner->setColumnWidth(OUTLINER_COLUMN_SUBSCRIBE, subscribedIcon.width + 2 /* for the outliner's shadow */); m_outliner->setColumnResizable(OUTLINER_COLUMN_SUBSCRIBE, False); - - m_newsgroupForm = XtCreateManagedWidget("newsgroupForm", - xmFormWidgetClass, - m_form, - NULL, 0); - - m_newsgroupLabel = XtVaCreateManagedWidget("newsgroupLabel", - xmLabelWidgetClass, - m_newsgroupForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - NULL); - - m_newsgroupText = fe_CreateTextField(m_newsgroupForm, - "newsgroupText", - NULL, 0); - XtVaSetValues(m_newsgroupText, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, m_newsgroupLabel, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - XtManageChild(m_newsgroupText); - m_buttonForm = XtCreateManagedWidget("buttonForm", - xmFormWidgetClass, + // create other gadgets + + Widget actionForm = XmCreateRowColumn(m_form, "actionForm", NULL, 0); + m_addserverButton = + XmCreatePushButtonGadget(actionForm,xfeCmdAddNewsServer, NULL,0); + XtManageChild(m_addserverButton); + + // this holds the data at the top of the form - + // server, newsgroup + Widget dataForm = XmCreateForm(m_form, "dataForm", NULL, 0); + + Widget serverLabel, newsgroupLabel; + + int i=0; + Widget dataWidgets[6]; + // Server & dropdown + dataWidgets[i++] = serverLabel = + XmCreateLabelGadget(dataForm, "serverLabel", NULL, 0); + initializeServerCombo(dataForm); + dataWidgets[i++] = m_serverCombo; + + int server_height = XfeVaGetTallestWidget(serverLabel, + m_serverCombo, + m_addserverButton, + NULL); + + XtVaSetValues(serverLabel, + XmNheight, server_height, + XmNalignment, XmALIGNMENT_END, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + NULL); + XtVaSetValues(m_serverCombo, + XmNheight, server_height, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, serverLabel, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, serverLabel, + XmNrightAttachment, XmATTACH_FORM, + NULL); + XtVaSetValues(m_addserverButton, + XmNheight, server_height, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, serverLabel, + XmNrightAttachment, XmATTACH_FORM, + NULL); + + + // newsgroup, text field, and button + dataWidgets[i++] = newsgroupLabel = + XmCreateLabelGadget(dataForm, "newsgroupLabel", NULL, 0); + dataWidgets[i++] = m_newsgroupText = + fe_CreateTextField(dataForm, "newsgroupText",NULL, 0); + + + int newsgroup_height = XfeVaGetTallestWidget(newsgroupLabel, + m_newsgroupText, + NULL); + + XtVaSetValues(newsgroupLabel, + XmNheight, newsgroup_height, + XmNalignment, XmALIGNMENT_END, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, serverLabel, + XmNleftAttachment, XmATTACH_FORM, + NULL); + + XtVaSetValues(m_newsgroupText, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, newsgroupLabel, + XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNleftWidget, m_serverCombo, + XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNrightWidget, m_serverCombo, + NULL); + + int label_width = XfeVaGetWidestWidget(serverLabel, + newsgroupLabel, + NULL); + XtVaSetValues(serverLabel, XmNwidth, label_width, NULL); + XtVaSetValues(newsgroupLabel, XmNwidth, label_width, NULL); + XtManageChildren(dataWidgets,i); + + i=0; + Widget buttons[6]; + // buttons + Widget buttonForm = XtCreateManagedWidget("buttonForm", + xmRowColumnWidgetClass, m_form, NULL, 0); + buttons[i++] = m_subscribeButton = XtVaCreateManagedWidget(xfeCmdToggleSubscribe, xmPushButtonWidgetClass, - m_buttonForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, + buttonForm, NULL); - m_sep1 = XtVaCreateManagedWidget("sep1", - xmSeparatorWidgetClass, - m_buttonForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_subscribeButton, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - m_expandallButton = XtVaCreateManagedWidget(xfeCmdExpandAll, - xmPushButtonWidgetClass, - m_buttonForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_sep1, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - m_collapseallButton = XtVaCreateManagedWidget(xfeCmdCollapseAll, - xmPushButtonWidgetClass, - m_buttonForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_expandallButton, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - m_sep2 = XtVaCreateManagedWidget("sep2", - xmSeparatorWidgetClass, - m_buttonForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_collapseallButton, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - + buttons[i++] = + m_unsubscribeButton = XtVaCreateManagedWidget(xfeCmdUnsubscribe, + xmPushButtonWidgetClass, + buttonForm, + NULL); + + buttons[i++] = XmCreateSeparatorGadget(buttonForm, "sep1", NULL, 0); + + buttons[i++] = m_getdeletionsButton = XtVaCreateManagedWidget(xfeCmdFetchGroupList, xmPushButtonWidgetClass, - m_buttonForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_sep2, - XmNbottomAttachment, XmATTACH_NONE, + buttonForm, NULL); - + buttons[i++] = + m_expandallButton = XtVaCreateManagedWidget(xfeCmdExpandAll, + xmPushButtonWidgetClass, + buttonForm, + NULL); + buttons[i++] = + m_collapseallButton = XtVaCreateManagedWidget(xfeCmdCollapseAll, + xmPushButtonWidgetClass, + buttonForm, + NULL); + + buttons [i++] = XmCreateSeparatorGadget(buttonForm, "sep2", NULL, 0); + + buttons[i++] = m_stopButton = XtVaCreateManagedWidget(xfeCmdStopLoading, xmPushButtonWidgetClass, - m_buttonForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_getdeletionsButton, - XmNbottomAttachment, XmATTACH_NONE, + buttonForm, NULL); - m_addserverButton = XtVaCreateManagedWidget(xfeCmdAddNewsServer, - xmPushButtonWidgetClass, - m_buttonForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_FORM, - NULL); + XtManageChildren(buttons,i); - m_serverForm = XtCreateManagedWidget("serverForm", - xmFormWidgetClass, - m_form, - NULL, 0); + // now arrange the forms + int button_width = XfeVaGetWidestWidget(actionForm, dataForm, NULL); - m_serverLabel = XtVaCreateManagedWidget("serverLabel", - xmLabelWidgetClass, - m_serverForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - - initializeServerCombo(m_serverForm); - XtVaSetValues(m_serverCombo, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, m_serverLabel, + XtVaSetValues(actionForm, + XmNwidth, button_width, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + NULL); + + XtVaSetValues(buttonForm, + XmNwidth, button_width, XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, dataForm, XmNbottomAttachment, XmATTACH_FORM, NULL); - - XtVaSetValues(m_buttonForm, - XmNleftAttachment, XmATTACH_NONE, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - - XtVaSetValues(m_newsgroupForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, m_buttonForm, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(m_serverForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, m_buttonForm, - XmNtopAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - + + XtVaSetValues(dataForm, + XmNwidth, button_width, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_WIDGET, + XmNrightWidget, actionForm, + NULL); + + XtVaSetValues(m_outliner->getBaseWidget(), XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, m_buttonForm, XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_newsgroupForm, - XmNbottomAttachment, XmATTACH_WIDGET, - XmNbottomWidget, m_serverForm, + XmNtopWidget, dataForm, + XmNrightAttachment, XmATTACH_WIDGET, + XmNrightWidget, buttonForm, + XmNbottomAttachment, XmATTACH_FORM, NULL); + + XtAddCallback(m_newsgroupText, XmNvalueChangedCallback, newsgroup_typedown_callback, this); + XtAddCallback(m_newsgroupText, XmNactivateCallback, newsgroup_selected_callback, this); + XtAddCallback(m_subscribeButton, XmNactivateCallback, XFE_SubTabView::button_callback, this); + XtAddCallback(m_unsubscribeButton, XmNactivateCallback, XFE_SubTabView::button_callback, this); XtAddCallback(m_expandallButton, XmNactivateCallback, XFE_SubTabView::button_callback, this); XtAddCallback(m_collapseallButton, XmNactivateCallback, XFE_SubTabView::button_callback, this); XtAddCallback(m_getdeletionsButton, XmNactivateCallback, XFE_SubTabView::button_callback, this); XtAddCallback(m_stopButton, XmNactivateCallback, XFE_SubTabView::button_callback, this); XtAddCallback(m_addserverButton, XmNactivateCallback, XFE_SubTabView::button_callback, this); + XtManageChild(actionForm); + XtManageChild(buttonForm); + XtManageChild(dataForm); m_outliner->show(); // setBaseWidget is done in SubTabView. @@ -309,6 +318,9 @@ XFE_SubAllView::doCommand(CommandType command, void *calldata, XFE_CommandInfo*) { XFE_NewsServerDialog *d = new XFE_NewsServerDialog(getToplevel()->getBaseWidget(), "addServer", + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData)); XP_Bool ok_pressed = d->post(); @@ -372,6 +384,20 @@ XFE_SubAllView::newsgroup_typedown() } } +void +XFE_SubAllView::newsgroup_selected() +{ + const int *selected; + int count; + + // Get the selection + m_outliner->getSelection(&selected, &count); + + // Subscribe to the newsgroup + MSG_Command(m_pane, MSG_ToggleSubscribed, (MSG_ViewIndex*)selected, + count); +} + void XFE_SubAllView::newsgroup_typedown_callback(Widget /*w*/, XtPointer clientData, @@ -382,29 +408,14 @@ XFE_SubAllView::newsgroup_typedown_callback(Widget /*w*/, obj->newsgroup_typedown(); } -int -XFE_SubAllView::getButtonsMaxWidth() -{ - return XfeVaGetWidestWidget(m_subscribeButton, - m_expandallButton, - m_collapseallButton, - m_getdeletionsButton, - m_stopButton, - m_addserverButton, - NULL); -} - void -XFE_SubAllView::setButtonsWidth(int width) +XFE_SubAllView::newsgroup_selected_callback(Widget /*w*/, + XtPointer clientData, + XtPointer /*callData*/) { - Arg args[1]; + XFE_SubAllView *obj = (XFE_SubAllView*)clientData; - XtSetArg(args[0], XmNwidth, width); - - XtSetValues(m_subscribeButton, args, 1); - XtSetValues(m_expandallButton, args, 1); - XtSetValues(m_collapseallButton, args, 1); - XtSetValues(m_getdeletionsButton, args, 1); - XtSetValues(m_stopButton, args, 1); - XtSetValues(m_addserverButton, args, 1); + obj->newsgroup_selected(); } + + diff --git a/mozilla/cmd/xfe/src/SubAllView.h b/mozilla/cmd/xfe/src/SubAllView.h index 9d2caa0721d..7766d0d097b 100644 --- a/mozilla/cmd/xfe/src/SubAllView.h +++ b/mozilla/cmd/xfe/src/SubAllView.h @@ -45,22 +45,18 @@ public: void defaultFocus(); - virtual int getButtonsMaxWidth(); - virtual void setButtonsWidth(int width); - private: - Widget m_newsgroupForm; - Widget m_newsgroupLabel, m_newsgroupText; - Widget m_subscribeButton, m_expandallButton, + Widget m_newsgroupText; + Widget m_subscribeButton, m_unsubscribeButton, m_expandallButton, m_collapseallButton, m_getdeletionsButton, m_stopButton, m_addserverButton; - Widget m_serverForm; - Widget m_serverLabel; - Widget m_sep1, m_sep2; - Widget m_buttonForm; void newsgroup_typedown(); + void newsgroup_selected(); + static void newsgroup_typedown_callback(Widget, XtPointer, XtPointer); + static void newsgroup_selected_callback(Widget, XtPointer, XtPointer); + }; diff --git a/mozilla/cmd/xfe/src/SubSearchView.cpp b/mozilla/cmd/xfe/src/SubSearchView.cpp index 212854bd5af..2c00334daf5 100644 --- a/mozilla/cmd/xfe/src/SubSearchView.cpp +++ b/mozilla/cmd/xfe/src/SubSearchView.cpp @@ -77,165 +77,148 @@ XFE_SubSearchView::XFE_SubSearchView(XFE_Component *toplevel_component, m_outliner->setColumnWidth(OUTLINER_COLUMN_SUBSCRIBE, subscribedIcon.width + 2 /* for the outliner's shadow */); m_outliner->setColumnResizable(OUTLINER_COLUMN_SUBSCRIBE, False); - m_topForm = XtCreateManagedWidget("topForm", - xmFormWidgetClass, - m_form, - NULL, 0); + Widget dataForm = XmCreateForm(m_form, "dataForm", NULL, 0); + + Widget serverLabel, searchLabel; + + int i=0; + Widget dataWidgets[6]; - m_searchForm = XtCreateManagedWidget("searchForm", - xmFormWidgetClass, - m_topForm, - NULL, 0); - - m_searchLabel = XtCreateManagedWidget("searchLabel", + dataWidgets[i++] = serverLabel = + XmCreateLabelGadget(dataForm, "serverLabel", NULL, 0); + initializeServerCombo(dataForm); + dataWidgets[i++] = m_serverCombo; + + int server_height = XfeVaGetTallestWidget(serverLabel, + m_serverCombo, + NULL); + XtVaSetValues(serverLabel, + XmNheight, server_height, + XmNalignment, XmALIGNMENT_END, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + NULL); + XtVaSetValues(m_serverCombo, + XmNheight, server_height, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, serverLabel, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, serverLabel, + XmNrightAttachment, XmATTACH_FORM, + NULL); + + dataWidgets[i++] = + searchLabel = XtCreateManagedWidget("searchLabel", xmLabelWidgetClass, - m_searchForm, + dataForm, NULL, 0); - m_searchText = fe_CreateTextField(m_searchForm, "searchText", NULL, 0); - XtManageChild(m_searchText); + dataWidgets[i++] = + m_searchText = fe_CreateTextField(dataForm, "searchText", NULL, 0); - m_onserverForm = XtCreateManagedWidget("onserverForm", - xmFormWidgetClass, - m_topForm, - NULL, 0); + int search_height = XfeVaGetTallestWidget(searchLabel, + m_searchText, + NULL); + XtVaSetValues(searchLabel, + XmNheight, search_height, + XmNalignment, XmALIGNMENT_END, + XmNtopAttachment, XmATTACH_WIDGET, + XmNtopWidget, serverLabel, + XmNleftAttachment, XmATTACH_FORM, + NULL); + + XtVaSetValues(m_searchText, + XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNtopWidget, searchLabel, + XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNleftWidget, m_serverCombo, + XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET, + XmNrightWidget, m_serverCombo, + NULL); - m_onserverLabel = XtCreateManagedWidget("onserverLabel", - xmLabelWidgetClass, - m_onserverForm, - NULL, 0); + int label_width = XfeVaGetWidestWidget(serverLabel, + searchLabel, + NULL); + XtVaSetValues(serverLabel, XmNwidth, label_width, NULL); + XtVaSetValues(searchLabel, XmNwidth, label_width, NULL); + XtManageChildren(dataWidgets, i); - initializeServerCombo(m_onserverForm); + // upper-right - search button + + Widget actionForm = XmCreateRowColumn(m_form, "actionForm", NULL, 0); + m_searchnowButton = + XmCreatePushButtonGadget(actionForm, xfeCmdSearch, NULL, 0); + XtManageChild(m_searchnowButton); - m_buttonForm = XtCreateManagedWidget("buttonForm", - xmFormWidgetClass, + // lower-right - other buttons + i=0; + Widget buttons[6]; + Widget buttonForm = XtCreateManagedWidget("buttonForm", + xmRowColumnWidgetClass, m_form, NULL, 0); - m_searchnowButton = XtCreateManagedWidget(xfeCmdSearch, - xmPushButtonWidgetClass, - m_buttonForm, - NULL, 0); - + buttons[i++] = m_subscribeButton = XtCreateManagedWidget(xfeCmdToggleSubscribe, xmPushButtonWidgetClass, - m_buttonForm, + buttonForm, NULL, 0); + buttons[i++] = + m_unsubscribeButton = XtCreateManagedWidget(xfeCmdUnsubscribe, + xmPushButtonWidgetClass, + buttonForm, + NULL, 0); - m_sep1 = XtVaCreateManagedWidget("sep1", - xmSeparatorWidgetClass, - m_buttonForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_subscribeButton, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - + buttons[i++] = XmCreateSeparatorGadget(buttonForm, "sep1", NULL, 0); + buttons[i++] = m_stopButton = XtVaCreateManagedWidget(xfeCmdStopLoading, xmPushButtonWidgetClass, - m_buttonForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_sep1, - XmNbottomAttachment, XmATTACH_NONE, + buttonForm, NULL); - /* search text stuff. */ - XtVaSetValues(m_searchLabel, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); + XtManageChildren(buttons, i); - XtVaSetValues(m_searchText, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, m_searchLabel, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - NULL); - /* server selection stuff. */ - XtVaSetValues(m_onserverLabel, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_NONE, - XmNbottomAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - NULL); - - XtVaSetValues(m_serverCombo, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, m_onserverLabel, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - NULL); - - /* button attachments. */ - XtVaSetValues(m_searchnowButton, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(m_subscribeButton, - XmNleftAttachment, XmATTACH_FORM, + // now lay out the main forms + int button_width = XfeVaGetWidestWidget(actionForm, dataForm, NULL); + XtVaSetValues(actionForm, + XmNwidth, button_width, + XmNtopAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, + NULL); + + XtVaSetValues(buttonForm, + XmNwidth, button_width, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_searchnowButton, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - /* attachments for the forms and outliner */ - XtVaSetValues(m_searchForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(m_onserverForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_searchForm, + XmNtopWidget, dataForm, XmNbottomAttachment, XmATTACH_FORM, NULL); + XtVaSetValues(dataForm, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_WIDGET, + XmNrightWidget, actionForm, + NULL); + XtVaSetValues(m_outliner->getBaseWidget(), XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, m_buttonForm, XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, m_topForm, + XmNtopWidget, dataForm, + XmNrightAttachment, XmATTACH_WIDGET, + XmNrightWidget, buttonForm, XmNbottomAttachment, XmATTACH_FORM, NULL); - XtVaSetValues(m_topForm, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightWidget, m_buttonForm, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - - XtVaSetValues(m_buttonForm, - XmNleftAttachment, XmATTACH_NONE, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - NULL); - - - XtAddCallback(m_subscribeButton, XmNactivateCallback, button_callback, this); + XtAddCallback(m_unsubscribeButton, XmNactivateCallback, button_callback, this); XtAddCallback(m_searchnowButton, XmNactivateCallback, button_callback, this); XtAddCallback(m_searchText, XmNactivateCallback, search_activate_callback, this); - m_outliner->show(); + XtManageChild(actionForm); + XtManageChild(buttonForm); + XtManageChild(dataForm); + m_outliner->show(); // setBaseWidget happens in SubTabView. } diff --git a/mozilla/cmd/xfe/src/SubSearchView.h b/mozilla/cmd/xfe/src/SubSearchView.h index 2693a0fa2ab..2dd5075d436 100644 --- a/mozilla/cmd/xfe/src/SubSearchView.h +++ b/mozilla/cmd/xfe/src/SubSearchView.h @@ -51,10 +51,8 @@ public: virtual void setButtonsWidth(int width); private: - Widget m_topForm; - Widget m_searchForm, m_searchLabel, m_searchText; - Widget m_onserverForm, m_onserverLabel; - Widget m_buttonForm, m_searchnowButton, m_subscribeButton, m_sep1, m_stopButton; + Widget m_searchText; + Widget m_searchnowButton, m_subscribeButton, m_unsubscribeButton, m_stopButton; static void search_activate_callback(Widget, XtPointer, XtPointer); }; diff --git a/mozilla/cmd/xfe/src/SubTabView.cpp b/mozilla/cmd/xfe/src/SubTabView.cpp index cbd5c89b6e8..00463a5d795 100644 --- a/mozilla/cmd/xfe/src/SubTabView.cpp +++ b/mozilla/cmd/xfe/src/SubTabView.cpp @@ -145,6 +145,7 @@ Boolean XFE_SubTabView::handlesCommand(CommandType command, void */*calldata*/, XFE_CommandInfo*) { if (command == xfeCmdToggleSubscribe + || command == xfeCmdUnsubscribe || command == xfeCmdStopLoading) { return True; @@ -165,8 +166,12 @@ XFE_SubTabView::doCommand(CommandType command, void */*calldata*/, XFE_CommandIn if (command == xfeCmdToggleSubscribe) { - MSG_Command(m_pane, MSG_ToggleSubscribed, (MSG_ViewIndex*)selected, count); + MSG_Command(m_pane, MSG_SetSubscribed, (MSG_ViewIndex*)selected, count); } + else if (command == xfeCmdUnsubscribe) + { + MSG_Command(m_pane, MSG_ClearSubscribed, (MSG_ViewIndex*)selected, count); + } else if (command == xfeCmdStopLoading) { XP_InterruptContext(m_contextData); @@ -355,18 +360,23 @@ XFE_SubTabView::getColumnText(int column) fe_icon * XFE_SubTabView::getColumnIcon(int column) { + MSG_Host *pHost=NULL; switch (column) { case OUTLINER_COLUMN_NAME: return &newsgroupIcon; case OUTLINER_COLUMN_SUBSCRIBE: - if (!(m_groupLine.flags & MSG_GROUPNAME_FLAG_HASCHILDREN)) - if (m_groupLine.flags & MSG_GROUPNAME_FLAG_SUBSCRIBED) - return &subscribedIcon; - else - return &msgReadIcon; // XXX + pHost = MSG_SubscribeGetHost(m_pane); + + if ( !pHost ) return 0; + + if ((m_groupLine.flags & MSG_GROUPNAME_FLAG_HASCHILDREN) && (MSG_IsNewsHost(pHost)) ) + return 0; + + if (m_groupLine.flags & MSG_GROUPNAME_FLAG_SUBSCRIBED) + return &subscribedIcon; else - return 0; + return &msgReadIcon; // XXX case OUTLINER_COLUMN_POSTINGS: return 0; default: @@ -436,8 +446,14 @@ XFE_SubTabView::Buttonfunc(const OutlineButtonFuncData *data) // handle the columns that don't actually move the selection here if (data->column == OUTLINER_COLUMN_SUBSCRIBE) { - if (!(m_groupLine.flags & MSG_GROUPNAME_FLAG_HASCHILDREN)) - MSG_Command(m_pane, MSG_ToggleSubscribed, (MSG_ViewIndex*)&data->row, 1); + MSG_Host *pHost = MSG_SubscribeGetHost(m_pane); + + // when the host is a news server, we allow the toggle subscribe to go thru + if ( pHost && + ( !(m_groupLine.flags & MSG_GROUPNAME_FLAG_HASCHILDREN) || + !(MSG_IsNewsHost(pHost)) ) + ) + MSG_Command(m_pane, MSG_ToggleSubscribed, (MSG_ViewIndex*)&data->row, 1); } else { diff --git a/mozilla/cmd/xfe/src/SubscribeDialog.cpp b/mozilla/cmd/xfe/src/SubscribeDialog.cpp index e1fcfa62449..9170bebef36 100644 --- a/mozilla/cmd/xfe/src/SubscribeDialog.cpp +++ b/mozilla/cmd/xfe/src/SubscribeDialog.cpp @@ -34,8 +34,18 @@ static Widget create_chrome_widget(Widget parent, char *name, static XFE_SubscribeDialog *theDialog; -XFE_SubscribeDialog::XFE_SubscribeDialog(char *name, XFE_NotificationCenter *toplevel, - Widget parent, MWContext *context, MSG_Host *host) +XFE_SubscribeDialog::XFE_SubscribeDialog(char *name, + XFE_NotificationCenter *toplevel, + Widget parent, MWContext *context, + MSG_Host *host) +#if defined(GLUE_COMPO_CONTEXT) + : XFE_ViewDashBDlg(parent, name, context, + True, /* ok */ + True, /* cancel */ + True, /* help */ + False, /* apply; remove */ + True) +#else : XFE_ViewDialog(NULL, parent, name, context, FALSE, // ok @@ -44,15 +54,19 @@ XFE_SubscribeDialog::XFE_SubscribeDialog(char *name, XFE_NotificationCenter *top FALSE, // apply FALSE, // separator FALSE, // modal - create_chrome_widget(parent, - name, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE)) + create_chrome_widget(parent, name, TRUE, TRUE, FALSE, + FALSE, FALSE, TRUE)) +#endif /* GLUE_COMPO_CONTEXT */ { - XFE_SubscribeView *subscribeview; + m_toplevelNotifier = toplevel; + +#if !defined(GLUE_COMPO_CONTEXT) Widget button_area; - m_okToDestroy = FALSE; - - m_toplevelNotifier = toplevel; + /* Fix bug" 114163: Comment out this line so that when user cancel the dialog, + the dialog will be destroyed properly. Please let me know + if you need it to work other wise - dora */ + /* m_okToDestroy = FALSE; */ m_dashboard = new XFE_Dashboard(this, m_chrome, @@ -62,8 +76,15 @@ XFE_SubscribeDialog::XFE_SubscribeDialog(char *name, XFE_NotificationCenter *top m_dashboard->setShowStatusBar(True); m_dashboard->setShowProgressBar(True); - subscribeview = new XFE_SubscribeView(this, m_chrome, NULL, m_context, host); +#endif /* GLUE_COMPO_CONTEXT */ + m_subscribeview = new XFE_SubscribeView(this, m_chrome, NULL, + m_context, host); +#if defined(GLUE_COMPO_CONTEXT) + m_aboveButtonArea = m_subscribeview->getBaseWidget(); +#endif /* GLUE_COMPO_CONTEXT */ + +#if !defined(GLUE_COMPO_CONTEXT) button_area = createButtonArea(m_chrome, TRUE, TRUE, FALSE, FALSE); XtVaSetValues(m_dashboard->getBaseWidget(), @@ -83,7 +104,7 @@ XFE_SubscribeDialog::XFE_SubscribeDialog(char *name, XFE_NotificationCenter *top XmNmarginHeight, 0, NULL); - XtVaSetValues(subscribeview->getBaseWidget(), + XtVaSetValues(m_subscribeview->getBaseWidget(), XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 3, XmNrightAttachment, XmATTACH_FORM, @@ -96,20 +117,36 @@ XFE_SubscribeDialog::XFE_SubscribeDialog(char *name, XFE_NotificationCenter *top XtManageChild(button_area); m_dashboard->show(); - subscribeview->show(); +#endif /* GLUE_COMPO_CONTEXT */ + m_subscribeview->show(); - setView(subscribeview); + setView(m_subscribeview); + +#if defined(GLUE_COMPO_CONTEXT) + if (m_dashboard && m_subscribeview) + m_dashboard->connect2Dashboard(m_subscribeview); + // + // + attachView(); +#endif /* GLUE_COMPO_CONTEXT */ } XFE_SubscribeDialog::~XFE_SubscribeDialog() { +#if defined(GLUE_COMPO_CONTEXT) + if (m_subscribeview && m_dashboard) + m_dashboard->disconnectFromDashboard(m_subscribeview); +#endif /* GLUE_COMPO_CONTEXT */ + unregisterInterest(XFE_Frame::frameNotBusyCallback, m_toplevelNotifier, (XFE_FunctionNotification)XFE_Frame::updateBusyState_cb, (void*)False); +#if !defined(GLUE_COMPO_CONTEXT) // Resotore the original notifier m_toplevelNotifier->setForwarder(m_oldForwarder); +#endif /* GLUE_COMPO_CONTEXT */ theDialog = NULL; } @@ -119,18 +156,22 @@ XFE_SubscribeDialog::show() { XFE_ViewDialog::show(); +#if !defined(GLUE_COMPO_CONTEXT) + // Save the old notifier m_oldForwarder = m_toplevelNotifier->getForwarder(); // Set up the forwarder m_toplevelNotifier->setForwarder(this); +#endif /* GLUE_COMPO_CONTEXT */ registerInterest(XFE_Frame::frameNotBusyCallback, m_toplevelNotifier, (XFE_FunctionNotification)XFE_Frame::updateBusyState_cb, (void*)False); } +#if !defined(GLUE_COMPO_CONTEXT) Widget XFE_SubscribeDialog::createButtonArea(Widget parent, Boolean ok, Boolean cancel, @@ -225,13 +266,43 @@ create_chrome_widget(Widget parent, return chrome; } +XFE_CALLBACK_DEFN(XFE_SubscribeDialog, allConnectionsComplete) + (XFE_NotificationCenter *, void *, void *) +{ + if (m_subscribeview->isInterrupting()) { + m_subscribeview->doneInterrupting(); + } else { + // We're done commiting the subscribe information + hide(); + + unregisterInterest(XFE_Frame::allConnectionsCompleteCallback, + this, + (XFE_FunctionNotification)allConnectionsComplete_cb); + m_toplevelNotifier->setForwarder(m_oldForwarder); + + // XXX: For some reason, the context is found not busy, though the N + // icon indicates that it's busy. Needs investigation. + // Forcing an interrupt for now. + XP_InterruptContext(m_context); + + // If the context is busy interrupt it + if (XP_IsContextBusy(m_context)) { + XP_InterruptContext(m_context); + } + + } +} +#endif /* GLUE_COMPO_CONTEXT */ + void XFE_SubscribeDialog::ok() { +#if !defined(GLUE_COMPO_CONTEXT) registerInterest(XFE_Frame::allConnectionsCompleteCallback, - this, + this, (XFE_FunctionNotification)allConnectionsComplete_cb); - XFE_ViewDialog::ok(); +#endif /* GLUE_COMPO_CONTEXT */ + XFE_ViewDialog::ok(); } void @@ -245,10 +316,8 @@ fe_showSubscribeDialog(XFE_NotificationCenter *toplevel, if (theDialog) delete theDialog; - theDialog = new XFE_SubscribeDialog("SubscribeDialog", - toplevel, parent, - context, - host); + theDialog = new XFE_SubscribeDialog("SubscribeDialog", toplevel, parent, + context, host); theDialog->show(); } @@ -257,16 +326,14 @@ XP_Bool FE_CreateSubscribePaneOnHost(MSG_Master* /*master*/, MWContext* parentContext, MSG_Host* host) { +#if 1 + XFE_Component* toplevel = ViewGlue_getFrame(parentContext); +#else XFE_Component* toplevel = ViewGlue_getFrame(parentContext)->getToplevel(); +#endif + XP_ASSERT(toplevel); + if (!toplevel) return False; fe_showSubscribeDialog(toplevel, toplevel->getBaseWidget(), parentContext, host); return True; } - -XFE_CALLBACK_DEFN(XFE_SubscribeDialog, allConnectionsComplete)(XFE_NotificationCenter *, - void *, - void *) -{ - hide(); -} - diff --git a/mozilla/cmd/xfe/src/SubscribeDialog.h b/mozilla/cmd/xfe/src/SubscribeDialog.h index 3523dd7da2d..0f2c48b8d0a 100644 --- a/mozilla/cmd/xfe/src/SubscribeDialog.h +++ b/mozilla/cmd/xfe/src/SubscribeDialog.h @@ -25,34 +25,54 @@ #ifndef _xfe_subscribedialog_h #define _xfe_subscribedialog_h +#if defined(GLUE_COMPO_CONTEXT) +#include "ViewDashBDlg.h" +#else #include "ViewDialog.h" +#endif /* GLUE_COMPO_CONTEXT */ + #include "SubscribeView.h" #include "Dashboard.h" +#if defined(GLUE_COMPO_CONTEXT) +class XFE_SubscribeDialog: public XFE_ViewDashBDlg +#else class XFE_SubscribeDialog : public XFE_ViewDialog +#endif /* GLUE_COMPO_CONTEXT */ { public: - XFE_SubscribeDialog(char *name, XFE_NotificationCenter *toplevel, Widget parent, MWContext *context, MSG_Host *host); + XFE_SubscribeDialog(char *name, XFE_NotificationCenter *toplevel, + Widget parent, MWContext *context, MSG_Host *host); virtual ~XFE_SubscribeDialog(); void show(); + +#if !defined(GLUE_COMPO_CONTEXT) XFE_CALLBACK_DECL(allConnectionsComplete) +#endif /* GLUE_COMPO_CONTEXT */ protected: +#if !defined(GLUE_COMPO_CONTEXT) Widget createButtonArea(Widget parent, Boolean ok, Boolean cancel, Boolean help, Boolean apply); +#endif /* GLUE_COMPO_CONTEXT */ virtual void ok(); private: + +#if !defined(GLUE_COMPO_CONTEXT) XFE_Dashboard *m_dashboard; - XFE_NotificationCenter *m_toplevelNotifier; XFE_NotificationCenter *m_oldForwarder; - Widget m_oldThermo; - Widget m_oldLogo; +#endif /* GLUE_COMPO_CONTEXT */ + + XFE_NotificationCenter *m_toplevelNotifier; + XFE_SubscribeView *m_subscribeview; }; -extern "C" void fe_showSubscribeDialog(XFE_NotificationCenter *toplevel, Widget parent, MWContext *context, MSG_Host *host = NULL); +extern "C" void fe_showSubscribeDialog(XFE_NotificationCenter *toplevel, + Widget parent, MWContext *context, + MSG_Host *host = NULL); #endif /* _xfe_subscribedialog_h */ diff --git a/mozilla/cmd/xfe/src/SubscribeView.cpp b/mozilla/cmd/xfe/src/SubscribeView.cpp index 2a75c782a16..5f81d90e465 100644 --- a/mozilla/cmd/xfe/src/SubscribeView.cpp +++ b/mozilla/cmd/xfe/src/SubscribeView.cpp @@ -28,6 +28,7 @@ #include "SubAllView.h" #include "SubSearchView.h" #include "SubNewView.h" +#include "ViewGlue.h" #include "xfe.h" #include "msgcom.h" @@ -50,13 +51,40 @@ XFE_SubscribeView::XFE_SubscribeView(XFE_Component *toplevel_component, int all_buttons_maxwidth, search_buttons_maxwidth, new_buttons_maxwidth; int max_button_width; - if (!p) - { - setPane(MSG_CreateSubscribePaneForHost(m_contextData, - XFE_MNView::m_master, - host)); - XP_ASSERT(m_pane != 0); - } + // Clone the context + m_cloneContext = XP_NewContext(); + if (!m_cloneContext) + return; + +#if defined(GLUE_COMPO_CONTEXT) + fe_ContextData *fec = XP_NEW_ZAP (fe_ContextData); + XP_ASSERT(fec); + CONTEXT_DATA(m_cloneContext) = fec; + m_cloneContext->funcs = fe_BuildDisplayFunctionTable(); + + ViewGlue_addMappingForCompo(this, (void *)m_cloneContext); + CONTEXT_WIDGET(m_cloneContext) = getBaseWidget(); +#else + XFE_Frame *f = ViewGlue_getFrame(context); + XP_ASSERT(f); + fe_ContextData *fec = XP_NEW_ZAP (fe_ContextData); + XP_ASSERT(fec); + CONTEXT_DATA(m_cloneContext) = fec; + ViewGlue_addMapping(f, (void *)m_cloneContext); + m_cloneContext->funcs = fe_BuildDisplayFunctionTable(); + CONTEXT_WIDGET(m_cloneContext) = CONTEXT_WIDGET(context); +#endif + // Set the type of the context + m_cloneContext->type = MWContextNews; + + if (!p) { + setPane(MSG_CreateSubscribePaneForHost(m_cloneContext, + XFE_MNView::m_master, + host)); + XP_ASSERT(m_pane != 0); + } + + m_interrupting = FALSE; getToplevel()->registerInterest(XFE_View::chromeNeedsUpdating, this, @@ -114,6 +142,11 @@ XFE_SubscribeView::XFE_SubscribeView(XFE_Component *toplevel_component, XFE_SubscribeView::~XFE_SubscribeView() { destroyPane(); +#if defined(GLUE_COMPO_CONTEXT) + // unglue; reset context + ViewGlue_addMappingForCompo(NULL, (void *)m_cloneContext); + //CONTEXT_WIDGET(m_cloneContext) = getBaseWidget(); +#endif #if notyet /* This line is needed to fix bug #77615. The problem is that if it's present, @@ -162,26 +195,31 @@ XFE_SubscribeView::handlesCommand(CommandType command, void *calldata, XFE_Comma } void -XFE_SubscribeView::doCommand(CommandType command, void *calldata, XFE_CommandInfo*) +XFE_SubscribeView::doCommand(CommandType command, void *calldata, + XFE_CommandInfo*) { - if (command == xfeCmdDialogCancel) - { - MSG_SubscribeCancel(m_pane); - } - else if (command == xfeCmdStopLoading) - { - MWContext *c = MSG_GetContext(m_pane); + if (command == xfeCmdDialogCancel) { + MSG_SubscribeCancel(m_pane); + } else if (command == xfeCmdStopLoading) { + MWContext *c = MSG_GetContext(m_pane); - XP_InterruptContext(c); - } - else if (command == xfeCmdDialogOk) - { - MSG_SubscribeCommit(m_pane); - } - else - { - m_activeView->doCommand(command, calldata); - } + m_interrupting = TRUE; + XP_InterruptContext(c); + + } else if (command == xfeCmdDialogOk) { + + // If the context is busy, interrupt it. + if (XP_IsContextBusy(m_cloneContext)) { + m_interrupting = TRUE; + XP_InterruptContext(m_cloneContext); + } + + // Commit the subscription info + MSG_SubscribeCommit(m_pane); + + } else { + m_activeView->doCommand(command, calldata); + } } void diff --git a/mozilla/cmd/xfe/src/SubscribeView.h b/mozilla/cmd/xfe/src/SubscribeView.h index dfc27877c0e..df1f8ace3c5 100644 --- a/mozilla/cmd/xfe/src/SubscribeView.h +++ b/mozilla/cmd/xfe/src/SubscribeView.h @@ -28,11 +28,14 @@ #include "MNView.h" #include "SubTabView.h" #include "Command.h" +#include "xp.h" class XFE_SubscribeView : public XFE_MNView { public: - XFE_SubscribeView(XFE_Component *toplevel_component, Widget parent, XFE_View *parent_view, MWContext *context, MSG_Host *host, MSG_Pane *p = NULL); + XFE_SubscribeView(XFE_Component *toplevel_component, Widget parent, + XFE_View *parent_view, MWContext *context, + MSG_Host *host, MSG_Pane *p = NULL); virtual ~XFE_SubscribeView(); virtual Boolean isCommandEnabled(CommandType command, void *cd = NULL, @@ -41,21 +44,25 @@ public: XFE_CommandInfo* i = NULL); virtual void doCommand(CommandType command, void *calldata = NULL, XFE_CommandInfo* i = NULL); + XP_Bool isInterrupting() { return m_interrupting; }; + void doneInterrupting() { m_interrupting = FALSE; }; private: XFE_CALLBACK_DECL(updateButtons) + XP_Bool m_interrupting; - XFE_SubTabView *m_activeView; + XFE_SubTabView *m_activeView; + MWContext *m_cloneContext; // invoked when you switch tabs void tab_activate(int pos); static void tab_activate_callback(Widget, XtPointer, XtPointer); - void doFetchGroup(); - void fetchCompleted(); + void doFetchGroup(); + void fetchCompleted(); - static void do_fetch_group(MSG_Pane *pane, void *closure); - static void fetch_completed(MSG_Pane *pane, void *closure); + static void do_fetch_group(MSG_Pane *pane, void *closure); + static void fetch_completed(MSG_Pane *pane, void *closure); }; #endif /* _xfe_subscribeview_h */ diff --git a/mozilla/cmd/xfe/src/TaskBarDrop.h b/mozilla/cmd/xfe/src/TaskBarDrop.h index 84d1741a4c9..8b72f7609dd 100644 --- a/mozilla/cmd/xfe/src/TaskBarDrop.h +++ b/mozilla/cmd/xfe/src/TaskBarDrop.h @@ -37,7 +37,7 @@ class XFE_TaskBarDrop : public XFE_DropNetscape { public: XFE_TaskBarDrop(Widget,const char*); - ~XFE_TaskBarDrop(); + virtual ~XFE_TaskBarDrop(); protected: const char *_command; diff --git a/mozilla/cmd/xfe/src/ThreadFrame.cpp b/mozilla/cmd/xfe/src/ThreadFrame.cpp index 2296de4fe70..0c56c2bc83b 100644 --- a/mozilla/cmd/xfe/src/ThreadFrame.cpp +++ b/mozilla/cmd/xfe/src/ThreadFrame.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "MozillaApp.h" #include "FolderFrame.h" #include "FolderView.h" @@ -73,36 +73,77 @@ extern int XFE_SEND_UNSENTMAIL; #define THREEPANEVIEW_SHOW_PREF "mail.threadpane.3pane" -// -MenuSpec XFE_ThreadFrame::file_menu_spec[] = { - { "newSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::new_submenu_spec }, - { xfeCmdNewFolder, PUSHBUTTON }, - { xfeCmdOpenSelected, PUSHBUTTON }, -// { "openAttachmentsSubmenu", DYNA_CASCADEBUTTON, -// NULL, NULL, False, NULL, XFE_AttachmentMenu::generate }, - MENU_SEPARATOR, - { xfeCmdSaveMessagesAs, PUSHBUTTON }, - { xfeCmdEditMessage, PUSHBUTTON }, - MENU_SEPARATOR, - { xfeCmdEmptyTrash, PUSHBUTTON }, - { xfeCmdCompressFolders,PUSHBUTTON }, - { xfeCmdCompressAllFolders,PUSHBUTTON }, - MENU_SEPARATOR, - { "newMsgSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::newMsg_submenu_spec }, - { xfeCmdSendMessagesInOutbox, PUSHBUTTON }, - { xfeCmdCleanUpDisk, PUSHBUTTON }, -#if 0 - { xfeCmdUpdateMessageCount, PUSHBUTTON }, + +//new three pane menu spec for new +MenuSpec XFE_ThreadFrame::new_submenu_spec[] = { + { xfeCmdOpenBrowser, PUSHBUTTON }, + { xfeCmdComposeMessage, PUSHBUTTON }, +#ifdef EDITOR + MENU_PUSHBUTTON(xfeCmdNewBlank), #endif - { xfeCmdAddNewsgroup, PUSHBUTTON }, - //MENU_SEPARATOR, - //{ xfeCmdGoOffline, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdNewFolder, PUSHBUTTON }, + { NULL } +}; + +//new three pane menu spec for new +MenuSpec XFE_ThreadFrame::save_submenu_spec[] = { + { xfeCmdSaveMessagesAs, PUSHBUTTON }, + { xfeCmdSaveAsTemplate, PUSHBUTTON }, + { NULL } +}; + +MenuSpec XFE_ThreadFrame::select_submenu_spec[] = { + { xfeCmdSelectAll, PUSHBUTTON }, + { xfeCmdSelectAllMessages, PUSHBUTTON }, + { xfeCmdSelectThread, PUSHBUTTON }, + { xfeCmdSelectFlaggedMessages, PUSHBUTTON }, + { NULL } +}; + +MenuSpec XFE_ThreadFrame::show_submenu_spec[] = { + { xfeCmdToggleNavigationToolbar, PUSHBUTTON }, + { xfeCmdToggleLocationToolbar, PUSHBUTTON }, + { xfeCmdToggleMessageExpansion, PUSHBUTTON }, + { xfeCmdToggleFolderExpansion, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdToggleTaskbarShowing, PUSHBUTTON }, + { NULL } +}; + +MenuSpec XFE_ThreadFrame::mark_submenu_spec[] = { + { xfeCmdMarkMessageUnread, PUSHBUTTON }, + { xfeCmdMarkMessageRead, PUSHBUTTON }, + { xfeCmdMarkThreadRead, PUSHBUTTON }, + { xfeCmdMarkAllMessagesRead, PUSHBUTTON }, + { xfeCmdMarkMessageByDate, PUSHBUTTON }, + { xfeCmdMarkMessageForLater, PUSHBUTTON }, MENU_SEPARATOR, - //{ xfeCmdPrintSetup, PUSHBUTTON }, - //{ xfeCmdPrintPreview, PUSHBUTTON }, - { xfeCmdPrint, PUSHBUTTON }, + { xfeCmdMarkMessage, PUSHBUTTON }, + { xfeCmdUnmarkMessage, PUSHBUTTON }, + { NULL } +}; + +MenuSpec XFE_ThreadFrame::file_menu_spec[] = { + { "newSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::new_submenu_spec }, +// { xfeCmdOpenSelected, PUSHBUTTON }, +// { "openAttachmentsSubmenu", DYNA_CASCADEBUTTON, +// NULL, NULL, False, NULL, XFE_AttachmentMenu::generate }, + { "saveMsgAs", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::save_submenu_spec }, MENU_SEPARATOR, - { xfeCmdClose, PUSHBUTTON }, + { xfeCmdGetNewMessages, PUSHBUTTON }, + { xfeCmdGetNextNNewMsgs , PUSHBUTTON }, + { xfeCmdSendMessagesInOutbox, PUSHBUTTON }, + { xfeCmdAddNewsgroup, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdRenameFolder, PUSHBUTTON }, + { xfeCmdEmptyTrash, PUSHBUTTON }, + { xfeCmdCompressFolders, PUSHBUTTON }, + { xfeCmdCleanUpDisk, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdPrint, PUSHBUTTON }, + MENU_SEPARATOR, + { xfeCmdClose, PUSHBUTTON }, { xfeCmdExit, PUSHBUTTON }, { NULL } }; @@ -113,36 +154,40 @@ MenuSpec XFE_ThreadFrame::edit_menu_spec[] = { MENU_SEPARATOR, { xfeCmdCut, PUSHBUTTON }, { xfeCmdCopy, PUSHBUTTON }, - { xfeCmdPaste, PUSHBUTTON }, - { xfeCmdDeleteMessage, PUSHBUTTON }, - - { "selectSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::select_submenu_spec }, + { xfeCmdPaste, PUSHBUTTON }, + { xfeCmdDeleteAny, PUSHBUTTON }, + { "selectSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::select_submenu_spec }, MENU_SEPARATOR, { xfeCmdFindInObject, PUSHBUTTON }, { xfeCmdFindAgain, PUSHBUTTON }, { xfeCmdSearch, PUSHBUTTON }, +#if 0 + /* temporary take out + */ { xfeCmdSearchAddress, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdEditConfiguration, PUSHBUTTON }, { xfeCmdModerateDiscussion, PUSHBUTTON }, +#endif + MENU_SEPARATOR, + { xfeCmdEditMailFilterRules, PUSHBUTTON }, + { xfeCmdViewProperties, PUSHBUTTON }, MENU_SEPARATOR, - { xfeCmdEditMailFilterRules,PUSHBUTTON }, - //xxxAdd Folder/Discussion Properties { xfeCmdEditPreferences, PUSHBUTTON }, { NULL } }; MenuSpec XFE_ThreadFrame::view_menu_spec[] = { - { xfeCmdToggleNavigationToolbar,PUSHBUTTON }, - { xfeCmdToggleLocationToolbar, PUSHBUTTON }, - { xfeCmdToggleMessageExpansion, PUSHBUTTON }, + { "showSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::show_submenu_spec }, MENU_SEPARATOR, { "sortSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::sort_submenu_spec }, { "expandCollapseSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::expand_collapse_submenu_spec }, { "threadSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::threads_submenu_spec }, { "headersSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::headers_submenu_spec }, + MENU_SEPARATOR, // This should just be a toggle. -slamm { "attachmentsSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::attachments_submenu_spec }, + { xfeCmdWrapLongLines, TOGGLEBUTTON }, MENU_SEPARATOR, { xfeCmdIncreaseFont, PUSHBUTTON }, { xfeCmdDecreaseFont, PUSHBUTTON }, @@ -153,7 +198,6 @@ MenuSpec XFE_ThreadFrame::view_menu_spec[] = { { xfeCmdStopLoading, PUSHBUTTON }, MENU_SEPARATOR, { xfeCmdRot13Message, PUSHBUTTON }, - { xfeCmdWrapLongLines, TOGGLEBUTTON }, MENU_SEPARATOR, { xfeCmdViewPageSource, PUSHBUTTON }, { xfeCmdViewPageInfo, PUSHBUTTON }, @@ -162,23 +206,34 @@ MenuSpec XFE_ThreadFrame::view_menu_spec[] = { { NULL } }; -// -MenuSpec XFE_ThreadFrame::go_menu_spec[] = { +MenuSpec XFE_ThreadFrame::next_submenu_spec[] = { { xfeCmdNextMessage, PUSHBUTTON }, { xfeCmdNextUnreadMessage, PUSHBUTTON }, { xfeCmdNextFlaggedMessage, PUSHBUTTON }, + MENU_SEPARATOR, { xfeCmdNextUnreadThread, PUSHBUTTON }, + MENU_SEPARATOR, { xfeCmdNextCollection, PUSHBUTTON }, { xfeCmdNextUnreadCollection, PUSHBUTTON }, - MENU_SEPARATOR, + { NULL } +}; + +MenuSpec XFE_ThreadFrame::prev_submenu_spec[] = { { xfeCmdPreviousMessage, PUSHBUTTON }, { xfeCmdPreviousUnreadMessage, PUSHBUTTON }, { xfeCmdPreviousFlaggedMessage, PUSHBUTTON }, - MENU_SEPARATOR, + { NULL } +}; +// +MenuSpec XFE_ThreadFrame::go_menu_spec[] = { + { xfeCmdFirstUnreadMessage, PUSHBUTTON }, { xfeCmdFirstFlaggedMessage, PUSHBUTTON }, MENU_SEPARATOR, - { xfeCmdBack, PUSHBUTTON }, - { xfeCmdForward, PUSHBUTTON }, + { "nextSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::next_submenu_spec }, + { "prevSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::prev_submenu_spec }, + MENU_SEPARATOR, + { xfeCmdBack, PUSHBUTTON }, + { xfeCmdForward, PUSHBUTTON }, { NULL } }; @@ -200,15 +255,16 @@ MenuSpec XFE_ThreadFrame::message_menu_spec[] = { { "replySubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::reply_submenu_spec }, { xfeCmdForwardMessage, PUSHBUTTON }, { xfeCmdForwardMessageQuoted, PUSHBUTTON }, + { xfeCmdForwardMessageInLine, PUSHBUTTON }, + { xfeCmdEditMessage, PUSHBUTTON }, //{ xfeCmdInviteToNewsgroup, PUSHBUTTON }, MENU_SEPARATOR, - { "addToABSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::addrbk_submenu_spec }, { "fileSubmenu", DYNA_CASCADEBUTTON, NULL, NULL, False, (void*)xfeCmdMoveMessage, XFE_FolderMenu::generate }, { "copySubmenu", DYNA_CASCADEBUTTON, NULL, NULL, False, (void*)xfeCmdCopyMessage, XFE_FolderMenu::generate }, MENU_SEPARATOR, - { "markSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::mark_submenu_spec }, - { xfeCmdMarkMessage, PUSHBUTTON }, - { xfeCmdUnmarkMessage, PUSHBUTTON }, + { "addToABSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_Frame::addrbk_submenu_spec }, + MENU_SEPARATOR, + { "markSubmenu", CASCADEBUTTON, (MenuSpec *) &XFE_ThreadFrame::mark_submenu_spec }, MENU_SEPARATOR, { xfeCmdIgnoreThread, PUSHBUTTON }, { xfeCmdWatchThread, PUSHBUTTON }, @@ -287,11 +343,7 @@ ToolbarSpec XFE_ThreadFrame::toolbar_spec[] = { XFE_TOOLBAR_DELAY_LONG // Popup delay }, { xfeCmdPrint, PUSHBUTTON, &TB_Print_group }, - { xfeCmdViewSecurity, PUSHBUTTON, - &TB_Unsecure_group, - &TB_Secure_group, - &MNTB_SignUnsecure_group, - &MNTB_SignSecure_group}, + HG20938 { xfeCmdMarkMessageRead, // XX news only CASCADEBUTTON, &MNTB_MarkRead_group, NULL, NULL, NULL, // Icons @@ -299,7 +351,7 @@ ToolbarSpec XFE_ThreadFrame::toolbar_spec[] = { NULL, NULL, // Generate proc/arg XFE_TOOLBAR_DELAY_LONG // Popup delay }, - { xfeCmdDeleteMessage, PUSHBUTTON, &MNTB_Trash_group }, // XX mail only + { xfeCmdDeleteAny, PUSHBUTTON, &MNTB_Trash_group }, // XX mail only { xfeCmdStopLoading, PUSHBUTTON, &TB_Stop_group }, { NULL } }; @@ -392,8 +444,7 @@ XFE_ThreadFrame::XFE_ThreadFrame(Widget toplevel, XFE_Frame *parent_frame, // Configure the dashboard XP_ASSERT( m_dashboard != NULL ); - m_dashboard->setShowSecurityIcon(True); - m_dashboard->setShowSignedIcon(True); + HG71710 m_dashboard->setShowStatusBar(True); m_dashboard->setShowProgressBar(True); @@ -468,12 +519,20 @@ XFE_CALLBACK_DEFN(XFE_ThreadFrame, updateBanner)(XFE_NotificationCenter *, if (MSG_GetFolderLineById(XFE_MNView::getMaster(), t_view->getFolderInfo(), &folderline)) { + XP_Bool xxxe = FALSE; + + /* we need to check newshosts */ + if (folderline.flags & MSG_FOLDER_FLAG_NEWSGROUP) + { + MSG_NewsHost *host = MSG_GetNewsHostForFolder(folderline.id); + HG11299 + } m_dropdown->selectFolder(t_view->getFolderInfo(),False); m_banner->setProxyIcon(XFE_FolderView::treeInfoToIcon(folderline.level - 1, folderline.flags, - False)); + xxxe)); proxy = m_banner->getProxyIcon(); @@ -502,12 +561,18 @@ XFE_CALLBACK_DEFN(XFE_ThreadFrame, updateBanner)(XFE_NotificationCenter *, XFE_CALLBACK_DEFN(XFE_ThreadFrame, folderDeleted)(XFE_NotificationCenter*, void *, void *cdata) { + MSG_FolderInfo *info = (MSG_FolderInfo *) cdata; + +#ifdef USE_3PANE + XFE_ThreePaneView *view3 = (XFE_ThreePaneView*)m_view; + view3->selectFolder(info); +#else /* Need to check if this folder ? * hide or switch ? */ - MSG_FolderInfo *info = (MSG_FolderInfo *) cdata; if (info == getFolderInfo()) delete_response(); +#endif } @@ -536,7 +601,7 @@ XFE_ThreadFrame::loadFolder(MSG_FolderInfo *folderInfo) if (folderline.flags & MSG_FOLDER_FLAG_NEWSGROUP) { m_toolbar->hideButton(xfeCmdComposeMessage, PUSHBUTTON); - m_toolbar->hideButton(xfeCmdDeleteMessage, PUSHBUTTON); + m_toolbar->hideButton(xfeCmdDeleteAny, PUSHBUTTON); m_toolbar->hideButton(xfeCmdReplyToSender, CASCADEBUTTON); m_toolbar->hideButton(xfeCmdMoveMessage, CASCADEBUTTON); @@ -548,7 +613,7 @@ XFE_ThreadFrame::loadFolder(MSG_FolderInfo *folderInfo) else { m_toolbar->showButton(xfeCmdComposeMessage, PUSHBUTTON); - m_toolbar->showButton(xfeCmdDeleteMessage, PUSHBUTTON); + m_toolbar->showButton(xfeCmdDeleteAny, PUSHBUTTON); m_toolbar->showButton(xfeCmdReplyToSender, CASCADEBUTTON); m_toolbar->showButton(xfeCmdMoveMessage, CASCADEBUTTON); @@ -871,7 +936,7 @@ XFE_ThreadFrame::isCommandEnabled(CommandType cmd, void XFE_ThreadFrame::doCommand(CommandType cmd, - void *calldata, XFE_CommandInfo* info) + void * calldata, XFE_CommandInfo* info) { if (cmd == xfeCmdToggleLocationToolbar) { @@ -891,6 +956,13 @@ XFE_ThreadFrame::doCommand(CommandType cmd, } return; + }else if (cmd == xfeCmdToggleFolderExpansion) + { + if (m_banner) + { + m_banner->setShowFolder(!(m_banner->isFolderShown())); + notifyInterested(XFE_MNBanner::twoPaneView); + } } else if ( (cmd == xfeCmdComposeMessage) || (cmd == xfeCmdComposeMessagePlain) || (cmd == xfeCmdComposeMessageHTML) || @@ -941,8 +1013,7 @@ XFE_ThreadFrame::commandToString(CommandType cmd, int XFE_ThreadFrame::getSecurityStatus() { - XP_Bool is_signed = False; - XP_Bool is_encrypted = False; + HG12922 #ifdef USE_3PANE XFE_ThreadView *tview = (XFE_ThreadView*)( ((XFE_ThreePaneView*)m_view)->getThreadView()); @@ -956,51 +1027,19 @@ XFE_ThreadFrame::getSecurityStatus() printf("XFE_ThreadFrame::getSecurityStatus\n"); #endif - MIME_GetMessageCryptoState(m_context, 0, 0, &is_signed, &is_encrypted); + if (tview && tview->isDisplayingNews() ) { - // If this is displaying news, we decide if a newsgroup is secure(encrypted) - // or not by checking the security status ...instead of the crypto state + // If this is displaying news, we decide if a newsgroup is s x + // or not by checking the status ...instead of the c state #ifdef DEBUG_dora printf("News Thread Frame context...\n"); #endif - is_encrypted = XFE_Frame::getSecurityStatus() == XFE_SECURE; - } - - if (is_encrypted && is_signed ) - { -#ifdef DEBUG_dora - printf("signed and encrypted %d\n", XFE_SECURE_SIGNED); -#endif - status = XFE_SECURE_SIGNED; - } - else if (!is_encrypted && is_signed) - { -#ifdef DEBUG_dora - printf("signed and NO encrypted %d\n", XFE_UNSECURE_SIGNED); -#endif - status = XFE_UNSECURE_SIGNED; - } - else if (is_encrypted && !is_signed) - { -#ifdef DEBUG_dora - printf("NO signed and encrypted %d\n", XFE_SECURE_UNSIGNED); -#endif - status = XFE_SECURE_UNSIGNED; - } - else if (!is_encrypted && !is_signed ) - { -#ifdef DEBUG_dora - printf("NO signed and NO encrypted %d\n", XFE_UNSECURE_UNSIGNED); -#endif - status = XFE_UNSECURE_UNSIGNED; - } else { - // Error. Play it safe, go unsecure. - XP_ASSERT(0); - status = XFE_UNSECURE_UNSIGNED; + HG28182 } + HG12832 return status; } @@ -1172,7 +1211,6 @@ XFE_CALLBACK_DEFN(XFE_ThreadFrame,showFolder)(XFE_NotificationCenter *, XP_ASSERT(m_banner!= NULL); - printf("threadframe...showFolder\n"); m_banner->setShowFolder(showFolder); } diff --git a/mozilla/cmd/xfe/src/ThreadFrame.h b/mozilla/cmd/xfe/src/ThreadFrame.h index 47fd4f8b703..25024159e55 100644 --- a/mozilla/cmd/xfe/src/ThreadFrame.h +++ b/mozilla/cmd/xfe/src/ThreadFrame.h @@ -55,12 +55,20 @@ public: // For security icon state... virtual int getSecurityStatus(); + // Shared with MsgFrame and MsgCenter + static MenuSpec new_submenu_spec[]; + static MenuSpec save_submenu_spec[]; + static MenuSpec select_submenu_spec[]; + static MenuSpec show_submenu_spec[]; + static MenuSpec next_submenu_spec[]; + static MenuSpec prev_submenu_spec[]; + static MenuSpec go_menu_spec[]; + static MenuSpec mark_submenu_spec[]; private: static MenuSpec menu_bar_spec[]; static MenuSpec file_menu_spec[]; static MenuSpec edit_menu_spec[]; static MenuSpec view_menu_spec[]; - static MenuSpec go_menu_spec[]; static MenuSpec message_menu_spec[]; static MenuSpec offline_submenu_spec[]; diff --git a/mozilla/cmd/xfe/src/ThreadView.cpp b/mozilla/cmd/xfe/src/ThreadView.cpp index 9c7e9210ac7..cfb8345a060 100644 --- a/mozilla/cmd/xfe/src/ThreadView.cpp +++ b/mozilla/cmd/xfe/src/ThreadView.cpp @@ -37,6 +37,11 @@ #include "xfe.h" #include "icondata.h" #include "msgcom.h" + +#if defined(USE_ABCOM) +#include "ABListSearchView.h" +#endif /* USE_ABCOM */ + //#include "allxpstr.h" #include "felocale.h" /* for fe_ConvertToLocalEncoding */ #include "xp_mem.h" @@ -71,6 +76,9 @@ #include "xpgetstr.h" +/* +extern int MSG_HasAttachments(MSG_Pane* pane, MessageKey msgKey, XP_Bool *pHasThem); +*/ extern int XFE_RE; extern int XFE_WINDOW_TITLE_NEWSGROUP; extern int XFE_WINDOW_TITLE_FOLDER; @@ -124,12 +132,13 @@ MenuSpec XFE_ThreadView::news_popup_spec[] = { MENU_SEPARATOR, // Setting the call data to non-null is a signal to commandToString // not to reset the menu string - { xfeCmdReplyToSender, PUSHBUTTON, NULL, NULL, NULL, "reply-to-sender" }, - { xfeCmdReplyToAll, PUSHBUTTON, NULL, NULL, NULL, "reply-to-all" }, - { xfeCmdReplyToNewsgroup, PUSHBUTTON, NULL, NULL, NULL, "reply-to-newsgroup" }, - { xfeCmdReplyToSenderAndNewsgroup, PUSHBUTTON, NULL, NULL, NULL, "reply-to-sender-and-newsgroup" }, + { xfeCmdReplyToSender, PUSHBUTTON, NULL, NULL, False, "reply-to-sender" }, + { xfeCmdReplyToAll, PUSHBUTTON, NULL, NULL, False, "reply-to-all" }, + { xfeCmdReplyToNewsgroup, PUSHBUTTON, NULL, NULL, False, "reply-to-newsgroup" }, + { xfeCmdReplyToSenderAndNewsgroup, PUSHBUTTON, NULL, NULL, False, "reply-to-sender-and-newsgroup" }, { xfeCmdForwardMessage, PUSHBUTTON }, { xfeCmdForwardMessageQuoted, PUSHBUTTON }, + { xfeCmdForwardMessageInLine, PUSHBUTTON }, MENU_SEPARATOR, { "addToABSubmenu", CASCADEBUTTON, (MenuSpec *) &addrbk_submenu_spec }, @@ -150,10 +159,11 @@ MenuSpec XFE_ThreadView::mail_popup_spec[] = { MENU_SEPARATOR, // Setting the call data to non-null is a signal to commandToString // not to reset the menu string - { xfeCmdReplyToSender, PUSHBUTTON, NULL, NULL, NULL, "reply-to-sender" }, - { xfeCmdReplyToAll, PUSHBUTTON, NULL, NULL, NULL, "reply-to-all" }, + { xfeCmdReplyToSender, PUSHBUTTON, NULL, NULL, False, "reply-to-sender" }, + { xfeCmdReplyToAll, PUSHBUTTON, NULL, NULL, False, "reply-to-all" }, { xfeCmdForwardMessage, PUSHBUTTON }, { xfeCmdForwardMessageQuoted, PUSHBUTTON }, + { xfeCmdForwardMessageInLine, PUSHBUTTON }, MENU_SEPARATOR, { "addToABSubmenu", CASCADEBUTTON, (MenuSpec *) &addrbk_submenu_spec }, @@ -177,6 +187,11 @@ MenuSpec XFE_ThreadView::addrbk_submenu_spec[] = { { NULL } }; +extern "C" void fe_showSubscribeDialog(XFE_NotificationCenter *toplevel, + Widget parent, MWContext *context, + MSG_Host *host = NULL); + + XFE_ThreadView::XFE_ThreadView(XFE_Component *toplevel_component, Widget parent, XFE_View *parent_view, MWContext *context, @@ -189,6 +204,10 @@ XFE_ThreadView::XFE_ThreadView(XFE_Component *toplevel_component, m_frameDeleted = False; + /* timer + */ + m_scrollTimer = 0 ; + m_targetIndex = MSG_VIEWINDEXNONE; #if HANDLE_CMD_QUEUE m_lastLoadedInd = MSG_VIEWINDEXNONE; @@ -363,6 +382,11 @@ XFE_ThreadView::XFE_ThreadView(XFE_Component *toplevel_component, m_selectionAfterDeleting = MSG_VIEWINDEXNONE; m_popup = NULL; m_folderInfo = NULL; +#if defined(USE_ABCOM) + int error = + AB_SetShowPropertySheetForEntryFunc((MSG_Pane *) m_pane, + &XFE_ABListSearchView::ShowPropertySheetForEntryFunc); +#endif /* USE_ABCOM */ setBaseWidget(panedw); } @@ -402,15 +426,26 @@ void XFE_ThreadView::setGetNewMsg(XP_Bool b) fe_icon* XFE_ThreadView::flagToIcon(int folder_flags, int message_flags) { - if (folder_flags & MSG_FOLDER_FLAG_NEWSGROUP) + if (folder_flags & MSG_FOLDER_FLAG_NEWSGROUP) return (message_flags & MSG_FLAG_READ ? &newsPostIcon : &newsNewIcon); - else if (folder_flags & MSG_FOLDER_FLAG_DRAFTS) + else if (folder_flags & MSG_FOLDER_FLAG_DRAFTS) return &draftIcon; else if (message_flags & MSG_FLAG_IMAP_DELETED || message_flags & MSG_FLAG_EXPUNGED) return &deletedIcon; - else - return (message_flags & MSG_FLAG_READ ? &mailMessageReadIcon : &mailMessageUnreadIcon); + + else if (message_flags & MSG_FLAG_ATTACHMENT) + { + return &mailMessageAttachIcon; + } + else if (folder_flags & MSG_FOLDER_FLAG_TEMPLATES) + { + return &templateIcon; + } + else + { + return (message_flags & MSG_FLAG_READ ? &mailMessageReadIcon : &mailMessageUnreadIcon); + } } #if defined(USE_MOTIF_DND) @@ -422,6 +457,7 @@ XFE_ThreadView::flagToIconData(int folder_flags, int message_flags) else if (folder_flags & MSG_FOLDER_FLAG_DRAFTS) return &MN_Draftfile; else if (message_flags & MSG_FLAG_IMAP_DELETED + else if (folder_flags & MSG_FOLDER_FLAG_DRAFTS) || message_flags & MSG_FLAG_EXPUNGED) return &MN_Delete; else @@ -468,6 +504,15 @@ XFE_ThreadView::initMessageIcons(Widget widget, MN_Draftfile.width, MN_Draftfile.height, MN_Draftfile.mono_bits, MN_Draftfile.color_bits, MN_Draftfile.mask_bits, FALSE); + if (!templateIcon.pixmap) + fe_NewMakeIcon(widget, + fg_pixel, + bg_pixel, + &templateIcon, + NULL, + MN_Templatefile.width, MN_Templatefile.height, + MN_Templatefile.mono_bits, MN_Templatefile.color_bits, MN_Templatefile.mask_bits, FALSE); + if (!newsPostIcon.pixmap) fe_NewMakeIcon(widget, fg_pixel, @@ -513,6 +558,15 @@ XFE_ThreadView::initMessageIcons(Widget widget, MN_Flag.width, MN_Flag.height, MN_Flag.mono_bits, MN_Flag.color_bits, MN_Flag.mask_bits, FALSE); + if (!mailMessageAttachIcon.pixmap) + fe_NewMakeIcon(widget, + fg_pixel, + bg_pixel, + &mailMessageAttachIcon, + NULL, + MN_MailAttach.width, MN_MailAttach.height, + MN_MailAttach.mono_bits, MN_MailAttach.color_bits, MN_MailAttach.mask_bits, FALSE); + if (!threadonIcon.pixmap) fe_NewMakeIcon(widget, fg_pixel, @@ -687,8 +741,8 @@ XFE_ThreadView::listChangeStarting(XP_Bool /* asynchronous */, MSG_ViewIndex /* where */, int32 /* num */) { - int listChangeDepth = m_outliner->getListChangeDepth()-1; #if defined(DEBUG_tao) + int listChangeDepth = m_outliner->getListChangeDepth()-1; printf("\n>>XFE_ThreadView::listChangeStarting, depth=%d, m_lastLoadedInd=%d", listChangeDepth, m_lastLoadedInd); #endif @@ -697,6 +751,8 @@ XFE_ThreadView::listChangeStarting(XP_Bool /* asynchronous */, notify == MSG_NotifyAll) { m_lastLoadedInd = MSG_VIEWINDEXNONE; }/* if */ + else if (notify == MSG_NotifyNone) { + }/* MSG_NotifyNone */ } #endif /* DEL_5_0 */ @@ -712,15 +768,28 @@ XFE_ThreadView::listChangeFinished(XP_Bool /* asynchronous */, listChangeDepth, m_lastLoadedInd); #endif -#if defined(DEL_5_0) - if (notify == MSG_NotifyScramble || - notify == MSG_NotifyAll) { + if (notify == MSG_NotifyNone && + where == 0 && + num == 0 && + listChangeDepth == 0 && + m_deletedCount && + m_deleted) { + processCmdQueue(); + }/* */ + else if (notify == MSG_NotifyScramble || + notify == MSG_NotifyAll) { m_lastLoadedInd = MSG_GetMessageIndexForKey(m_pane, m_lastLoadedKey, False); }/* if */ else if (notify == MSG_NotifyChanged) { - m_lineChanged = where; + m_lineChanged = where; + /* when a msg header info changed on certain row, + backend will use this notification to warn fe. + we are suppose to re-acquire line m_messageLine info + from the backend and invalidate this row on display only + */ + acquireLineData((int)m_lineChanged); return; }/* if */ else if (notify == MSG_NotifyInsertOrDelete && @@ -747,8 +816,10 @@ XFE_ThreadView::listChangeFinished(XP_Bool /* asynchronous */, m_deleted[m_deletedCount++] = where-1; processCmdQueue(); }/* if */ +#if 0 else XP_ASSERT(0); +#endif }/* if collapsed */ else { #if defined(DEBUG_tao) @@ -762,11 +833,17 @@ XFE_ThreadView::listChangeFinished(XP_Bool /* asynchronous */, */ if (!m_deletedCount && !m_deleted) { m_deleted = (int *) XP_CALLOC(1, sizeof(int)); - m_deleted[m_deletedCount++] = where; - processCmdQueue(); + m_deleted[m_deletedCount++] = where; + if (listChangeDepth == 0) // non-nested +#if 1 + processCmdQueue(); +#endif + }/* if */ +#if 0 else XP_ASSERT(0); +#endif }/* where == m_lastLoadedInd */ else if (where <= m_lastLoadedInd) m_lastLoadedInd += num; /* re-adjust */ @@ -785,8 +862,10 @@ XFE_ThreadView::listChangeFinished(XP_Bool /* asynchronous */, m_deleted[m_deletedCount++] = where; processCmdQueue(); }/* if */ +#if 0 else XP_ASSERT(0); +#endif #if defined(DEBUG_tao) printf("\n**>SPECIAL case:listChangeFinished=%d, m_deletedCount=%d\n", @@ -795,7 +874,7 @@ XFE_ThreadView::listChangeFinished(XP_Bool /* asynchronous */, }/* m_lastLoadedInd == where */ }/* if num == 0 */ else if (num > 0 && where <= m_lastLoadedInd) - m_lastLoadedInd += num; + m_lastLoadedInd += num; /* re-adjust */ }/* notify == MSG_NotifyInsertOrDelete */ #if defined(DEBUG_tao) @@ -803,78 +882,6 @@ XFE_ThreadView::listChangeFinished(XP_Bool /* asynchronous */, m_lastLoadedInd); #endif - -#else - if (notify == MSG_NotifyChanged) { - m_lineChanged = where; - return; - }/* if */ - else if (notify == MSG_NotifyInsertOrDelete && - num <= 0) { - - if (num == 0) { - /* SPECIAL case: the header got deleted - */ - - /* we do not care deletion on non-focusing line - */ - if (m_lastLoadedInd != where) - return; - - /* deleted - */ - if (m_deletedCount && m_deleted) - m_deleted = (int *) XP_REALLOC(m_deleted, - (m_deletedCount+1)*sizeof(int)); - else - m_deleted = (int *) XP_CALLOC(1, sizeof(int)); - m_deleted[m_deletedCount++] = where; -#if defined(DEBUG_tao) - printf("\n**>SPECIAL case:listChangeFinished=%d, m_deletedCount=%d\n", - where, m_deletedCount); -#endif - - }/* if */ - else if ((m_lineChanged != MSG_VIEWINDEXNONE) && - (m_lineChanged == (where -1)) && /* essential */ - (listChangeDepth == 0)) { /* must be collapsing */ - /* collapsed - */ - if ((m_lastLoadedInd >= where) && - (m_lastLoadedInd < (where-num))) { - /* one of the "reply" is being hidden - * selection would go to thread leader; - * thus needs reload right away - */ - if (!m_deletedCount && !m_deleted) { - m_deleted = (int *) XP_CALLOC(1, sizeof(int)); - m_deleted[m_deletedCount++] = where-1; - processCmdQueue(); - }/* if */ - }/* if */ - }/* if */ - else if (num == -1){ - /* we do not care deletion on non-focusing line - */ - if (m_lastLoadedInd != where) - return; - - /* deleted - */ - if (m_deletedCount && m_deleted) - m_deleted = (int *) XP_REALLOC(m_deleted, - (m_deletedCount+1)*sizeof(int)); - else - m_deleted = (int *) XP_CALLOC(1, sizeof(int)); - m_deleted[m_deletedCount++] = where; -#if defined(DEBUG_tao) - printf("\n-->listChangeFinished=%d, m_deletedCount=%d\n", - where, m_deletedCount); -#endif - }/* else if num == -1 */ - }/* else if notify == MSG_NotifyInsertOrDelete && num < 0*/ -#endif /* DEL_5_0 */ - m_lineChanged = MSG_VIEWINDEXNONE; }/* XFE_ThreadView::listChangeFinished() */ @@ -895,6 +902,19 @@ XFE_ThreadView::paneChanged(XP_Bool asynchronous, /* bug 95564: check folderInfo before closing */ MSG_FolderInfo *deleted = (MSG_FolderInfo *) value; + + DD(printf("Blank out message view...\n");) + +#if defined(USE_3PANE) + if (m_folderInfo == deleted) { + /* clear msgPane + */ + m_msgview->loadMessage(deleted, MSG_MESSAGEKEYNONE ); + showMessage(-1); + m_outliner->change(0,0,0); + }/* if m_folderInfo == deleted */ +#else + m_msgview->loadMessage(deleted, MSG_MESSAGEKEYNONE ); if (m_folderInfo == deleted) { /* test frame type */ @@ -909,10 +929,13 @@ XFE_ThreadView::paneChanged(XP_Bool asynchronous, }/* if */ }/* if */ }/* if m_folderInfo == deleted */ +#endif /* USE_3PANE */ + #if defined(DEBUG_tao) else printf("\n---Wrong folder IGNORing MSG_PaneNotifyFolderDeleted\n"); #endif + } /* shall we update banner or simply return? */ @@ -949,11 +972,11 @@ XFE_ThreadView::paneChanged(XP_Bool asynchronous, #if HANDLE_CMD_QUEUE +#if defined(DEBUG_tao) MessageKey id = (MessageKey) value; MSG_ViewIndex index = MSG_GetMessageIndexForKey(m_pane, id, False); -#if defined(DEBUG_tao) printf("\n MSG_PaneNotifyMessageDeleted,index=%d", index); #endif #endif /* HANDLE_CMD_QUEUE */ @@ -999,6 +1022,12 @@ XFE_ThreadView::paneChanged(XP_Bool asynchronous, { m_commandPending = selectByIndex; m_pendingSelectionIndex = 0; + + /* when a msg being loaded after folder loaded, we should change + focus of the three pane UI to thread view bug #109659 + */ + getToplevel()->notifyInterested(XFE_MNListView::changeFocus, (void*) this); + /* end of #109659 */ } /* we only actually handle the command here @@ -1055,7 +1084,9 @@ XFE_ThreadView::loadFolder(MSG_FolderInfo *folderInfo) XP_ASSERT(folderInfo); // clear the currently display message, since we're in a different folder now. - showMessage(-1); + DD(printf("Load Folder: Blank out message view...\n");) + m_msgview->loadMessage(folderInfo, MSG_MESSAGEKEYNONE ); + updateExpandoFlippyText(-1); m_outliner->deselectAllItems(); @@ -1243,25 +1274,35 @@ XFE_ThreadView::showMessage(int row) if (!m_folderInfo) return; + if (row > -1) { + m_lastLoadedInd = (MSG_ViewIndex) row; + + m_lastLoadedKey = MSG_GetMessageKey(m_pane, row); +#if defined(DEBUG_tao) + printf("\nXFE_ThreadView::showMessage m_lastLoadedInd=%d\n", + m_lastLoadedInd); +#endif + }/* if */ + /* ** if the message area is expanded we just load the message, since ** we will turn around and call the makeVisible/selectItemExclusive/etc ** in our newMessageLoading method. ** If the message area isn't expanded, we handle it here. */ - if (row > -1) { - m_lastLoadedInd = (MSG_ViewIndex) row; - m_lastLoadedKey = MSG_GetMessageKey(m_pane, row); -#if defined(DEBUG_tao) - printf("\nXFE_ThreadView::showMessage m_lastLoadedInd=%d\n", - m_lastLoadedInd); -#endif - }/* if */ - if (m_msgExpanded) { - m_msgview->loadMessage(m_folderInfo, - (row == -1 ? MSG_MESSAGEKEYNONE : MSG_GetMessageKey(m_pane, row))); + MSG_ViewIndex index; + MessageKey key; + MSG_FolderInfo *info = NULL; + + MSG_GetCurMessage(m_msgview->getPane(), &info, &key, &index); + if (key != m_lastLoadedKey) { + m_msgview->loadMessage(m_folderInfo, + (row == -1 ? + MSG_MESSAGEKEYNONE : + MSG_GetMessageKey(m_pane, row))); + }/* if */ } else { @@ -1285,7 +1326,7 @@ XFE_ThreadView::commandToString(CommandType cmd, void * calldata, XFE_CommandInf else return stringFromResource("showMsgAreaCmdString"); } - else if (IS_CMD(xfeCmdDeleteMessage) || IS_CMD(xfeCmdCancelMessages)) { + else if (IS_CMD(xfeCmdDeleteAny) || IS_CMD(xfeCmdDeleteMessage) || IS_CMD(xfeCmdCancelMessages)) { if (isDisplayingNews()) return XP_GetString(MK_MSG_CANCEL_MESSAGE); else @@ -1348,7 +1389,7 @@ XFE_ThreadView::isCommandEnabled(CommandType cmd, void *calldata, XFE_CommandInf { #define IS_CMD(command) cmd == (command) - if (IS_CMD(xfeCmdDeleteMessage)) { + if (IS_CMD(xfeCmdDeleteAny)|| IS_CMD(xfeCmdDeleteMessage)) { /* Given a flag or set of flags, returns the number of folders that have * that flag set. If the result pointer is not NULL, fills it in with the * list of folders (providing up to resultsize entries). @@ -1365,9 +1406,41 @@ XFE_ThreadView::isCommandEnabled(CommandType cmd, void *calldata, XFE_CommandInf int count; m_outliner->getSelection(&selected, &count); +#if defined(USE_ABCOM) + if ((IS_CMD(xfeCmdAddSenderToAddressBook)|| + IS_CMD(xfeCmdAddAllToAddressBook)) && + count > 0) { + + XP_List *abList = AB_AcquireAddressBookContainers(m_contextData); + XP_ASSERT(abList); + int nDirs = XP_ListCount(abList); + + XP_Bool selectable = False; + if (!nDirs) + return selectable; + + /* XFE always returns the first one + */ + AB_ContainerInfo *destAB = + (AB_ContainerInfo *) XP_ListGetObjectNum(abList,1); + XP_ASSERT(destAB); + + int error = MSG_AddToAddressBookStatus(m_pane, + commandToMsgCmd(cmd), + (MSG_ViewIndex*)selected, + count, + &selectable, NULL, NULL, NULL, + destAB); + error = AB_ReleaseContainersList(abList); + + return selectable; + }/* if */ +#endif /* USE_ABCOM */ + // DeleteMessage stands for CancelMessage in the ThreadView, // so intercept it early: - if ( (IS_CMD(xfeCmdDeleteMessage) || IS_CMD(xfeCmdCancelMessages)) + if ( (IS_CMD(xfeCmdDeleteAny) || + IS_CMD(xfeCmdDeleteMessage) || IS_CMD(xfeCmdCancelMessages)) && isDisplayingNews() ) { XP_Bool selectable = False; @@ -1404,7 +1477,7 @@ XFE_ThreadView::isCommandEnabled(CommandType cmd, void *calldata, XFE_CommandInf (MSG_ViewIndex*)selected, count, &selectable, NULL, NULL, NULL); -#if defined(DEBUG_tao) +#if defined(DEBUG_tao_) if (IS_CMD(xfeCmdUndo)) printf("\n XFE_ThreadView, MSG_CommandStatus:: m_pane=%x, xfeCmdUndo=%d", m_pane, selectable); else if (IS_CMD(xfeCmdRedo)) @@ -1532,10 +1605,12 @@ XFE_ThreadView::handlesCommand(CommandType cmd, void *calldata, XFE_CommandInfo* || IS_CMD(xfeCmdReplyToAll) || IS_CMD(xfeCmdForwardMessage) || IS_CMD(xfeCmdForwardMessageQuoted) + || IS_CMD(xfeCmdForwardMessageInLine) || IS_CMD(xfeCmdNextMessage) || IS_CMD(xfeCmdNextUnreadMessage) || IS_CMD(xfeCmdPreviousMessage) || IS_CMD(xfeCmdPreviousUnreadMessage) + || IS_CMD(xfeCmdDeleteAny) || IS_CMD(xfeCmdDeleteMessage) || IS_CMD(xfeCmdSortBySender) || IS_CMD(xfeCmdSortByDate) @@ -1666,9 +1741,37 @@ XFE_ThreadView::doCommand(CommandType cmd, toggleMsgExpansion(); getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating); } +#if defined(USE_ABCOM) + else if ((IS_CMD(xfeCmdAddSenderToAddressBook)|| + IS_CMD(xfeCmdAddAllToAddressBook)) && + count > 0) { + + XP_List *abList = AB_AcquireAddressBookContainers(m_contextData); + XP_ASSERT(abList); + int nDirs = XP_ListCount(abList); + + if (nDirs) { + /* XFE always returns the first one + */ + AB_ContainerInfo *destAB = + (AB_ContainerInfo *) XP_ListGetObjectNum(abList,1); + XP_ASSERT(destAB); + + int error = MSG_AddToAddressBook(m_pane, + commandToMsgCmd(cmd), + (MSG_ViewIndex*)selected, + count, + destAB); + error = AB_ReleaseContainersList(abList); + }/* if */ + }/* if */ +#endif /* USE_ABCOM */ else if (IS_CMD(xfeCmdMommy)) { fe_showFoldersWithSelected(XtParent(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), NULL, m_folderInfo); @@ -1684,6 +1787,9 @@ XFE_ThreadView::doCommand(CommandType cmd, if (w == NULL) w = m_widget; + /* Need to make the view that has the pop up the current focus so that menu items + can be enabled on the context menu again */ + getToplevel()->notifyInterested(XFE_MNListView::changeFocus, (void*) this); m_popup = new XFE_PopupMenu("popup",(XFE_Frame*)m_toplevel, // XXXXXXX XfeAncestorFindApplicationShell(w)); @@ -1715,6 +1821,17 @@ XFE_ThreadView::doCommand(CommandType cmd, { getNewMail(); } + else if (IS_CMD(xfeCmdAddNewsgroup)) + { + // Code pasted from FolderView.cpp + D( printf ("MSG_FolderPane::addNewsgroup()\n");) + + /* We can use folder info in ThreadView to get to Host */ + MSG_Host *host = NULL; + host = MSG_GetHostForFolder(m_folderInfo); + + fe_showSubscribeDialog(getToplevel(), getToplevel()->getBaseWidget(), m_contextData, host); + } else if (IS_CMD(xfeCmdGetNextNNewMsgs)) { getNewNews(); @@ -1786,7 +1903,8 @@ XFE_ThreadView::doCommand(CommandType cmd, MSG_CopyMessagesIntoFolder(m_pane, (MSG_ViewIndex*)selected, count, info); } else if (isDisplayingNews() - && (IS_CMD(xfeCmdDeleteMessage) || IS_CMD(xfeCmdCancelMessages))) + && (IS_CMD(xfeCmdDeleteMessage) || IS_CMD(xfeCmdCancelMessages) || + IS_CMD(xfeCmdDeleteAny) )) { // If this is a news article, then Delete Message // is really Cancel Message: @@ -1848,7 +1966,7 @@ XFE_ThreadView::doCommand(CommandType cmd, } } } - else if (IS_CMD(xfeCmdDeleteMessage)) + else if (IS_CMD(xfeCmdDeleteMessage) || IS_CMD(xfeCmdDeleteAny) ) { if (count == 1) /* stop loading since we are deleting this message: @@ -1867,11 +1985,14 @@ XFE_ThreadView::doCommand(CommandType cmd, else if (IS_CMD(xfeCmdEditMailFilterRules)) { fe_showMailFilterDlg(getToplevel()->getBaseWidget(), - m_contextData); + m_contextData,m_pane); } else if (IS_CMD(xfeCmdSearchAddress)) { fe_showLdapSearch(XfeAncestorFindApplicationShell(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), (Chrome*)NULL); @@ -1922,6 +2043,9 @@ XFE_ThreadView::doCommand(CommandType cmd, key = MSG_GetMessageKey(m_pane, (MSG_ViewIndex)selected[i]); fe_showMsg(XtParent(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), NULL, m_folderInfo, key, FALSE); } @@ -1931,6 +2055,9 @@ XFE_ThreadView::doCommand(CommandType cmd, // We don't need to call XtParent on the base widget because // the base widget is the real toplevel widget already...dora 12/31/96 fe_showMNSearch(XfeAncestorFindApplicationShell(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), NULL, this, m_folderInfo); } @@ -2460,6 +2587,7 @@ XFE_ThreadView::getColumnText(int column) fe_icon * XFE_ThreadView::getColumnIcon(int column) { + switch (column) { case OUTLINER_COLUMN_SUBJECT: @@ -2467,7 +2595,6 @@ XFE_ThreadView::getColumnIcon(int column) MSG_FolderLine folderLine; MSG_GetFolderLineById(XFE_MNView::getMaster(), m_folderInfo, &folderLine); - return flagToIcon(folderLine.flags, m_messageLine.flags); } case OUTLINER_COLUMN_UNREADMSG: @@ -2657,7 +2784,9 @@ XFE_CALLBACK_DEFN(XFE_ThreadView, allConnectionsComplete)(XFE_NotificationCenter printf("\n XFE_ThreadView::allConnectionsComplete\n"); #endif - processCmdQueue(); + if (m_deletedCount && + m_deleted) + processCmdQueue(); #endif /* HANDLE_CMD_QUEUE */ handlePendingCommand(); @@ -2785,7 +2914,7 @@ XFE_ThreadView::handlePendingCommand() if (resultId == MSG_MESSAGEKEYNONE || resultingThread == MSG_MESSAGEKEYNONE) { - resultIndex == m_outliner->getTotalLines() - 1; + resultIndex = (MSG_ViewIndex)m_outliner->getTotalLines() - 1; } else { @@ -2936,6 +3065,9 @@ XFE_ThreadView::Buttonfunc(const OutlineButtonFuncData *data) // 2. data->alt (whether the alt key was down or not...) fe_showMsg(XtParent(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), (Chrome*)NULL, m_folderInfo, @@ -2954,7 +3086,7 @@ XFE_ThreadView::Buttonfunc(const OutlineButtonFuncData *data) int count; m_outliner->getSelection(&selected, &count); -#if defined(DEBUG_tao) +#if defined(DEBUG_tao_) printf("\n+++ data->clicks count=%d\n", count); #endif if (data->ctrl) @@ -2962,7 +3094,7 @@ XFE_ThreadView::Buttonfunc(const OutlineButtonFuncData *data) m_outliner->toggleSelected(data->row); m_outliner->getSelection(&selected, &count); -#if defined(DEBUG_tao) +#if defined(DEBUG_tao_) printf("\n+++ data->clicks count=%d\n", count); #endif if (count == 1) @@ -3021,6 +3153,14 @@ XFE_ThreadView::Buttonfunc(const OutlineButtonFuncData *data) } else { + if ((int) m_targetIndex != data->row) { + // + m_targetIndex = MSG_VIEWINDEXNONE; + if (m_scrollTimer) + XtRemoveTimeOut(m_scrollTimer); + m_scrollTimer = 0; + }/* if */ + // we've selected a message, update the label and load it into // our message view. @@ -3089,6 +3229,26 @@ XFE_CALLBACK_DEFN(XFE_ThreadView, spaceAtMsgEnd)(XFE_NotificationCenter*, doCommand(xfeCmdNextUnreadCollection); } +static void +click_timer_func(XtPointer closure, XtIntervalId *) +{ + XFE_ThreadView *v = (XFE_ThreadView *) closure; + if (v) + v->selectTimer(); +} + +void +XFE_ThreadView::selectTimer() +{ + if (m_targetIndex != MSG_VIEWINDEXNONE) + m_outliner->makeVisible(m_targetIndex); + // + m_targetIndex = MSG_VIEWINDEXNONE; + if (m_scrollTimer) + XtRemoveTimeOut(m_scrollTimer); + m_scrollTimer = 0; +} + XFE_CALLBACK_DEFN(XFE_ThreadView, newMessageLoading)(XFE_NotificationCenter*, void *, void*) { @@ -3096,7 +3256,9 @@ XFE_CALLBACK_DEFN(XFE_ThreadView, newMessageLoading)(XFE_NotificationCenter*, { MSG_FolderInfo *info = m_msgview->getFolderInfo(); MessageKey key = m_msgview->getMessageKey(); - +#if defined(DEBUG_tao) + printf("--newMessageLoading, m_pane=0x%x, m_lastLoadedKey=0x%x,key=0x%x", m_pane, m_lastLoadedKey, key); +#endif if (info != m_folderInfo) { m_commandPending = selectByKey; @@ -3112,8 +3274,25 @@ XFE_CALLBACK_DEFN(XFE_ThreadView, newMessageLoading)(XFE_NotificationCenter*, int numLines = MSG_GetNumLines(m_pane); if (m_outliner->getTotalLines() != numLines) m_outliner->change(0, numLines, numLines); - +#if 1 + m_targetIndex = index; + int intvl0 = XtGetMultiClickTime(XtDisplay(m_widget)), + intvl = intvl0 + intvl0/2; +#if defined(DEBUG_tao) + printf("--newMessageLoading, intvl0=%d, intvl=%d", + intvl0, intvl); +#endif + m_scrollTimer = XtAppAddTimeOut(fe_XtAppContext, intvl, + click_timer_func, this); + +#else + /* 97010: selecting the last mail/news article + * show the wrong one. + * + * Take out to prevent improper auto-selection... -tao + */ m_outliner->makeVisible(index); +#endif m_outliner->selectItemExclusive(index); updateExpandoFlippyText(index); } diff --git a/mozilla/cmd/xfe/src/ThreadView.h b/mozilla/cmd/xfe/src/ThreadView.h index 254e9729aef..db85ae14e30 100644 --- a/mozilla/cmd/xfe/src/ThreadView.h +++ b/mozilla/cmd/xfe/src/ThreadView.h @@ -63,6 +63,8 @@ public: virtual ~XFE_ThreadView(); + void selectTimer(); + virtual void paneChanged(XP_Bool asynchronous, MSG_PANE_CHANGED_NOTIFY_CODE code, int32 value); @@ -70,8 +72,8 @@ public: void listChangeStarting(XP_Bool asynchronous, MSG_NOTIFY_CODE notify, MSG_ViewIndex where, int32 num); #endif /* DEL_5_0 */ - void listChangeFinished(XP_Bool asynchronous, MSG_NOTIFY_CODE notify, - MSG_ViewIndex where, int32 num); + virtual void listChangeFinished(XP_Bool asynchronous, MSG_NOTIFY_CODE notify, + MSG_ViewIndex where, int32 num); void loadFolder(MSG_FolderInfo *folderInfo); MSG_FolderInfo *getFolderInfo(); @@ -248,6 +250,11 @@ private: static MenuSpec addrbk_submenu_spec[]; void selectThread(); + + /* select timer + */ + XtIntervalId m_scrollTimer; + MSG_ViewIndex m_targetIndex; }; #endif /* _xfe_threadview_h */ diff --git a/mozilla/cmd/xfe/src/ThreePaneView.cpp b/mozilla/cmd/xfe/src/ThreePaneView.cpp index edcce924017..bd79d4bee1d 100644 --- a/mozilla/cmd/xfe/src/ThreePaneView.cpp +++ b/mozilla/cmd/xfe/src/ThreePaneView.cpp @@ -24,10 +24,10 @@ #include "ThreePaneView.h" #include "ThreadFrame.h" +#include #include "prefs.h" #include "prefapi.h" -#include const char* XFE_ThreePaneView::ShowFolder = "XFE_ThreePaneView::ShowFolder"; #define THREEPANEVIEW_SHOW_PREF "mail.threadpane.3pane" @@ -42,8 +42,9 @@ XFE_ThreePaneView::XFE_ThreePaneView(XFE_Component *toplevel_component, MWContext *context) : XFE_View(toplevel_component, parent_view, context) { - Widget hpane; - + Widget hpane; + +#if 1 hpane = XtVaCreateWidget("hpane", xfePaneWidgetClass, parent, @@ -53,13 +54,26 @@ XFE_ThreePaneView::XFE_ThreePaneView(XFE_Component *toplevel_component, XmNsashShadowThickness, 1, XmNpaneSashType, XmPANE_SASH_LIVE, NULL); - +#else + hpane = XmCreateHPanedWindow(parent, "hpane", NULL, 0); +#endif m_focusview = NULL; m_folderview = new XFE_FolderView(toplevel_component, hpane, this, context); m_threadview = new XFE_ThreadView(toplevel_component, hpane, this, context); + XtVaSetValues(m_folderview->getBaseWidget(), + XmNallowResize, TRUE, + XmNpaneMinimum, PANE_MIN, // should this be a resource? + XmNpaneMaximum, PANE_MAX, // why is the limit in HPaned 1000??? + NULL); + XtVaSetValues(m_threadview->getBaseWidget(), + XmNallowResize, TRUE, + XmNpaneMinimum, PANE_MIN, // should this be a resource? + XmNpaneMaximum, PANE_MAX, // why is the limit in HPaned 1000??? + NULL); + // add our subviews to the list of subviews for command dispatching and // deletion. addView(m_folderview); @@ -197,7 +211,24 @@ XFE_ThreePaneView::isCommandEnabled(CommandType cmd, void *calldata, XFE_Command { XP_ASSERT( m_focusview != NULL); +#define IS_CMD(command) cmd == (command) + if (IS_CMD(xfeCmdToggleFolderExpansion)) + return True; + + if (m_focusview != m_folderview && m_folderview && + (IS_CMD(xfeCmdRenameFolder) || + IS_CMD(xfeCmdNewFolder) )) + { + return m_folderview->isCommandEnabled(cmd,calldata,info); + } + if ( IS_CMD(xfeCmdDeleteAny) ) + { + if ( m_focusview == m_folderview) + return m_focusview->isCommandEnabled(xfeCmdDeleteFolder,calldata,info); + else if (m_focusview == m_threadview) + return m_focusview->isCommandEnabled(xfeCmdDeleteMessage,calldata,info); + } return m_focusview->isCommandEnabled(cmd,calldata,info); } @@ -211,6 +242,19 @@ XFE_ThreePaneView::doCommand(CommandType cmd, void *calldata, XFE_CommandInfo* i { m_threadview->doCommand(cmd,calldata,info); } + else if (m_focusview != m_folderview && m_folderview && + (IS_CMD(xfeCmdRenameFolder) || + IS_CMD(xfeCmdNewFolder) )) + { + m_folderview->doCommand(cmd,calldata,info); + } + else if ( IS_CMD(xfeCmdDeleteAny) ) + { + if ( m_focusview == m_folderview) + m_focusview->doCommand(xfeCmdDeleteFolder,calldata,info); + else if (m_focusview == m_threadview) + m_focusview->doCommand(xfeCmdDeleteMessage,calldata,info); + } else m_focusview->doCommand(cmd,calldata,info); } @@ -220,11 +264,28 @@ XFE_ThreePaneView::handlesCommand(CommandType cmd, void *calldata, XFE_CommandIn { #define IS_CMD(command) cmd == (command) XP_ASSERT( m_focusview != NULL); + + + if (IS_CMD(xfeCmdToggleFolderExpansion)) + return True; + if (IS_CMD(xfeCmdMommy) && m_focusview != m_threadview && m_threadview) { return m_threadview->handlesCommand(cmd,calldata,info); } - + else if (m_focusview != m_folderview && m_folderview && + (IS_CMD(xfeCmdRenameFolder) || + IS_CMD(xfeCmdNewFolder) )) + { + return m_folderview->handlesCommand(cmd,calldata,info); + } + else if ( IS_CMD(xfeCmdDeleteAny) ) + { + if ( m_focusview == m_folderview) + return m_focusview->handlesCommand(xfeCmdDeleteFolder,calldata,info); + else if (m_focusview == m_threadview) + return m_focusview->handlesCommand(xfeCmdDeleteMessage,calldata,info); + } return m_focusview->handlesCommand(cmd,calldata,info); } @@ -239,5 +300,14 @@ char* XFE_ThreePaneView::commandToString(CommandType cmd, void *calldata, XFE_CommandInfo* info) { XP_ASSERT( m_focusview != NULL); +#define IS_CMD(command) cmd == (command) + + if (IS_CMD(xfeCmdToggleFolderExpansion)) + { + if (m_folderview->isShown()) + return stringFromResource("hideFolderAreaCmdString"); + else + return stringFromResource("showFolderAreaCmdString"); + } return m_focusview->commandToString(cmd,calldata,info); } diff --git a/mozilla/cmd/xfe/src/Toolbar.cpp b/mozilla/cmd/xfe/src/Toolbar.cpp index 4ad5686121e..f4423ef25a8 100644 --- a/mozilla/cmd/xfe/src/Toolbar.cpp +++ b/mozilla/cmd/xfe/src/Toolbar.cpp @@ -21,7 +21,7 @@ */ - +#include "rosetta.h" #include "Frame.h" #include "HTMLView.h" #include "MozillaApp.h" @@ -328,10 +328,7 @@ XFE_Toolbar::update() { if (XfeIsButton(children[i])) { - if (m_security && children[i] == m_security->getBaseWidget()) - { - m_security->useIconGroup(m_parentFrame->getSecurityStatus()); - } + HG10291 updateButton(children[i]); } } @@ -618,10 +615,7 @@ XFE_Toolbar::createPush(ToolbarSpec * spec) this, (XFE_FunctionNotification)doCommand_cb); - if (XP_STRCMP(spec->toolbarButtonName, xfeCmdViewSecurity) == 0) - { - m_security = button; - } + HG01922 return result; } diff --git a/mozilla/cmd/xfe/src/ToolbarDrop.h b/mozilla/cmd/xfe/src/ToolbarDrop.h index e27abcf22b8..2068ea7d22c 100644 --- a/mozilla/cmd/xfe/src/ToolbarDrop.h +++ b/mozilla/cmd/xfe/src/ToolbarDrop.h @@ -42,7 +42,7 @@ class XFE_ToolbarDrop : public XFE_DropNetscape public: XFE_ToolbarDrop (Widget); - ~XFE_ToolbarDrop (); + virtual ~XFE_ToolbarDrop (); protected: @@ -67,7 +67,7 @@ public: XFE_PersonalDrop (Widget dropWidget, XFE_PersonalToolbar * toolbar); - ~XFE_PersonalDrop (); + virtual ~XFE_PersonalDrop (); protected: @@ -117,7 +117,7 @@ public: XFE_BookmarkMenu * quickfileMenu); - ~XFE_QuickfileDrop (); + virtual ~XFE_QuickfileDrop (); protected: diff --git a/mozilla/cmd/xfe/src/View.cpp b/mozilla/cmd/xfe/src/View.cpp index 5a5a2074fee..0918c492807 100644 --- a/mozilla/cmd/xfe/src/View.cpp +++ b/mozilla/cmd/xfe/src/View.cpp @@ -34,6 +34,9 @@ const char * XFE_View::chromeNeedsUpdating = "XFE_View::chromeNeedsUpdating"; const char * XFE_View::commandNeedsUpdating = "XFE_View::commandNeedsUpdating"; const char * XFE_View::statusNeedsUpdating = "XFE_View::statusNeedsUpdating"; const char * XFE_View::statusNeedsUpdatingMidTruncated = "XFE_View::statusNeedsUpdatingMidTruncated"; +const char *XFE_View::allConnectionsCompleteCallback = "XFE_View::allConnectionsCompleteCallback"; + +static char myClassName[] = "XFE_View::className"; XFE_View::XFE_View(XFE_Component *toplevel_component, XFE_View *parent_view, MWContext *context) : XFE_Component(toplevel_component) @@ -67,6 +70,22 @@ XFE_View::~XFE_View() XP_FREE(m_subviews); } +const char* +XFE_View::getClassName() +{ + return myClassName; +} + +void +XFE_View::allConnectionsComplete(MWContext *context) +{ + /* Tao_27apr98 + * Notify whoever interested in "allConnectionsComplete" event + */ + notifyInterested(XFE_View::allConnectionsCompleteCallback, (void*) context); + notifyInterested(XFE_View::chromeNeedsUpdating); +} + XFE_View * XFE_View::getParent() { @@ -170,6 +189,9 @@ XFE_View::doCommand(CommandType cmd, void *calldata, XFE_CommandInfo* info) else if ( cmd == xfeCmdSearchAddress) { fe_showLdapSearch(XfeAncestorFindApplicationShell(getToplevel()->getBaseWidget()), + /* Tao: we might need to check if this returns a + * non-NULL frame + */ ViewGlue_getFrame(m_contextData), (Chrome*)NULL); diff --git a/mozilla/cmd/xfe/src/View.h b/mozilla/cmd/xfe/src/View.h index e5dff511282..5ca9f1b5552 100644 --- a/mozilla/cmd/xfe/src/View.h +++ b/mozilla/cmd/xfe/src/View.h @@ -42,6 +42,13 @@ public: MWContext* getContext(); int getNumSubViews(); + virtual const char* getClassName(); + + // called when all connections when this window are finished. + // Really should be a notification... + virtual void allConnectionsComplete(MWContext *context); + static const char *allConnectionsCompleteCallback; + /* The view that is returned is either this view or one of it's sub views. */ virtual XFE_View* widgetToView(Widget w); diff --git a/mozilla/cmd/xfe/src/ViewDialog.cpp b/mozilla/cmd/xfe/src/ViewDialog.cpp index 850fe6373ca..b8e200b6655 100644 --- a/mozilla/cmd/xfe/src/ViewDialog.cpp +++ b/mozilla/cmd/xfe/src/ViewDialog.cpp @@ -20,8 +20,6 @@ Created: Chris Toshok , 16-Oct-96. */ - - #include "ViewDialog.h" #include "xpassert.h" #include "structs.h" @@ -150,7 +148,8 @@ XFE_ViewDialog::cancel_cb(Widget, XtPointer clientData, XtPointer) obj->cancel(); - XtDestroyWidget(obj->getBaseWidget()); + if (obj->m_okToDestroy) + XtDestroyWidget(obj->getBaseWidget()); } void diff --git a/mozilla/cmd/xfe/src/ViewDialog.h b/mozilla/cmd/xfe/src/ViewDialog.h index 8e3e074f689..442f0357717 100644 --- a/mozilla/cmd/xfe/src/ViewDialog.h +++ b/mozilla/cmd/xfe/src/ViewDialog.h @@ -20,8 +20,6 @@ Created: Chris Toshok , 16-Oct-96. */ - - #ifndef _xfe_viewdialog_h #define _xfe_viewdialog_h diff --git a/mozilla/cmd/xfe/src/ViewGlue.cpp b/mozilla/cmd/xfe/src/ViewGlue.cpp index 0f59a880cdf..81b10d9e1a3 100644 --- a/mozilla/cmd/xfe/src/ViewGlue.cpp +++ b/mozilla/cmd/xfe/src/ViewGlue.cpp @@ -36,6 +36,15 @@ ViewGlue_addMapping(XFE_Frame *frame, CONTEXT_DATA(mwcontext)->view = frame; } +void +ViewGlue_addMappingForCompo(XFE_Component *compo, + void *context) +{ + MWContext *mwcontext = (MWContext*)context; + + CONTEXT_DATA(mwcontext)->view = compo; +} + // Get a view associated with a context. // Toshok: "the name is a throwback to when we had @@ -46,5 +55,25 @@ ViewGlue_getFrame(void *context) MWContext *mwcontext = (MWContext*)context; if (mwcontext == NULL) return NULL; +#if defined(GLUE_COMPO_CONTEXT) + XFE_Component *compo = (XFE_Component *) (CONTEXT_DATA(mwcontext)->view); + if (compo && + compo->isClassOf("Frame")) + return ((XFE_Frame*) compo); + else + return NULL; +#else return (XFE_Frame*)(CONTEXT_DATA(mwcontext)->view); +#endif /* GLUE_COMPO_CONTEXT */ +} + +// Get a view associated with a context. +// one context per view. Now we have one per frame." +XFE_Component * +ViewGlue_getCompo(void *context) +{ + MWContext *mwcontext = (MWContext*)context; + if (mwcontext == NULL) return NULL; + + return (XFE_Component*)(CONTEXT_DATA(mwcontext)->view); } diff --git a/mozilla/cmd/xfe/src/ViewGlue.h b/mozilla/cmd/xfe/src/ViewGlue.h index fb46d8a5a90..19ca2ec1dbb 100644 --- a/mozilla/cmd/xfe/src/ViewGlue.h +++ b/mozilla/cmd/xfe/src/ViewGlue.h @@ -33,4 +33,9 @@ extern void ViewGlue_addMapping(XFE_Frame *frame, void *context); extern XFE_Frame *ViewGlue_getFrame(void *context); +/* for XFE_Component + */ +extern void ViewGlue_addMappingForCompo(XFE_Component *compo, void *context); +extern XFE_Component *ViewGlue_getCompo(void *context); + #endif /* _xfe_viewglue_h */ diff --git a/mozilla/cmd/xfe/src/context_funcs.cpp b/mozilla/cmd/xfe/src/context_funcs.cpp index 4c346b0e11c..93b43cc9ba4 100644 --- a/mozilla/cmd/xfe/src/context_funcs.cpp +++ b/mozilla/cmd/xfe/src/context_funcs.cpp @@ -24,6 +24,7 @@ #include "il_types.h" #include "layers.h" #include "jsapi.h" +#include "prefapi.h" #include "MozillaApp.h" #include "Frame.h" #include "ViewGlue.h" @@ -97,7 +98,6 @@ extern int MK_UNABLE_TO_LOCATE_FILE; #ifdef MOZ_LDAP extern "C" void fe_ldapsearch_finished(MWContext *context); -extern "C" void fe_AB_AllConnectionsComplete(MWContext *context); #endif #ifndef NO_WEB_FONTS @@ -105,6 +105,7 @@ extern "C" void fe_AB_AllConnectionsComplete(MWContext *context); extern "C" int fe_WebfontsNeedReload(MWContext *context); #endif /* NO_WEB_FONTS */ +extern "C" char * _XmStringGetTextConcat(XmString); #if DEBUG_slamm_ #define D(x) x #else @@ -137,9 +138,9 @@ fe_stderr_dialog_timer (XtPointer /* closure */, XtIntervalId * /* id */) /* If too much data was printed, then something has gone haywire, so truncate it. */ char *trailer = XP_GetString(XFE_STDERR_DIAGNOSTICS_HAVE_BEEN_TRUNCATED); - int max = sizeof (stderr_buffer) - strlen (trailer) - 5; - if (strlen (s) > max) - strcpy (s + max, trailer); + size_t max = sizeof (stderr_buffer)/sizeof(char) - strlen (trailer) - 5; + if (XP_STRLEN (s) > max) + XP_STRCPY (s + max, trailer); /* Now show the user. Possibly we should do something about not popping this up @@ -349,6 +350,36 @@ fe_initialize_stderr (void) #define CHECK_CONTEXT_AND_DATA(c) \ ((c) && CONTEXT_DATA(c) && !CONTEXT_DATA(context)->being_destroyed) +#if defined(GLUE_COMPO_CONTEXT) +// +// Return either the context's component or the current active component +// +static XFE_Component * +fe_compoFromMWContext(MWContext *context) +{ + XFE_Component * compo = NULL; + + // Sanity check for possible invocation of this function from a compo + // that was just destroyed (or is being destroyed) + if (!CHECK_CONTEXT_AND_DATA(context)) + { + return NULL; + } + + // Try to use context's frame + compo = ViewGlue_getCompo(XP_GetNonGridContext(context)); + + // Make sure the frame is alive + if (compo && !compo->isAlive()) + { + compo = NULL; + } + + return compo; +} + +#endif /* GLUE_COMPO_CONTEXT */ + // // Return either the context's frame or the current active frame // @@ -451,12 +482,12 @@ XFE_EnableClicking(MWContext *context) D( printf("XFE_EnableClicking(context = 0x%x) running_p = %d\n", context, running_p); ) - if (f) + if (f && f->isAlive()) { f->notifyInterested(XFE_View::commandNeedsUpdating, (void*)xfeCmdStopLoading); - f->notifyInterested(running_p ? + f->notifyInterested(running_p? XFE_Frame::frameBusyCallback: XFE_Frame::frameNotBusyCallback); } @@ -540,12 +571,19 @@ extern "C" void XFE_AllConnectionsComplete(MWContext *context) { MWContext *top = XP_GetNonGridContext (context); +#if defined(GLUE_COMPO_CONTEXT) + XFE_Component *f = 0; +#else XFE_Frame *f; - +#endif /* GLUE_COMPO_CONTEXT */ // this is evil and vile but it's been known to happen if (top == NULL) return; +#if defined(GLUE_COMPO_CONTEXT) + f = ViewGlue_getCompo(top); +#else f = ViewGlue_getFrame(top); +#endif /* GLUE_COMPO_CONTEXT */ if (CONTEXT_DATA (context)->being_destroyed) return; @@ -628,8 +666,16 @@ XFE_AllConnectionsComplete(MWContext *context) } if (f && f->isAlive()) +// if (f && f->getBaseWidget() && f->getBaseWidget()->core.being_destroyed == False) { - f->allConnectionsComplete(); +#if defined(GLUE_COMPO_CONTEXT) + if (f->isClassOf("Frame")) + ((XFE_Frame *) f)->allConnectionsComplete(context); + else if (f->isClassOf("View")) + ((XFE_View *) f)->allConnectionsComplete(context); +#else + f->allConnectionsComplete(context); +#endif /* GLUE_COMPO_CONTEXT */ } else { @@ -640,19 +686,8 @@ XFE_AllConnectionsComplete(MWContext *context) #endif if (context->type == MWContextSaveToDisk) /* gag gag gag */ - fe_DestroySaveToDiskContext (context); - else if ( context->type == MWContextSearchLdap) - { -#ifdef UNIX_LDAP -// fe_ldapsearch_finished(context); -#endif - } -#ifdef MOZ_LDAP - else if ( context->type == MWContextAddressBook) /* AB ldap search */ - { - fe_AB_AllConnectionsComplete(context); - } -#endif // MOZ_LDAP + fe_DestroySaveToDiskContext (context); + } } @@ -1143,22 +1178,29 @@ FE_UpdateChrome(MWContext *context, /* in */ frame->respectChrome(chrome); } +/* This used to be MOZ_MAIL_NEWS (MOZ_LITE actually) in the NOVA branch */ #ifdef MOZ_LDAP extern "C" void FE_RememberPopPassword (MWContext *context, const char *password) { - /* Store password into preferences. */ - StrAllocCopy (fe_globalPrefs.pop3_password, password); + // If we aren't supposed to remember don't save anything + XP_Bool passwordProtectLocalCache; - /* If user has already requesting saving it, do that. */ - if (fe_globalPrefs.rememberPswd) - { - if (!XFE_SavePrefs ((char *) fe_globalData.user_prefs_file, - &fe_globalPrefs)) - fe_perror (context, XP_GetString( XFE_ERROR_SAVING_PASSWORD ) ); + PREF_GetBoolPref("mail.password_protect_local_cache", + &passwordProtectLocalCache); + + // Store password into preferences. + StrAllocCopy (fe_globalPrefs.pop3_password, password); + + // If user has already requesting saving it, do that. + if (fe_globalPrefs.rememberPswd || passwordProtectLocalCache) { + if (!XFE_SavePrefs ((char *) fe_globalData.user_prefs_file, + &fe_globalPrefs)) + fe_perror (context, XP_GetString( XFE_ERROR_SAVING_PASSWORD ) ); } } -#endif +#endif /* MOZ_LDAP */ + extern "C" void FE_BackCommand(MWContext *context) @@ -1560,7 +1602,7 @@ FE_FindCommand(MWContext *context, /* in MOD: can this be mail or news? /* * This section is an exact cut and paste from fe_find(). Ugh! */ - int32 x, y; + int32 x,y; LO_SelectText (context_to_find, find_data->start_element, find_data->start_pos, find_data->end_element, find_data->end_pos, @@ -1690,6 +1732,8 @@ xfe2_MakeNewWindow(Widget toplevel, MWContext *context_to_copy, Boolean /* skip_get_url */, Chrome *decor) { XFE_Frame *parent_frame = context_to_copy ? ViewGlue_getFrame(context_to_copy) : 0; +// XP_ASSERT(parent_frame); + MWContext *new_context = 0; switch (type) @@ -1731,7 +1775,7 @@ xfe2_MakeNewWindow(Widget toplevel, MWContext *context_to_copy, } case MSG_THREADPANE: { - MSG_FolderInfo *folder = MSG_GetFolderInfoFromURL(fe_getMNMaster(), url->address); + MSG_FolderInfo *folder = MSG_GetFolderInfoFromURL(fe_getMNMaster(), url->address, FALSE); if (folder) new_context = fe_showMessages(toplevel, parent_frame, decor, folder, fe_globalPrefs.reuse_thread_window, FALSE, MSG_MESSAGEKEYNONE); @@ -1739,7 +1783,7 @@ xfe2_MakeNewWindow(Widget toplevel, MWContext *context_to_copy, } case MSG_MESSAGEPANE: { - MSG_FolderInfo *folder = MSG_GetFolderInfoFromURL(fe_getMNMaster(), url->address); + MSG_FolderInfo *folder = MSG_GetFolderInfoFromURL(fe_getMNMaster(), url->address, TRUE); MSG_MessageLine msgLine; MessageKey key = MSG_MESSAGEKEYNONE; @@ -1905,6 +1949,176 @@ extern "C" void fe_sgiStop() #endif +#if 0 +//#if defined(GLUE_COMPO_CONTEXT) +////////////////////////////////////////////////////////////////////////// +// +// Progress functions. XFE_Component versions +// +////////////////////////////////////////////////////////////////////////// + +static void fe_compoNotifyLogoStopAnimation (MWContext *); +static void fe_compoNotifyLogoStartAnimation (MWContext *); + +static void fe_compoNotifyProgressUpdateText (MWContext *,char *); +static void fe_compoNotifyProgressUpdatePercent (MWContext *,int); + +static void fe_compoNotifyProgressTickCylon (MWContext *); + +static void fe_compoNotifyStatusUpdateText (MWContext *,char *); + +////////////////////////////////////////////////////////////////////////// +static void +fe_compoNotifyLogoStartAnimation(MWContext * context) +{ + XP_ASSERT( context != NULL ); + + if (!CHECK_CONTEXT_AND_DATA(context)) + { + return; + } + + CONTEXT_DATA(context)->logo_animation_running = True; + + // Try to get the xfe compo for the context + XFE_Component * compo = fe_compoFromMWContext(context); + + // There will be no compo for biff context so we ignore them + if (!compo) + { + return; + } + + // Notify the compo to start animating the logo + compo->notifyInterested(XFE_Component::logoStartAnimation,(void *) NULL); +} +////////////////////////////////////////////////////////////////////////// +static void +fe_compoNotifyLogoStopAnimation(MWContext * context) +{ + XP_ASSERT( context != NULL ); + + if (!CHECK_CONTEXT_AND_DATA(context)) + { + return; + } + + CONTEXT_DATA(context)->logo_animation_running = False; + + // Try to get the xfe compo for the context + XFE_Component * compo = fe_compoFromMWContext(context); + + // There will be no compo for biff context so we ignore them + if (!compo) + { + return; + } + + // Notify the compo to stop animating the logo + compo->notifyInterested(XFE_Component::logoStopAnimation,(void *) NULL); +} +////////////////////////////////////////////////////////////////////////// +static void +fe_compoNotifyProgressUpdateText(MWContext * context,char * text) +{ + XP_ASSERT( context != NULL ); + + if (!CHECK_CONTEXT_AND_DATA(context)) + { + return; + } + + // Try to get the xfe compo for the context + XFE_Component * compo = fe_compoFromMWContext(context); + + // There will be no compo for biff context so we ignore them + if (!compo) + { + return; + } + + // Notify the compo to update the progress text + compo->notifyInterested(XFE_Component::progressBarUpdateText,(void *) text); +} +////////////////////////////////////////////////////////////////////////// +static void +fe_compoNotifyProgressUpdatePercent(MWContext * context,int percent) +{ + XP_ASSERT( context != NULL ); + + if (!CHECK_CONTEXT_AND_DATA(context)) + { + return; + } + + // Try to get the xfe compo for the context + XFE_Component * compo = fe_compoFromMWContext(context); + + // There will be no compo for biff context so we ignore them + if (!compo) + { + return; + } + + // Notify the compo to update the progress percent + compo->notifyInterested(XFE_Component::progressBarUpdatePercent, + (void *) percent); +} + +////////////////////////////////////////////////////////////////////////// +static void +fe_compoNotifyProgressTickCylon(MWContext * context) +{ + XP_ASSERT( context != NULL ); + + if (!CHECK_CONTEXT_AND_DATA(context)) + { + return; + } + + // Try to get the xfe compo for the context + XFE_Component * compo = fe_compoFromMWContext(context); + + // There will be no compo for biff context so we ignore them + if (!compo) + { + return; + } + + // Notify the compo to tick cyclone mode + compo->notifyInterested(XFE_Component::progressBarCylonTick); +} +////////////////////////////////////////////////////////////////////////// +static void +fe_compoNotifyStatusUpdateText(MWContext * context,char * text) +{ + XP_ASSERT( context != NULL ); + + if (!CHECK_CONTEXT_AND_DATA(context)) + { + return; + } + + // Try to get the xfe compo for the context + XFE_Component * compo = fe_compoFromMWContext(context); + + // There will be no compo for biff context so we ignore them + if (!compo) + { + return; + } + + char * message = text; + + if (message == 0 || *message == '\0') + { + message = context->defaultStatus; + } + + // Notify the compo to update the status text + compo->notifyInterested(XFE_View::statusNeedsUpdating,(void*) message); +} +#endif /* GLUE_COMPO_CONTEXT */ ////////////////////////////////////////////////////////////////////////// // @@ -1918,7 +2132,7 @@ static void fe_frameNotifyLogoStartAnimation (MWContext *); static void fe_frameNotifyProgressUpdateText (MWContext *,char *); static void fe_frameNotifyProgressUpdatePercent (MWContext *,int); -static void fe_frameNotifyProgressTickCylon (MWContext *); +static void fe_frameNotifyProgressTickCylon (MWContext *); static void fe_frameNotifyStatusUpdateText (MWContext *,char *); @@ -1935,6 +2149,17 @@ fe_frameNotifyLogoStartAnimation(MWContext * context) CONTEXT_DATA(context)->logo_animation_running = True; +#if defined(GLUE_COMPO_CONTEXT) + // Try to get the xfe compo for the context + XFE_Component *compo = fe_compoFromMWContext(context); + if (!compo) + return; + + // Notify the frame to start animating the logo + compo->notifyInterested(XFE_Component::logoStartAnimation, + (void *) NULL); + +#else // Try to get the xfe frame for the context XFE_Frame * frame = fe_frameFromMWContext(context); @@ -1946,6 +2171,7 @@ fe_frameNotifyLogoStartAnimation(MWContext * context) // Notify the frame to start animating the logo frame->notifyInterested(XFE_Frame::logoStartAnimation,(void *) NULL); +#endif /* GLUE_COMPO_CONTEXT */ } ////////////////////////////////////////////////////////////////////////// static void @@ -1960,6 +2186,16 @@ fe_frameNotifyLogoStopAnimation(MWContext * context) CONTEXT_DATA(context)->logo_animation_running = False; +#if defined(GLUE_COMPO_CONTEXT) + // Try to get the xfe compo for the context + XFE_Component *compo = fe_compoFromMWContext(context); + if (!compo) + return; + + // Notify the compo to stop animating the logo + compo->notifyInterested(XFE_Component::logoStopAnimation, + (void *) NULL); +#else // Try to get the xfe frame for the context XFE_Frame * frame = fe_frameFromMWContext(context); @@ -1971,6 +2207,7 @@ fe_frameNotifyLogoStopAnimation(MWContext * context) // Notify the frame to stop animating the logo frame->notifyInterested(XFE_Frame::logoStopAnimation,(void *) NULL); +#endif /* GLUE_COMPO_CONTEXT */ } ////////////////////////////////////////////////////////////////////////// static void @@ -1983,6 +2220,14 @@ fe_frameNotifyProgressUpdateText(MWContext * context,char * text) return; } +#if defined(GLUE_COMPO_CONTEXT) + XFE_Component *compo = fe_compoFromMWContext(context); + if (!compo) + return; + + compo->notifyInterested(XFE_Component::progressBarUpdateText, + (void *) text); +#else // Try to get the xfe frame for the context XFE_Frame * frame = fe_frameFromMWContext(context); @@ -1994,6 +2239,7 @@ fe_frameNotifyProgressUpdateText(MWContext * context,char * text) // Notify the frame to update the progress text frame->notifyInterested(XFE_Frame::progressBarUpdateText,(void *) text); +#endif /* GLUE_COMPO_CONTEXT */ } ////////////////////////////////////////////////////////////////////////// static void @@ -2006,6 +2252,14 @@ fe_frameNotifyProgressUpdatePercent(MWContext * context,int percent) return; } +#if defined(GLUE_COMPO_CONTEXT) + XFE_Component *compo = fe_compoFromMWContext(context); + if (!compo) + return; + + compo->notifyInterested(XFE_Component::progressBarUpdatePercent, + (void *) percent); +#else // Try to get the xfe frame for the context XFE_Frame * frame = fe_frameFromMWContext(context); @@ -2018,6 +2272,7 @@ fe_frameNotifyProgressUpdatePercent(MWContext * context,int percent) // Notify the frame to update the progress percent frame->notifyInterested(XFE_Frame::progressBarUpdatePercent, (void *) percent); +#endif /* GLUE_COMPO_CONTEXT */ } ////////////////////////////////////////////////////////////////////////// @@ -2031,6 +2286,13 @@ fe_frameNotifyProgressTickCylon(MWContext * context) return; } +#if defined(GLUE_COMPO_CONTEXT) + XFE_Component *compo = fe_compoFromMWContext(context); + if (!compo) + return; + + compo->notifyInterested(XFE_Component::progressBarCylonTick); +#else // Try to get the xfe frame for the context XFE_Frame * frame = fe_frameFromMWContext(context); @@ -2040,8 +2302,9 @@ fe_frameNotifyProgressTickCylon(MWContext * context) return; } - // Notify the frame to tick cylon mode + // Notify the frame to tick cyclone mode frame->notifyInterested(XFE_Frame::progressBarCylonTick); +#endif /* GLUE_COMPO_CONTEXT */ } ////////////////////////////////////////////////////////////////////////// static void @@ -2054,6 +2317,20 @@ fe_frameNotifyStatusUpdateText(MWContext * context,char * text) return; } +#if defined(GLUE_COMPO_CONTEXT) + XFE_Component *compo = fe_compoFromMWContext(context); + if (!compo) + return; + + char * message = text; + + if (message == 0 || *message == '\0') + { + message = context->defaultStatus; + } + + compo->notifyInterested(XFE_View::statusNeedsUpdating,(void*) message); +#else // Try to get the xfe frame for the context XFE_Frame * frame = fe_frameFromMWContext(context); @@ -2072,9 +2349,12 @@ fe_frameNotifyStatusUpdateText(MWContext * context,char * text) // Notify the frame to update the status text frame->notifyInterested(XFE_View::statusNeedsUpdating,(void*) message); +#endif /* GLUE_COMPO_CONTEXT */ } ////////////////////////////////////////////////////////////////////////// + + /* Print a status message in the wholine. A pointer to the string is not retained. @@ -2113,11 +2393,11 @@ fe_progress_dialog_timer (XtPointer closure, XtIntervalId * /* id */) the length, only update every 1/2 second. */ CONTEXT_DATA (context)->thermo_timer_id = - XtAppAddTimeOut (fe_XtAppContext, + XtAppAddTimeOut (fe_XtAppContext, (CONTEXT_DATA (context)->thermo_lo_percent <= 0 - ? 100 - : 500), - fe_progress_dialog_timer, closure); + ? 100 + : 500), + fe_progress_dialog_timer, closure); } /* Start blinking the light and drawing the thermometer. diff --git a/mozilla/cmd/xfe/src/pref.cpp b/mozilla/cmd/xfe/src/pref.cpp index 9063eddd5a0..9a57c8e4fcc 100644 --- a/mozilla/cmd/xfe/src/pref.cpp +++ b/mozilla/cmd/xfe/src/pref.cpp @@ -32,6 +32,7 @@ #include "java.h" #endif #include "PrefsDialog.h" +#include "prefapi.h" extern "C" { @@ -120,8 +121,10 @@ extern "C" void fe_installMailNewsComposition() extern "C" void fe_installMailNewsMserver() { - NET_SetPopUsername (fe_globalPrefs.pop3_user_id); - MSG_SetBiffStatFile(fe_globalPrefs.use_movemail_p ? fe_mn_getmailbox() : + char *user_name; + PREF_CopyCharPref("mail.pop_name", &user_name); + NET_SetPopUsername (user_name); + MSG_SetBiffStatFile(fe_globalPrefs.use_movemail_p ? fe_mn_getmailbox() : (char *)NULL); } diff --git a/mozilla/cmd/xfe/src/xfe2_extern.h b/mozilla/cmd/xfe/src/xfe2_extern.h index 3532143f65c..0fa2a0e511d 100644 --- a/mozilla/cmd/xfe/src/xfe2_extern.h +++ b/mozilla/cmd/xfe/src/xfe2_extern.h @@ -103,7 +103,7 @@ extern MWContext* fe_showMsg(Widget toplevel, XFE_Frame *parent_frame, Chrome *c extern MWContext* fe_showInbox(Widget toplevel, XFE_Frame *parent_frame, Chrome *chromespec, XP_Bool with_reuse, XP_Bool getNewMail); extern MWContext* fe_showMessages(Widget toplevel, XFE_Frame *parent_frame, Chrome *chromespec, MSG_FolderInfo *info, XP_Bool with_reuse, XP_Bool getNewMail, MessageKey key); -#ifdef MOZ_TASKBAR +#if defined(MOZ_MAIL_NEWS) /* task bar */ extern void fe_showTaskBar(Widget toplevel); #endif @@ -122,6 +122,11 @@ extern void XFE_SetDocTitle(MWContext *context, char *title); extern void fe_openTargetUrl(MWContext * context,LO_AnchorData * anchor_data); +#if defined(MOZ_MAIL_NEWS) +extern MSG_IMAPUpgradeType fe_promptForIMAPSubscriptionUpgrade(MWContext *context, + const char* hostName); +#endif + XP_END_PROTOS #endif /* _xfe_extern_h */ diff --git a/mozilla/cmd/xfe/src/xfe_commands b/mozilla/cmd/xfe/src/xfe_commands index 945f0fcbba2..ed18566fa2b 100644 --- a/mozilla/cmd/xfe/src/xfe_commands +++ b/mozilla/cmd/xfe/src/xfe_commands @@ -35,6 +35,7 @@ xfeCmdSortDescending sortDescendin xfeCmdABNewList abNewList xfeCmdABCopyEntry abCopyEntry xfeCmdABDeleteEntry abDeleteEntry +xfeCmdABDeleteAllEntries abDeleteAllEntries xfeCmdABEditEntry abEditEntry xfeCmdABSearchEntry abSearchEntry xfeCmdABSearchLdap abSearchLdap @@ -55,6 +56,8 @@ xfeCmdDecreaseFont decreaseFont xfeCmdDelete delete xfeCmdEditConfiguration editConfiguration xfeCmdModerateDiscussion moderateDiscussion +xfeCmdManageMailingList manageMailingList +xfeCmdManagePublicFolders managePublicFolders xfeCmdEditMailFilterRules editMailFilterRules xfeCmdEditMessage editMessage xfeCmdEditPreferences editPreferences @@ -86,6 +89,7 @@ xfeCmdNewNewsHost newNewsHost xfeCmdNextCategory nextCategory xfeCmdNextMessage nextMessage xfeCmdNextUnreadCategory nextUnreadCategory +xfeCmdFirstUnreadMessage firstUnreadMessage xfeCmdNextUnreadMessage nextUnreadMessage xfeCmdNextUnreadThread nextUnreadThread xfeCmdNextNewsgroup nextNewsgroup @@ -134,6 +138,8 @@ xfeCmdOpenUrlFromSelection openUrlFromSe xfeCmdRefresh refresh xfeCmdReload reload xfeCmdSaveAs saveAs + +xfeCmdSaveAsMenu saveAsMenu xfeCmdSaveLink saveURL xfeCmdSaveImage saveImage xfeCmdSaveBGImage saveBGImage @@ -152,6 +158,7 @@ xfeCmdViewProperties viewPropertie xfeCmdViewSecurity viewSecurity xfeCmdViewDirectories viewDirectories +xfeCmdShowChrome showChrome xfeCmdShowFormattingToolbar showFormattingToolbar xfeCmdShowImages showImages @@ -167,6 +174,7 @@ xfeCmdFileBookmark fileBookmark xfeCmdEditBookmark editBookmark xfeCmdNetscapeDirectory netscapeDirectory xfeCmdDestinations destinations +xfeCmdStopReload stopReload xfeCmdEdit edit # HTML View stuff @@ -221,12 +229,14 @@ xfeCmdComposeArticleHTML composeArticl xfeCmdComposeArticlePlain composeArticlePlain xfeCmdChooseMessagesForOffline chooseMessageForOffline xfeCmdDeleteCategory deleteCategory +xfeCmdDeleteAny deleteAny xfeCmdDeleteFolder deleteFolder xfeCmdDeleteMessage deleteMessage xfeCmdFirstFlaggedMessage firstFlaggedMessage xfeCmdFlagMessage flagMessage xfeCmdForwardMessage forwardMessage xfeCmdForwardMessageQuoted forwardMessageQuoted +xfeCmdForwardMessageInLine forwardMessageInLine xfeCmdGetFlaggedMessagesForOffline getFlaggedMessagesForOffline xfeCmdGetNewMessages getNewMessages xfeCmdGetNextNNewMsgs getNextNNewMsgs @@ -254,6 +264,7 @@ xfeCmdReplyToSenderAndNewsgroup replyToSender xfeCmdRetrieveMarkedMessages retrieveMarkedMessages xfeCmdRetrieveSelectedMessages retrieveSelectedMessages xfeCmdSaveMessagesAs saveMessagesAs +xfeCmdSaveAsTemplate saveAsTemplate xfeCmdSaveMessagesAsAndDelete saveMessagesAsAndDelete xfeCmdSelectFlaggedMessages selectFlaggedMessages xfeCmdSelectThread selectThread @@ -304,6 +315,7 @@ xfeCmdSortByUnread sortByUnread xfeCmdSortForward sortForward xfeCmdSortBackward sortBackward xfeCmdToggleMessageExpansion toggleMessageExpansion +xfeCmdToggleFolderExpansion toggleFolderExpansion xfeCmdViewNew viewNew xfeCmdViewAllMessages viewAllMessages xfeCmdViewAllThreads viewAllThreads @@ -362,6 +374,7 @@ xfeCmdQuote quote xfeCmdQuoteOriginalText quoteOriginalText xfeCmdRemoveLink removeLink xfeCmdSaveDraft saveDraft +xfeCmdSaveTemplate saveTemplate xfeCmdSendMessageNow sendMessageNow xfeCmdSendMessageLater sendMessageLater xfeCmdViewAddresses viewAddresses diff --git a/mozilla/cmd/xfe/xfe.c b/mozilla/cmd/xfe/xfe.c index 312f41a7d2c..0f1c093f779 100644 --- a/mozilla/cmd/xfe/xfe.c +++ b/mozilla/cmd/xfe/xfe.c @@ -20,7 +20,7 @@ Created: Jamie Zawinski , 22-Jun-94. */ - +#include "rosetta.h" #include "mozilla.h" #include "altmail.h" #include "xfe.h" @@ -348,7 +348,11 @@ fe_GetURL (MWContext *context, URL_Struct *url, Boolean skip_get_url) #ifdef EDITOR !(context->is_editor) && #endif +#if 1 + (needNewWindow = MSG_NewWindowRequiredForURL(context, url)) && +#else (needNewWindow = MSG_NewWindowRequired(context, url->address)) && +#endif XP_STRCMP(url->address, "search-libmsg:")) { @@ -367,7 +371,13 @@ fe_GetURL (MWContext *context, URL_Struct *url, Boolean skip_get_url) new_context = fe_FindNonCustomBrowserContext(context); } - if ( new_context ) + if (!new_context ) + { + context = fe_MakeWindow (XtParent (CONTEXT_WIDGET (context)), context, + url, NULL, MWContextBrowser, FALSE); + return (context ? 0 : -1); + } + else { /* If we find a new browser context, use it to display URL */ @@ -931,9 +941,7 @@ fe_copy_context_settings(MWContext *to, MWContext *from) dto->show_directory_buttons_p = dfrom->show_directory_buttons_p; dto->show_menubar_p = dfrom->show_menubar_p; dto->show_bottom_status_bar_p = dfrom->show_bottom_status_bar_p; -#ifndef NO_SECURITY - dto->show_security_bar_p = dfrom->show_security_bar_p; -#endif + HG21989 dto->autoload_images_p = dfrom->autoload_images_p; dto->loading_images_p = False; dto->looping_images_p = False; @@ -956,9 +964,7 @@ fe_copy_context_settings(MWContext *to, MWContext *from) dto->show_directory_buttons_p = fe_globalPrefs.show_directory_buttons_p; dto->show_menubar_p = fe_globalPrefs.show_menubar_p; dto->show_bottom_status_bar_p = fe_globalPrefs.show_bottom_status_bar_p; -#ifndef NO_SECURITY - dto->show_security_bar_p = fe_globalPrefs.show_security_bar_p; -#endif + HG12976 dto->autoload_images_p = fe_globalPrefs.autoload_images_p; dto->loading_images_p = False; dto->looping_images_p = False; @@ -2576,7 +2582,10 @@ fe_MinimalNoUICleanup() fe_SaveBookmarks (); PREF_SavePrefFile(); + +#ifdef JAVA NR_ShutdownRegistry(); +#endif #ifdef MOZ_SMARTUPDATE SU_Shutdown(); #endif @@ -3375,7 +3384,7 @@ char* fe_GetLDAPTmpFile(char *name) { if (!home) home = ""; if (!name) return NULL; - sprintf(tmp, "%.900s/.netscape/", home); + PR_snprintf(tmp, sizeof(tmp), "%.900s/.netscape/", home); #ifdef _XP_TMP_FILENAME_FOR_LDAP_ /* we need to write this */ @@ -3755,7 +3764,7 @@ fe_display_docString(MWContext* context, if (s == NULL) { static char buf[128]; s = buf; - sprintf(s, "Debug: no documentationString resource for widget %s", + PR_snprintf(s, sizeof(buf),"Debug: no documentationString resource for widget %s", XtName(widget)); } #endif /*DEBUG*/ @@ -3881,7 +3890,7 @@ fe_tooltips_display_stage_two(Widget widget, TipInfo* info) */ static char buf[256]; s = buf; - sprintf(s, "Debug: no tipString resource for widget %s\n" + PR_snprintf(s, sizeof(buf), "Debug: no tipString resource for widget %s\n" "This message only appears in a DEBUG build", XtName(widget)); } @@ -3942,8 +3951,8 @@ fe_tooltips_display_stage_two(Widget widget, TipInfo* info) * geometry spec. No more attack of the killer tomatoes...djw */ { - char buf[128]; - sprintf(buf, "%dx%d", width, height); + char buf[16]; + PR_snprintf(buf, sizeof(buf), "%dx%d", width, height); XtVaSetValues(parent, XmNwidth, width, XmNheight, height, XmNgeometry, buf, 0); } @@ -4084,8 +4093,8 @@ fe_HTMLTips_display_stage_two(Widget widget, HTMLTipData_t* info) * geometry spec. No more attack of the killer tomatoes...djw */ { - char buf[128]; - sprintf(buf, "%dx%d", width, height); + char buf[16]; + PR_snprintf(buf, sizeof(buf),"%dx%d", width, height); XtVaSetValues(parent, XmNwidth, width, XmNheight, height, XmNgeometry, buf, 0); } @@ -5114,6 +5123,13 @@ Boolean fe_ToolTipIsShowing(void) return fe_tooltip_is_showing; } +#ifdef MOZ_MAIL_NEWS +MSG_IMAPUpgradeType FE_PromptIMAPSubscriptionUpgrade(MWContext *context, + const char *hostName) +{ + return fe_promptIMAPSubscriptionUpgrade(context,hostName); +} +#endif /* Get URL for referral if there is one. */ char *fe_GetURLForReferral(History_entry *he) @@ -5132,3 +5148,24 @@ char *fe_GetURLForReferral(History_entry *he) else return NULL; } + +/* + * FEU_StayingAlive + */ +void +FEU_StayingAlive(void) +{ + XtInputMask pending; + + /* Service timers first */ + if ( (pending = XtAppPending(fe_XtAppContext)) ) { + if ( pending & XtIMTimer ) { + XtAppProcessEvent(fe_XtAppContext, XtIMTimer); + } else { + XtAppProcessEvent(fe_XtAppContext, pending); + } + } + + /* Service network connections */ + NET_ProcessNet(0, NET_EVERYTIME_TYPE); +} diff --git a/mozilla/cmd/xfe/xfe.h b/mozilla/cmd/xfe/xfe.h index 79f60038650..e03788bce61 100644 --- a/mozilla/cmd/xfe/xfe.h +++ b/mozilla/cmd/xfe/xfe.h @@ -44,6 +44,7 @@ extern "C" { #undef Bool #endif +#include "rosetta.h" #include #include @@ -138,7 +139,7 @@ extern const char fe_BuildConfiguration[]; extern const char fe_version[]; extern const char fe_long_version[]; extern char *fe_version_and_locale; -extern int fe_SecurityVersion; +HG87265 extern int fe_HaveDNS; extern int fe_VendorAnim; extern char *fe_pidlock; @@ -311,6 +312,7 @@ extern void *fe_dialog (Widget parent, const char *title, const char *text, XP_Bool wait_p, XP_Bool select_p, char **passwd); extern Boolean fe_Confirm_2 (Widget parent, const char *message); +extern void fe_Alert_modal (Widget parent, const char *message); extern void fe_Alert_2 (Widget parent, const char *message); extern void fe_perror_2 (Widget parent, const char *message); extern void fe_UpdateGraph (MWContext *context, Boolean update_text); @@ -749,7 +751,7 @@ typedef struct fe_MailNewsContextData { Widget openNewsHost_shell; Widget openNewsHost_host; Widget openNewsHost_port; - Widget openNewsHost_secure; + HG78272 ReadFileNameCallbackFunction openNewsHost_fn; void *openNewsHost_fnClosure; @@ -906,17 +908,15 @@ typedef struct fe_ContextData Widget toolbar; /* RowColumn containing the toolbar buttons. */ Widget character_toolbar; /* RowColumn containing editor char buttons. */ Widget paragraph_toolbar; /* RowColumn containing editor para buttons. */ - Widget dashboard; /* Form containing the security/thermometer */ + Widget dashboard; /* Form containing the status/thermometer */ /* info at bottom of window.*/ #ifdef LEDGES Widget top_ledge, bottom_ledge; /* Half-implemented fixed areas that */ /* display other URLs. */ #endif -#ifndef NO_SECURITY - Widget security_bar; /* Drawing area for colored security bar. */ - Widget security_logo; /* Label gadget containing security "key" */ - /* icon.*/ -#endif + + HG87921 + #ifdef JAVA Widget show_java; #endif @@ -1112,9 +1112,7 @@ typedef struct fe_ContextData Boolean show_paragraph_toolbar_p; Boolean autoload_images_p; Boolean fancy_ftp_p; -#ifndef NO_SECURITY - Boolean show_security_bar_p; -#endif + HG72881 #ifdef JAVA Boolean show_java_console_p; #endif @@ -1155,7 +1153,7 @@ typedef struct fe_ContextData /* a handle to the current pref dialog being displayed. this is useful if you need to create a modal html dialog as it's - child, as in the case of the security prefs. + child, as in the case of the some prefs. */ Widget currentPrefDialog; struct fe_prefs_data *fep; diff --git a/mozilla/cmd/xfe/xfe_err.h b/mozilla/cmd/xfe/xfe_err.h index 7f5cf5afa48..c9209e726ba 100644 --- a/mozilla/cmd/xfe/xfe_err.h +++ b/mozilla/cmd/xfe/xfe_err.h @@ -1525,6 +1525,44 @@ ResDef(XFE_ABDIR_USE_PASSWD, XFE_ERR_OFFSET + 611, ResDef(NO_SPELL_SHLIB_FOUND, XFE_ERR_OFFSET + 612, "No spellchk library found") +ResDef(XFE_CHOOSE_FOLDER_INSTRUCT, XFE_ERR_OFFSET + 613, + "Choose where you would like your %s messages to be stored:") +ResDef(XFE_FOLDER_ON_SERVER_FORMAT, XFE_ERR_OFFSET + 614, + "Place a copy in folder: '%s' on '%s'") +ResDef(XFE_FOLDER_ON_FORMAT, XFE_ERR_OFFSET + 615, + "Folder '%s' on") +ResDef(XFE_TEMPLATES_ON_SERVER, XFE_ERR_OFFSET + 616, + "Keep templates in '%s' on '%s'") +ResDef(XFE_DRAFTS_ON_SERVER, XFE_ERR_OFFSET + 617, + "Keep drafts in '%s' on '%s'") +ResDef(XFE_MAIL_SELF_FORMAT, XFE_ERR_OFFSET + 618, + "BCC: %s") + +ResDef(XFE_GENERAL_TAB, XFE_ERR_OFFSET + 619, "General") +ResDef(XFE_ADVANCED_TAB, XFE_ERR_OFFSET + 620, "Advanced") +ResDef(XFE_IMAP_TAB, XFE_ERR_OFFSET + 621, "IMAP") +ResDef(XFE_SHARING, XFE_ERR_OFFSET + 622, "Sharing") +ResDef(XFE_ACL_NOT_SUPPORTED, XFE_ERR_OFFSET + 623, + "This server does not support shared folders") +ResDef(XFE_ACL_PERMISSIONS, XFE_ERR_OFFSET + 624, + "You have the following permissions:") +ResDef(XFE_ACL_SHARE_PRIVILEGES, XFE_ERR_OFFSET + 625, + "Share this and other folders with network users \n\ + and display and set access privileges.") +ResDef(XFE_ACL_FOLDER_TYPE, XFE_ERR_OFFSET + 626, + "Folder Type:") + +ResDef(XFE_POP_TAB, XFE_ERR_OFFSET+627, "POP") + +ResDef(XFE_AUTOQUOTE_STYLE_ABOVE, XFE_ERR_OFFSET+628,"above the quoted text") +ResDef(XFE_AUTOQUOTE_STYLE_BELOW, XFE_ERR_OFFSET+629,"below the quoted text") +ResDef(XFE_AUTOQUOTE_STYLE_SELECT,XFE_ERR_OFFSET+630,"select the quoted text") + +ResDef(XFE_NEWSSERVER_DEFAULT, XFE_ERR_OFFSET+631, " (default)") + +ResDef(XFE_FORWARD_INLINE, XFE_ERR_OFFSET+632, "Inline") +ResDef(XFE_FORWARD_QUOTED, XFE_ERR_OFFSET+633, "Quoted") +ResDef(XFE_FORWARD_ATTACH, XFE_ERR_OFFSET+634, "As Attachment") END_STR(mcom_cmd_xfe_xfe_err_h_strings) #endif /* __XFE_XFE_ERR_H_ */ diff --git a/mozilla/config/IRIX.mk b/mozilla/config/IRIX.mk index bf31b460268..81db9c367ad 100644 --- a/mozilla/config/IRIX.mk +++ b/mozilla/config/IRIX.mk @@ -67,7 +67,7 @@ ifeq ($(OS_RELEASE),6) # having multiply defined weak symbols. # # The "-woff 3247" silences complaints about the "#pragma segment" -# stuff strewn all over libneo (apparently for Macintoshes). +# stuff strewn all over db (apparently for Macintoshes). # NO_NOISE = -woff 131 PLATFORM_FLAGS += -multigot -Wl,-nltgot,170 diff --git a/mozilla/config/config.mk b/mozilla/config/config.mk index 51374690c05..8279fb2f863 100644 --- a/mozilla/config/config.mk +++ b/mozilla/config/config.mk @@ -395,8 +395,26 @@ MOZ_JSD = 1 MOZ_COMMUNICATOR_IIDS = 1 MOZ_COMMUNICATOR_CONFIG_JS = 1 MOZ_COPY_ALL_JARS = 1 +ifndef MOZ_SECURITY NO_SECURITY = 1 endif +endif +ifdef MOZ_DARK +DEFINES += -DEDITOR -DMOZ_COMMUNICATOR_IIDS -DMOZ_MAIL_NEWS -DMOZ_OFFLINE \ + -DMOZ_TASKBAR -DMOZ_LDAP -DMOZ_NEO +#-DMOZ_CALENDAR +EDITOR = 1 +MOZ_JSD = 1 +MOZ_COMMUNICATOR_IIDS = 1 +MOZ_COMMUNICATOR_CONFIG_JS = 1 +MOZ_COPY_ALL_JARS = 1 +MOZ_OFFLINE=1 +MOZ_TASKBAR=1 +MOZ_LDAP=1 +MOZ_MAIL_NEWS=1 +#MOZ_CALENDAR=1 +MOZ_NEO=1 +endif ifdef MOZ_GOLD DEFINES += -DGOLD BUILD_GOLD = 1 diff --git a/mozilla/config/liteness.mak b/mozilla/config/liteness.mak index f4a5eafcfd7..1f1d8133eda 100644 --- a/mozilla/config/liteness.mak +++ b/mozilla/config/liteness.mak @@ -31,13 +31,13 @@ # builds by just tweaking this file (and the appropriate file for MAC and UNIX). # # Originally, I planned on defining MOZ_MEDIUM as being the same as MOZ_LITE + EDITOR, -# but there were still many cases in the code and build scripts where I would have had -# to do something ugly like "#if !defined(MOZ_LITE) || defined(MOZ_MEDIUM)". This +# but there were still many cases in the code and build scripts where I would have had +# to do something ugly like "#if !defined(MOZ_LITE) || defined(MOZ_MEDIUM)". This # would be very error prone and difficult to maintain. I believe defining and # using a bunch of new symbols reduces the total amount of pain in both the short and # long term. # -# IMPORTANT!! The method of running a build has not changed. You define +# IMPORTANT!! The method of running a build has not changed. You define # MOZ_LITE or MOZ_MEDIUM (not both) in your environment, and start the build. # You do not have to define the symbols for every module. E.g. you should never # have to define EDITOR, or MOZ_MAIL_NEWS in your environment. The build scripts @@ -49,7 +49,7 @@ ### Some only affect the build scripts, so are only set as environment variables, and ### not added to MOZ_LITENESS_FLAGS # -# MOZ_MAIL_NEWS +# MOZ_MAIL_NEWS # Enables mail and news. # # EDITOR @@ -86,7 +86,7 @@ # Build netcaster. # # MOZ_COMMUNICATOR_IIDS -# For windows, use the COM IIDs for Communicator, as opposed to those for the +# For windows, use the COM IIDs for Communicator, as opposed to those for the # Navigator-only version. We must have a different set so that multiple versions can # be installed on the same machine. We need a more general solution to the problem of # multiple versions of the interface IDs. @@ -94,9 +94,9 @@ # MOZ_COMMUNICATOR_ABOUT # Use the about: information from Communicator, as opposed to that for the Navigator-only # version. We will probably have to make another one for the source-only release. -# +# # MOZ_NAV_BUILD_PREFIX -# For building multiple versions with varying degree of LITEness in the same tree. +# For building multiple versions with varying degree of LITEness in the same tree. # If true, use "Nav" as the prefix for the directory under ns/dist, else use "WIN". # Also, if true, build client in, say, NavDbg as oppposed to x86Dbg. # @@ -128,13 +128,29 @@ MOZ_COMMUNICATOR_IIDS=1 MOZ_COMMUNICATOR_CONFIG_JS=1 MOZ_COPY_ALL_JARS=1 +### MOZ_DARK ### +!elseif defined(MOZ_DARK) +MOZ_LITENESS_FLAGS=-DEDITOR -DMOZ_COMMUNICATOR_IIDS -DMOZ_MAIL_NEWS \ + -DMOZ_OFFLINE -DMOZ_TASKBAR -DMOZ_LDAP +#-DMOZ_CALENDAR +MOZ_MAIL_NEWS=1 +EDITOR=1 +MOZ_JSD=1 +MOZ_COMMUNICATOR_IIDS=1 +MOZ_COMMUNICATOR_CONFIG_JS=1 +MOZ_COPY_ALL_JARS=1 +MOZ_OFFLINE=1 +MOZ_TASKBAR=1 +MOZ_LDAP=1 +#MOZ_CALENDAR=1 ### Full build ### !else MOZ_LITENESS_FLAGS=-DMOZ_MAIL_NEWS -DEDITOR -DMOZ_OFFLINE -DMOZ_LOC_INDEP \ -DMOZ_TASKBAR -DMOZ_LDAP -DMOZ_ADMIN_LIB \ -DMOZ_COMMUNICATOR_NAME -DMOZ_COMMUNICATOR_IIDS \ - -DMOZ_NETCAST -DMOZ_COMMUNICATOR_ABOUT -DMOZ_SPELLCHK + -DMOZ_NETCAST -DMOZ_COMMUNICATOR_ABOUT -DMOZ_SPELLCHK \ + -DMOZ_CALENDAR MOZ_MAIL_NEWS=1 EDITOR=1 MOZ_OFFLINE=1 diff --git a/mozilla/dbm/macbuild/DBM.Prefix b/mozilla/dbm/macbuild/DBM.Prefix index 2f6b68e03d3..3f9ddba77e8 100644 --- a/mozilla/dbm/macbuild/DBM.Prefix +++ b/mozilla/dbm/macbuild/DBM.Prefix @@ -24,5 +24,9 @@ // +<<<<<<< DBM.Prefix #include "MacPrefix.h" #include "DBMConfig.h" +======= +#include "MacPrefix.h" +#include "DBMConfig.h">>>>>>> 3.1.16.1 diff --git a/mozilla/include/MANIFEST b/mozilla/include/MANIFEST index c378948691a..38243a8d520 100644 --- a/mozilla/include/MANIFEST +++ b/mozilla/include/MANIFEST @@ -12,6 +12,7 @@ cgi.h client.h csid.h ctxtfunc.h +cvactive.h dirprefs.h ds.h dserr.h diff --git a/mozilla/include/abcom.h b/mozilla/include/abcom.h index d30e6c6aa1e..cfd9794acc0 100644 --- a/mozilla/include/abcom.h +++ b/mozilla/include/abcom.h @@ -28,24 +28,23 @@ #ifdef XP_CPLUSPLUS class AB_Pane; class AB_ContainerPane; -class AB_ContainerInfo; class AB_MailingListPane; class AB_PersonPane; +class AB_NameCompletionCookie; #else typedef struct AB_Pane AB_Pane; typedef struct AB_ContainerPane AB_ContainerPane; -typedef struct AB_ContainerInfo AB_ContainerInfo; typedef struct AB_MailingListPane AB_MailingListPane; typedef struct AB_PersonPane AB_PersonPane; +typedef struct AB_NameCompletionCookie AB_NameCompletionCookie; #endif XP_BEGIN_PROTOS #define AB_API extern "C" -#if defined(XP_MAC) -#define FE_IMPLEMENTS_SHOW_PROPERTY_SHEET -#endif +/* #define FE_IMPLEMENTS_VISIBLE_NC */ /* as each platform uses the new API, we should set this flag */ +/* #define MOZ_NEWADDR */ /* FE address book developers should uncomment this flag. Leave it commented for the tree */ const ABID AB_ABIDUNKNOWN = 0; /* Find a better home for this somewhere! */ @@ -57,7 +56,15 @@ enum AB_INVALID_PANE, AB_INVALID_CONTAINER, AB_INVALID_ATTRIBUTE, - AB_OUT_OF_MEMORY + AB_OUT_OF_MEMORY, + AB_ENTRY_BEING_FETCHED, /* introduced by virtual list view. all of the get entry attribute APIs can return this error code + whenever we have to go get the desired result. In other words, it means the get is now asynch! */ + AB_INVALID_COMMAND, /* returned by AB_Command and AB_GetCommandStatus when the pane you passed in does not accept the cmd you + wanted. */ + ABError_NullPointer, /* I'm trying to switch over to this new error model.....*/ + ABError_InvalidAttribute, /* I'm trying to switch over to this new error model.....*/ + ABError_UnknownFileFormat /* returned when you try to import a file type the address book does not recognize */ + }; /* these are the types of possible containers */ @@ -65,7 +72,8 @@ typedef enum { AB_LDAPContainer, AB_MListContainer, /* a mailing list */ - AB_PABContainer /* a personal AB */ + AB_PABContainer, /* a personal AB */ + AB_UnknownContainer /* when we don't know what container type it is! */ } AB_ContainerType; /* AB_ContainerAttributes define the types of information FEs can ask the BE about @@ -96,7 +104,7 @@ typedef enum AB_Drag_Not_Allowed = 0x00000000, AB_Require_Copy = 0x00000001, AB_Require_Move = 0x00000002, - AB_Default_Drag = 0xFFFFFFFF + AB_Default_Drag = -1 /* 0xFFFFFFFF */ } AB_DragEffect; typedef enum @@ -105,8 +113,10 @@ typedef enum AB_attribEntryType, /* mailing list or person entry */ AB_attribEntryID, AB_attribFullName, + AB_attribFullAddress, /* RFC822 address for an entry.....i.e. "John Smith " */ + AB_attribVCard, /* get the Vcard for an attribute */ AB_attribNickName, - AB_attribGivenName, /* all of the following are person entry specific */ + AB_attribGivenName, AB_attribMiddleName, AB_attribFamilyName, AB_attribCompanyName, @@ -135,16 +145,10 @@ typedef enum AB_attribOther /* any attrib with this value or higher is always a string type (our dyanmic attributes) */ } AB_AttribID; -/* WARNING!!! WILL BE PHASING THIS STRUCTURE OUT!!!! */ -typedef struct AB_EntryAttributeItem{ - AB_AttribID id; - char * description; /* resource string specifying a user-readable descript for the attrib i.e. "First Name" */ - XP_Bool sortable; /* is this attribute sortable? (may help FEs display the column if they know if it can be sorted or not */ -}AB_EntryAttributeItem; - typedef enum{ AB_MailingList = 0, - AB_Person + AB_Person, + AB_NakedAddress } AB_EntryType; typedef struct AB_AttributeValue @@ -158,8 +162,13 @@ typedef struct AB_AttributeValue } u; } AB_AttributeValue; +typedef struct AB_EntryAttributeItem{ + AB_AttribID id; + char * description; /* resource string specifying a user-readable descr */ + XP_Bool sortable; /* is this attribute sortable? (may help FEs displa */ +} AB_EntryAttributeItem; -/* New Column ID structure used to abstract the columns in the AB_Pane used by the FEs from the attributes thos columns actually +/* New Column ID structure used to abstract the columns in the AB_Pane used by the FEs from the attributes those columns actually represent. */ typedef enum{ AB_ColumnID0 = 0, @@ -179,6 +188,28 @@ typedef struct AB_ColumnInfo{ } AB_ColumnInfo; +/********************************************************************************************* + A poor man's msgCopyInfo struct. We use this to encapsulate any data we may need when + running copy / move urls in the address book. The creator of the URL acquires each ctr + and the url handler releases the containers when the url is done or interrupted +**********************************************************************************************/ +typedef enum{ + AB_CopyInfoCopy = 0 , + AB_CopyInfoMove, + AB_CopyInfoDelete +} AB_AddressCopyInfoState; + +typedef struct _AB_AddressBookCopyInfo +{ + AB_ContainerInfo * destContainer; + AB_ContainerInfo * srcContainer; + ABID * idArray; + int32 numItems; + AB_AddressCopyInfoState state; /* used to determine what type of action to perform on the entries */ +} AB_AddressBookCopyInfo; + +int AB_FreeAddressBookCopyInfo(AB_AddressBookCopyInfo * abCopyInfo); /* use this to free copy info structs */ + /********************************************************************************************** FE Call back functions. We'll show the types here...NOTE: FEs must now register their call back functions through these APIs so the back end knows which return to use. @@ -187,7 +218,6 @@ functions through these APIs so the back end knows which return to use. /* FEs must register this function with the appropriate pane, it is called by the back end in response to the following commands: AB_PropertiesCmd, AB_AddUserCmd, AB_AddMailingListCmd */ -/* typedef int AB_ShowPropertySheetForEntryFunc (MSG_Pane * pane, AB_EntryType entryType); */ typedef int AB_ShowPropertySheetForEntryFunc (MSG_Pane * pane, MWContext * context); int AB_SetShowPropertySheetForEntryFunc( @@ -199,32 +229,133 @@ int AB_SetShowPropertySheetForEntryFunc( pane. It is called by the back end in response to the following commands: AB_PropertiesCmd, AB_NewLDAPDirectory, AB_NewAddressBook. */ -typedef int AB_ShowPropertySheetForDirFunc(DIR_Server * server, MWContext * context, XP_Bool newDirectory /* is it a new directory? */); +typedef int AB_ShowPropertySheetForDirFunc( + DIR_Server * server, + MWContext * context, + MSG_Pane * srcPane, /* BE will pass in the pane that was used to generate this call (usually the container pane) */ + XP_Bool newDirectory /* is it a new directory? */); int AB_SetShowPropertySheetForDirFunc( MSG_Pane * abcPane, /* container pane */ AB_ShowPropertySheetForDirFunc * func); - -/*************************************************************************************** -DON'T USE THIS FUNCTION!!!! THIS WILL BE PHASING OUT!!!!!! #mscott 01/21/98 - This is a callback into the FE instructing them to bring up a person entry pane or a - mailing list pane. The back end has already created the pane. A type is included to let the FE - determine if the pane is a mailing list or person entry pane. In addition, in the case of a mailing list - pane, the FE must still initialize the mailing list pane before it can be used - ***************************************************************************************/ -#ifdef FE_IMPLEMENTS_SHOW_PROPERTY_SHEET -extern int FE_ShowPropertySheetForAB2( - MSG_Pane * pane, /* BE created mailing list or person entry pane */ - AB_EntryType entryType); /* mailing list or person entry */ -#endif - /*************************************************************************************** None pane-specific APIs. These function work on many panes ***************************************************************************************/ int AB_ClosePane(MSG_Pane * pane); +/*************************************************************************************** + Virtual List View APIs. +****************************************************************************************/ + +int AB_SetFEPageSizeForPane( + MSG_Pane * abPane, + uint32 pageSize); /* number of entries in the FE pane's view. That is, total # entries + the FE is concerned with at a time */ + +/*************************************************************************************** + Selection APIs. +****************************************************************************************/ +XP_Bool AB_UseExtendedSelection( + MSG_Pane * pane); +int AB_AddSelection( + MSG_Pane * pane, + MSG_ViewIndex index); /* index of entry to add selection for */ +XP_Bool AB_IsSelected( + MSG_Pane * pane, + MSG_ViewIndex index); /* index of entry to check for selection */ +int AB_RemoveSelection( + MSG_Pane * pane, + MSG_ViewIndex index); /* index of entry to remove selection for */ +void AB_RemoveAllSelections( + MSG_Pane * pane); + +/*************************************************************************************** + Replication APIs and Types. +****************************************************************************************/ + +AB_ContainerInfo *AB_BeginReplication(MWContext *context, DIR_Server *server); +int AB_EndReplication(AB_ContainerInfo *container); +int AB_AddReplicaEntry(AB_ContainerInfo *container, char **valueList); +int AB_DeleteReplicaEntry(AB_ContainerInfo *container, char *targetDn); +int AB_RemoveReplicaEntries(AB_ContainerInfo *container); +int AB_GetNumReplicaAttributes(AB_ContainerInfo *container); +char **AB_GetReplicaAttributeNames(AB_ContainerInfo *container); +XP_Bool AB_ReplicaAttributeMatchesId(AB_ContainerInfo *container, int attribIndex, DIR_AttributeId id); + +/*************************************************************************************** + Type down and name completion APIs. Both actions are asynchronous. Type down generates + a MSG_PaneNotifyTypeDownCompleted pane notification and name completion calls a FE + regsitered call back. +****************************************************************************************/ +int AB_TypedownSearch( + MSG_Pane * abPane, /* AB_Pane we are doing the type down against */ + const char * typedownValue, /* NULL terminated character string for type down value. Caller frees */ + MSG_ViewIndex startIndex); /* if this is a refined typedown search, insert the start index. Else MSG_VIEWINDEXNONE */ + + +typedef int AB_NameCompletionExitFunction( + AB_NameCompletionCookie * cookie, /* object which encapsulates name completion result */ + int numResults, /* number results we had. Result string is NULL if this is 0 or > 1 */ + void * FEcookie); /* whatever you passed into the type down call, we pass back to you here */ + +#ifdef FE_IMPLEMENTS_VISIBLE_NC +int AB_NameCompletionSearch( + MSG_Pane * NCResolutionPane, /* the picker pane to fill the results with */ + const char * completionValue, /* partial string to perform auto-complete on */ + AB_NameCompletionExitFunction * exitFunction, /* FE exit function BE calls when asynch op is done */ + XP_Bool userSeesPane, /* back end has different search behavior if the pane is currently visible to the user */ + void * FEcookie); /* FE can pass in the address of the object asking for the name completion. Will return in exit func */ +#else +int AB_NameCompletionSearch( + MSG_Pane * NCResolutionPane, /* the picker pane to fill the results with */ + const char * completionValue, /* partial string to perform auto-complete on */ + AB_NameCompletionExitFunction * exitFunction, /* FE exit function BE calls when asynch op is done */ + void * FEcookie); /* FE can pass in the address of the object asking for the name completion. Will return in exit func */ +#endif + +/**************************************************************************************** + Name completion returns a name completion cookie. These APIs are used to extract + the various string components from the name completion cookie +*****************************************************************************************/ + +/* NC Display string is the "blurr" string you see in the composition pane. It could include + extra column attributes like company and department as determined by a pref */ +char * AB_GetNameCompletionDisplayString(AB_NameCompletionCookie * cookie); + +/* Header String is the string the composer should insert into the composition pane. It could +be the name of a mailing list: "testList" or a user: "John Doe " */ +char * AB_GetHeaderString(AB_NameCompletionCookie * cookie); + +/* getting the expanded header string returns the display string unless the entry was a mailing + list in which case you get addresses for all the people in the mailing list. */ +char * AB_GetExpandedHeaderString(AB_NameCompletionCookie * cookie); + +AB_EntryType AB_GetEntryTypeForNCCookie(AB_NameCompletionCookie * cookie); + +int AB_FreeNameCompletionCookie(AB_NameCompletionCookie * cookie); + +/**************************************************************************************** + Name completion resolution pane specific APIs. +*****************************************************************************************/ +int AB_CreateABPickerPane( /* bad terminology on my part...you are really creating a name completion resolution picker pane */ + MSG_Pane ** NCResolutionPane, /* BE creates one and passes it back to FE here */ + MWContext * context, + MSG_Master * master, + uint32 pageSize); /* what is your page size going to be */ + +AB_ContainerType AB_GetEntryContainerType( + MSG_Pane * abPickerPane, + MSG_ViewIndex index); /* the name completion result index you want the type for... */ + +AB_NameCompletionCookie * AB_GetNameCompletionCookieForIndex( + MSG_Pane * abPickerPane, + MSG_ViewIndex index); /* NC result index you want the type for */ + +/* returns a cookie for the naked address including the default domain name...*/ +AB_NameCompletionCookie * AB_GetNameCompletionCookieForNakedAddress(const char * nakedAddress); + /**************************************************************************************** Address Book Pane General APIs - creating, initializing, closing, changing containers, searching, etc. @@ -266,14 +397,15 @@ int AB_LDAPSearchResultsAB2( int AB_FinishSearchAB2(MSG_Pane * abPane); + int AB_CommandAB2( - MSG_Pane * srcPane, /* NOTE: this can be a ABpane or an ABContainerPane!!! you can delete containers & entries */ - AB_CommandType command, /* delete or mailto are the only currently supported commands */ + MSG_Pane * srcPane, + AB_CommandType command, MSG_ViewIndex * indices, int32 numIndices); int AB_CommandStatusAB2( - MSG_Pane * srcPane, /* NOTE: Can be an ABPane or an ABContainerPane!! */ + MSG_Pane * srcPane, AB_CommandType command, MSG_ViewIndex * indices, int32 numIndices, @@ -282,8 +414,6 @@ int AB_CommandStatusAB2( const char ** displayString, XP_Bool * plural_p); -/* still need to add registering and unregistering compose windows */ - /**************************************************************************************** AB_ContainerInfo General APIs - adding users and a sender. Doesn't require a pane. *****************************************************************************************/ @@ -294,16 +424,25 @@ int AB_AddUserAB2( ABID * entryID); /* BE returns the ABID for this new user */ int AB_AddUserWithUIAB2( + MSG_Pane* pane, /* we need the src pane because it has the call back function for the person property sheet */ AB_ContainerInfo * abContainer, AB_AttributeValue * values, uint16 numItems, XP_Bool lastOneToAdd); int AB_AddSenderAB2( + MSG_Pane * pane, /* need the pane to get the property sheet function and context */ AB_ContainerInfo * abContainer, - char * author, - char * url); + const char * author, + const char * url); +/* the following is called by the msgdbview when it wants to add a name and a address to the specified container */ +int AB_AddNameAndAddress( + MSG_Pane * pane, + AB_ContainerInfo * abContainer, + const char *name, + const char *address, + XP_Bool lastOneToAdd); /**************************************************************************************** Drag and Drop Related APIs - vcards, ab lines, containers, etc. @@ -325,24 +464,80 @@ AB_DragEffect AB_DragEntriesIntoContainerStatus( AB_ContainerInfo * destContainer, AB_DragEffect request); /* do you want to do a move? a copy? default drag? */ +/*************************************************************************************** + + Asynchronous copy APIs. These APIs are used by mkabook.cpp for asycnh copy/move/delete + entry operations between containers. + +***************************************************************************************/ + +/* this API is called only by the back end...it is used to do all the dirty work for + assembling a addbook-copy url and adding it to a queue for running */ +int AB_CreateAndRunCopyInfoUrl( + MSG_Pane * pane, + AB_ContainerInfo * srcContainer, + ABID * idArray, + int32 numItems, + AB_ContainerInfo * destContainer, + AB_AddressCopyInfoState action); + +int AB_BeginEntryCopy( + AB_ContainerInfo * srcContainer, + MWContext * context, + AB_AddressBookCopyInfo * copyInfo, + void ** copyCookie, /* filled by container, position in IDArray to be copied next */ + XP_Bool * copyFinished); /* container sets to TRUE if copy is finished */ + +int AB_MoreEntryCopy( + AB_ContainerInfo * srcContainer, + MWContext * context, + AB_AddressBookCopyInfo * copyInfo, + void ** copyCookie, + XP_Bool * copyFinished); + +int AB_FinishEntryCopy( + AB_ContainerInfo * srcContainer, + MWContext * context, + AB_AddressBookCopyInfo * copyInfo, + void ** copyCookie); + +int AB_InterruptEntryCopy( + AB_ContainerInfo * srcContainer, + MWContext * context, + AB_AddressBookCopyInfo * copyInfo, + void ** copyCookie); + /**************************************************************************************** Importing and Exporting - ABs from files, vcards... *****************************************************************************************/ typedef enum { - AB_Filename, /* char * in import and export APIs contain an FE allocated/freed filename */ + AB_Filename = 0, /* char * in import and export APIs contain an FE allocated/freed filename */ AB_PromptForFileName, /* prompt for file name on import or export */ AB_Vcard, AB_CommaList, /* comma separated list of email addresses */ AB_RawData /* we don't know what it is, will try to extract email addresses */ } AB_ImportExportType; +/* Note, besides the usual suspects for error return values, AB_ImportData can also return ABError_UnknownFileFormat + when the address book does not recognize the import file type. In certain cases, the caller may try to import + the unrecognized file format by calling a third party import utiltity. */ +#ifdef FE_IMPLEMENTS_NEW_IMPORT int AB_ImportData( + MSG_Pane * pane, /* we need a pane in order to get the url queue */ AB_ContainerInfo * destContainer, - const char * buffer, /* could be a filename or NULL (if type = prompt for filename) or a block of data to be imported */ + const char * buffer, /* could be a full path or NULL (if type = prompt for filename) or a block of data to be imported */ int32 bufSize, /* how big is the buffer? */ AB_ImportExportType dataType); /* valid types: All */ +#else +int AB_ImportData( + AB_ContainerInfo * destContainer, + const char * buffer, /* could be a full path or NULL (if type = prompt for filename) or a block of data to be imported */ + int32 bufSize, /* how big is the buffer? */ + AB_ImportExportType dataType); /* valid types: All */ + +#endif /* returns TRUE if the container accepts imports of the data type and FALSE otherwise */ XP_Bool AB_ImportDataStatus( @@ -358,8 +553,72 @@ int AB_ExportData( int32 * bufSize, /* ignored unless VCard is data type in which case FE allocates, BE fills */ AB_ImportExportType dataType); /* valid types: filename, prompt for filename, vcard */ +/*** Import and Export APIs used in libnet to perform these operations asynchronously...***/ +int AB_ImportBegin( + AB_ContainerInfo * container, + MWContext * context, + const char * fileName, + void ** importCookie, /* used by container to keep track of the import state */ + XP_Bool * importFinished); /* set to TRUE by container if we finished the import */ + +int AB_ImportMore( + AB_ContainerInfo * container, + void ** importCookie, /* used by container to keep track of the import state */ + XP_Bool * importFinished); + +int AB_ImportInterrupt( + AB_ContainerInfo * container, + void ** importCookie); + +int AB_ImportFinish( + AB_ContainerInfo * container, + void ** importCookie); + +int AB_ImportProgress( + AB_ContainerInfo * container, + void * importCookie, + uint32 * position, /* the line we are on in the file */ + uint32 * fileLength, /* total # of lines in the file */ + uint32 * passCount); /* the pass we are on (out of 2) */ + +int AB_ExportBegin( + AB_ContainerInfo * container, + MWContext * context, + const char * fileName, + void ** exportCookie, /* used by container info to keep track of the export state */ + XP_Bool * exportFinished); /* set to TRUE by container if the export has finished */ + +int AB_ExportMore( + AB_ContainerInfo * container, + void ** exportCookie, + XP_Bool * exportFinished); + +int AB_ExportInterrupt( + AB_ContainerInfo * container, + void ** exportCookie); + +int AB_ExportFinish( + AB_ContainerInfo * container, + void ** exportCookie); + +int AB_ExportProgress( + AB_ContainerInfo * container, + void * exportCookie, + uint32 * numberExported, /* # of entries in the container we have exported so far */ + uint32 * totalEntries); /* total # of entries in the address book */ + +/* used only in the back end to generate add ldap to abook urls and adds them to the url queue... + For each entry, we fire off an ldap url to fetch its attributes..*/ +int AB_ImportLDAPEntriesIntoContainer( + MSG_Pane * pane, /* source pane */ + const MSG_ViewIndex * indices, /* selected indices in the src pane to add */ + int32 numIndices, + AB_ContainerInfo * destContainer); /* destination container to add the selections too */ + /**************************************************************************************** -ABContainer Pane --> Creation, Loading, getting line data for each container. + + ABContainer Pane --> Creation, Loading, getting line data for each container. + *****************************************************************************************/ int AB_CreateContainerPane( MSG_Pane ** abContainerPane, /* BE will pass back ptr to pane through this */ @@ -375,7 +634,7 @@ MSG_ViewIndex AB_GetIndexForContainer( /* this will return NULL if the index is invalid */ AB_ContainerInfo * AB_GetContainerForIndex( - MSG_Pane * abContainerPane, + MSG_Pane * abContainerPane, const MSG_ViewIndex index); /* the following set of APIs support getting/setting container pane line data out such as the container's @@ -466,20 +725,6 @@ int AB_UpdateDIRServerForContainerPane( MSG_Pane * abContainerPane, DIR_Server * directory); - -/******************************************************************************************************************* - Old Column Header APIs. These will be phased out!!! Please don't use them - ******************************************************************************************************************/ - -int AB_GetNumEntryAttributesForContainer( - AB_ContainerInfo * container, - uint16 * numItems); /* BE will fill this integer with the number of available attributes for the container */ - -int AB_GetEntryAttributesForContainer( - AB_ContainerInfo * container, - AB_EntryAttributeItem * items, /* FE allocated array which BE fills with values */ - uint16 * maxItems); /* FE passes in # elements allocated in array. BE returns # elements filled in array */ - /******************************************************************************************************************** Our New Column Header APIs. We'll be phasing out AB_GetNumEntryAttributesForContainer and AB_GetEntryAttributesForContainer ********************************************************************************************************************/ @@ -495,6 +740,18 @@ int AB_GetColumnAttribIDs( AB_AttribID * attribIDs, /* FE allocated array of attribs. BE fills with values */ int * numAttribs); /* FE passes in # elements allocated in array. BE returns # elements filled */ +/* we also have pane versions which are used by the picker pane */ +AB_ColumnInfo * AB_GetColumnInfoForPane( + MSG_Pane * abPickerPane, + AB_ColumnID columnID); /* ID for the column you want the info for */ + +int AB_GetNumColumnsForPane(MSG_Pane * abPickerPane); + +int AB_GetColumnAttribIDsForPane( + MSG_Pane * abPickerPane, + AB_AttribID * attribIDs, /* FE allocated array of attribs. BE fills with values */ + int * numAttribs); /* FE passes in # elements allocated in array. BE returns # elements filled */ + int AB_FreeColumnInfo(AB_ColumnInfo * columnInfo); /**************************************************************************************** @@ -560,6 +817,23 @@ int AB_CopyEntryAttributeValue( AB_AttributeValue * srcValue, /* already allocated attribute value you want to copy from */ AB_AttributeValue * destValue); /* already allocated attribute value you want to copy into */ +/* Assigns a default value for the given attribute and stores it in the attribute value passed in */ +int AB_CopyDefaultAttributeValue( + AB_AttribID attrib, + AB_AttributeValue * value /* already allocated */); + +/* I think this API is used only by the back end...*/ +int AB_CreateAttributeValuesForNakedAddress( + char * nakedAddress, + AB_AttributeValue ** valueArray, /* caller must free returned array */ + uint16 * numItems); + +int AB_GetAttributesForNakedAddress( + char * nakedAddress, + AB_AttribID * attribs, /* caller allocated array of attribs that you want */ + AB_AttributeValue ** values, /* BE allocates & fills an array of values for the input array of attribs.Caller ust later free */ + uint16 * numItems); /* IN: size of attribs array. OUT: # of values in value array */ + XP_Bool AB_IsStringEntryAttributeValue(AB_AttributeValue * value); /**************************************************************************************** @@ -596,6 +870,19 @@ int AB_InitializeMailingListPaneAB2(MSG_Pane * mailingListPane); AB_ContainerInfo * AB_GetContainerForMailingList(MSG_Pane * mailingListPane); +/* Use these two APIs to add entries to the mailing list that are the result of name completion. */ +int AB_AddNakedEntryToMailingList( + MSG_Pane * mailingListPane, + const MSG_ViewIndex index, /* index in pane to add the element at. Use MSG_VIEWINDEXNONE to signify don't care */ + const char * nakedAddress, /* entry was not a name completion match, but a naked adddress */ + XP_Bool ReplaceExisting); /* TRUE if replace current entry, FALSE for inserting */ + +int AB_AddNCEntryToMailingList( + MSG_Pane * mailingListPane, + const MSG_ViewIndex index, + AB_NameCompletionCookie * cookie, /* result from name completion code. FE must still free the cookie */ + XP_Bool ReplaceExisting); + /* this could return ABID = 0 for a new entry that is not in the database */ ABID AB_GetABIDForMailingListIndex( MSG_Pane * mailingListPane, @@ -659,6 +946,66 @@ int AB_GetPersonEntryAttributes( int AB_CommitChanges(MSG_Pane * pane); /* commits changes to a mailing list pane or a person entry pane! */ + +/* FEs should use this to obtain a property sheet pane representing the user's identity vcard...*/ +int AB_GetIdentityPropertySheet( + MWContext *context, + MSG_Master * master, + MSG_Pane ** pane); + +/********************************************************************************************** + Miscellaneous APIs which need to be public to folks outside of libaddr. Not necessarily + used by the FES.. + +***********************************************************************************************/ + +int AB_SplitFullName ( + const char *fullName, + char **firstName, + char **lastName, + int16 csid); + +/* use the default display name API for generating a display name in the person property sheet card for new users */ +int AB_GenerateDefaultDisplayName( + const char * firstName, + const char * lastName, + char ** defaultDisplayName /* calller must free with XP_FREE */); + +XP_List * AB_AcquireAddressBookContainers(MWContext * context); + +int AB_ReleaseContainersList(XP_List * containers); + +int AB_AcquireContainer(AB_ContainerInfo * container); +int AB_ReleaseContainer(AB_ContainerInfo * container); + +/* should not be called by FEs....they should use AB_ImportData..... + This function iterates over all of the vcard objects in the string and adds each one to the container +*/ +int AB_ImportVCards( + AB_ContainerInfo * destContainer, + const char * vCardString); + +/* the following are only used in libaddr...not by the FEs...*/ +int AB_ConvertVCardToAttribValues( /* import.cpp */ + const char * vCard, + AB_AttributeValue ** values, /* function allocates, caller must free */ + uint16 * numItems); + +int AB_ConvertAttribValuesToVCard( /* export.cpp */ + AB_AttributeValue * values, + uint16 numItems, + char **VCard); /* function allocates...caller must free with XP_FREE */ + +int AB_ExportVCardToPrefs(const char * VCardString); /* import.cpp */ + +/* Used by libmsg compose pane to attach a vcard file to the message */ +int AB_ExportVCardToTempFile ( /* export.cpp */ + const char * vCard, + char** filename); + +/* used to load the current user's vcard from preferences. Caller must free */ +int AB_LoadIdentityVCard(char ** IdentityVCard); /* import.cpp */ + XP_END_PROTOS #endif /* _AB_COM_H */ diff --git a/mozilla/include/abdefn.h b/mozilla/include/abdefn.h index 13cfe2574cd..2fc69538255 100644 --- a/mozilla/include/abdefn.h +++ b/mozilla/include/abdefn.h @@ -135,6 +135,8 @@ typedef enum AB_SaveCmd, /* export to a file */ + AB_ExportCmd, /* same as AB_SaveCmd, but I like export better...*/ + AB_CloseCmd, /* close the address book window */ AB_NewAddressBook, /* Create a new personal address book */ diff --git a/mozilla/include/allxpstr.h b/mozilla/include/allxpstr.h index 289d37beace..7dd1546cfe3 100644 --- a/mozilla/include/allxpstr.h +++ b/mozilla/include/allxpstr.h @@ -19,16 +19,16 @@ #if defined(FEATURE_CUSTOM_BRAND) #include "xp_brand.h" #else -#define MOZ_NAME_PRODUCT "Mozilla" -#define MOZ_NAME_BRAND "Mozilla" -#define MOZ_NAME_FULL "Mozilla Navigator" -#define MOZ_NAME_COMPANY "Netscape Communications Corp" +#define MOZ_NAME_PRODUCT "Mozilla" +#define MOZ_NAME_BRAND "Mozilla" +#define MOZ_NAME_FULL "Mozilla Navigator" +#define MOZ_NAME_COMPANY "Netscape Communications Corp" #endif /* FEATURE_CUSTOM_BRAND */ /* ** Cross platform error codes. These are system errors, library errors, -** etc. The ranges of error messages are displayed in the following table: +** etc. The ranges of error messages are displayed in the following table: ** ** actual 7000 added category ** low high low high @@ -45,18 +45,26 @@ ** 25769 27500 32769 34500 Win FE ** 50000 58000 57000 65000 secerr, sslerr (Win) ** -** Newbie NOTE: allxpstr.c and allxpstr.rc are exactly the same file. -** Edit only one and cvs update the other one. rc is for windows build. -** +** JRM note 98/04/01. The table above has little in common with reality. +** moreover, as a scheme, it is quite unworkable on Macintosh, where the +** legal range for resource ids is 128-0x7FFF. This restricts the range +** from the min to the max to be around 16000. This was exacerbated by +** the security people staking out ranges such as -0x3000..-0x2000. So +** if anybody's wondering why I messed with these ranges for XP_MAC, now +** you know. */ #ifndef _ALLXPSTR_H_ #define _ALLXPSTR_H_ #include "resdef.h" -#define XP_MSG_BASE 15000 -#define SEC_DIALOG_STRING_BASE (XP_MSG_BASE + 8000) - +#ifdef XP_MAC +#define XP_MSG_BASE 1000 +#define SEC_DIALOG_STRING_BASE 3000 +#else +#define XP_MSG_BASE 14000 +#define SEC_DIALOG_STRING_BASE (XP_MSG_BASE + 2000) +#endif /* WARNING: DO NOT TAKE ERROR CODE -666, it is used internally by the message lib */ @@ -66,13 +74,13 @@ RES_START BEGIN_STR(mcom_include_merrors_i_strings) -/* #define MK_HTTP_TYPE_CONFLICT -204 */ +/* #define MK_HTTP_TYPE_CONFLICT -204 */ ResDef(MK_HTTP_TYPE_CONFLICT, -204, "A communications error occurred.\n\ (TCP Error: %s)\n\n\ Try connecting again.") -/* #define MK_BAD_CONNECT -205 */ +/* #define MK_BAD_CONNECT -205 */ ResDef(MK_BAD_CONNECT, -205, MOZ_NAME_BRAND" is unable to connect to the server at\n\ the location you have specified. The server may\n\ @@ -80,13 +88,13 @@ be down or busy.\n\n\ Try connecting again later.") /* #define MK_TCP_ERROR -206 */ -ResDef(MK_TCP_ERROR, -206, +ResDef(MK_TCP_ERROR, -206, "A communications error occurred.\n\ (TCP Error: %s)\n\n\ Try connecting again.") #ifdef XP_MAC -/* #define MK_OUT_OF_MEMORY -207 */ +/* #define MK_OUT_OF_MEMORY -207 */ ResDef(MK_OUT_OF_MEMORY , -207, MOZ_NAME_BRAND" is out of memory.\n\n\ Try quitting "MOZ_NAME_PRODUCT" and increasing its minimum memory\n\ @@ -100,17 +108,17 @@ some windows.") #endif -/* #define MK_MALFORMED_URL_ERROR -209 */ +/* #define MK_MALFORMED_URL_ERROR -209 */ ResDef(MK_MALFORMED_URL_ERROR, -209, "This Location (URL) is not recognized:\n\ %.200s\n\n\ Check the Location and try again.") -/* #define MK_UNABLE_TO_USE_PASV_FTP -211 */ +/* #define MK_UNABLE_TO_USE_PASV_FTP -211 */ ResDef(MK_UNABLE_TO_USE_PASV_FTP, -211, "Unable to use FTP passive mode") -/* #define MK_UNABLE_TO_CHANGE_FTP_MODE -212 */ +/* #define MK_UNABLE_TO_CHANGE_FTP_MODE -212 */ ResDef(MK_UNABLE_TO_CHANGE_FTP_MODE , -212, MOZ_NAME_BRAND" is unable to set the FTP transfer mode with\n\ this server. You will not be able to download files.\n\n\ @@ -118,7 +126,7 @@ You should contact the administrator for this server\n\ or try again later.") -/* #define MK_UNABLE_TO_FTP_CWD -213 */ +/* #define MK_UNABLE_TO_FTP_CWD -213 */ ResDef(MK_UNABLE_TO_FTP_CWD, -213, MOZ_NAME_BRAND" is unable to send the change directory (cd)\n\ command, to the FTP server. You cannot view another\n\ @@ -127,7 +135,7 @@ You should contact the administrator for this server\n\ or try again later.") -/* #define MK_UNABLE_TO_SEND_PORT_COMMAND -214 */ +/* #define MK_UNABLE_TO_SEND_PORT_COMMAND -214 */ ResDef(MK_UNABLE_TO_SEND_PORT_COMMAND, -214, MOZ_NAME_BRAND" is unable to send a port command to the FTP\n\ server to establish a data connection.\n\n\ @@ -135,25 +143,25 @@ You should contact the administrator for this server\n\ or try again later.") -/* #define MK_UNABLE_TO_LOCATE_FILE -215 */ +/* #define MK_UNABLE_TO_LOCATE_FILE -215 */ ResDef(MK_UNABLE_TO_LOCATE_FILE, -215, -MOZ_NAME_BRAND" is unable to find the file or directory named:\n\ - %.200s\n\n\ +MOZ_NAME_BRAND" is unable to find the file or directory\n\ +named %.200s.\n\n\ Check the name and try again.") -/* #define MK_BAD_NNTP_CONNECTION -216 */ +/* #define MK_BAD_NNTP_CONNECTION -216 */ ResDef(MK_BAD_NNTP_CONNECTION, -216, "A News error occurred: Invalid NNTP connection\n\n\ Try connecting again.") -/* #define MK_NNTP_SERVER_ERROR -217 */ +/* #define MK_NNTP_SERVER_ERROR -217 */ ResDef(MK_NNTP_SERVER_ERROR, -217, "An error occurred with the News server.\n\n\ If you are unable to connect again, contact the\n\ administrator for this server.") -/* #define MK_SERVER_TIMEOUT -218 */ +/* #define MK_SERVER_TIMEOUT -218 */ ResDef(MK_SERVER_TIMEOUT, -218, "There was no response. The server could be down\n\ or is not responding.\n\n\ @@ -161,7 +169,7 @@ If you are unable to connect again later, contact\n\ the server's administrator.") -/* #define MK_UNABLE_TO_LOCATE_HOST -219 */ +/* #define MK_UNABLE_TO_LOCATE_HOST -219 */ ResDef(MK_UNABLE_TO_LOCATE_HOST, -219, MOZ_NAME_BRAND" is unable to locate the server:\n\ %.200s\n\ @@ -169,38 +177,38 @@ The server does not have a DNS entry.\n\n\ Check the server name in the Location (URL)\n\ and try again.") -/* #define MK_SERVER_DISCONNECTED -220 */ +/* #define MK_SERVER_DISCONNECTED -220 */ ResDef(MK_SERVER_DISCONNECTED, -220, "The server has disconnected.\n\ The server may have gone down or there may be a\n\ network problem.\n\n\ Try connecting again.") -/* #define MK_NEWS_ITEM_UNAVAILABLE -221 */ +/* #define MK_NEWS_ITEM_UNAVAILABLE -221 */ ResDef(MK_NEWS_ITEM_UNAVAILABLE, -221, -"The Discussion item is unavailable. It may have expired.\n\n\ +"The Newsgroup item is unavailable. It may have expired.\n\n\ Try retrieving another item.") -/* #define MK_UNABLE_TO_OPEN_NEWSRC -222 */ +/* #define MK_UNABLE_TO_OPEN_NEWSRC -222 */ ResDef(MK_UNABLE_TO_OPEN_NEWSRC, -222, MOZ_NAME_BRAND" is unable to open your News file (newsrc).\n\n\ -Please verify that your Mail and Groups preferences are\n\ +Please verify that your Mail and News preferences are\n\ correct and try again.") -/* #define MK_UNABLE_TO_OPEN_FILE -223 */ +/* #define MK_UNABLE_TO_OPEN_FILE -223 */ ResDef(MK_UNABLE_TO_OPEN_FILE, -223, -MOZ_NAME_BRAND" is unable to open the file:\n\ - %.200s\n\n\ +MOZ_NAME_BRAND" is unable to open the file \n\ +%.200s.\n\n\ Check the file name and try again.") -/* #define MK_TCP_WRITE_ERROR -236 */ +/* #define MK_TCP_WRITE_ERROR -236 */ ResDef(MK_TCP_WRITE_ERROR, -236, "A network error occurred while "MOZ_NAME_PRODUCT"\n\ was sending data.\n(Network Error: %s)\n\n\ Try connecting again.") -/* #define MK_COULD_NOT_LOGIN_TO_SMTP_SERVER -229 */ +/* #define MK_COULD_NOT_LOGIN_TO_SMTP_SERVER -229 */ ResDef(MK_COULD_NOT_LOGIN_TO_SMTP_SERVER, -229, "An error occurred sending mail:\n\ "MOZ_NAME_PRODUCT" was unable to connect to the SMTP server.\n\ @@ -209,41 +217,41 @@ Please verify that your Mail preferences are correct\n\ and try again.") -/* #define MK_ERROR_SENDING_FROM_COMMAND -230 */ +/* #define MK_ERROR_SENDING_FROM_COMMAND -230 */ ResDef(MK_ERROR_SENDING_FROM_COMMAND, -230, -"An error occurred sending mail.\n\ +"An error occurred while sending mail.\n\ The mail server responded:\n\ %s\n\ Please verify that your email address is correct\n\ in your Mail preferences and try again.") -/* #define MK_ERROR_SENDING_RCPT_COMMAND -231 */ -ResDef(MK_ERROR_SENDING_RCPT_COMMAND, -231, -"An error occurred sending mail.\n\ +/* #define MK_ERROR_SENDING_RCPT_COMMAND -231 */ +ResDef(MK_ERROR_SENDING_RCPT_COMMAND, -231, +"An error occurred while sending mail.\n\ The mail server responded:\n\ %s\n\ Please check the message recipients and try again.") -/* #define MK_ERROR_SENDING_DATA_COMMAND -232 */ -ResDef(MK_ERROR_SENDING_DATA_COMMAND, -232, -"SMTP Error while sending mail.\nServer responded: %s") +/* #define MK_ERROR_SENDING_DATA_COMMAND -232 */ +ResDef(MK_ERROR_SENDING_DATA_COMMAND, -232, +"An (SMTP) error occurred while sending mail.\nServer responded: %s") -/* #define MK_ERROR_SENDING_MESSAGE -233 */ -ResDef(MK_ERROR_SENDING_MESSAGE, -233, -"An error occurred sending mail.\n\ +/* #define MK_ERROR_SENDING_MESSAGE -233 */ +ResDef(MK_ERROR_SENDING_MESSAGE, -233, +"An error occurred while sending mail.\n\ The mail server responded:\n\ - %s\n\ + %s.\n\ Please check the message and try again.") -/* #define MK_SMTP_SERVER_ERROR -234 */ -ResDef(MK_SMTP_SERVER_ERROR, -234, +/* #define MK_SMTP_SERVER_ERROR -234 */ +ResDef(MK_SMTP_SERVER_ERROR, -234, "An error occurred sending mail: SMTP server error.\n\ The server responded:\n\ %s\n\ Contact your mail administrator for assistance.") -/* #define MK_UNABLE_TO_CONNECT -240 -- generic error -- */ +/* #define MK_UNABLE_TO_CONNECT -240 -- generic error -- */ ResDef(MK_UNABLE_TO_CONNECT, -240, "A network error occurred:\n\ unable to connect to server (TCP Error: %s)\n\ @@ -251,23 +259,23 @@ The server may be down or unreachable.\n\n\ Try connecting again later.") /* #define MK_CONNECTION_TIMED_OUT -241 */ -ResDef(MK_CONNECTION_TIMED_OUT, -241, +ResDef(MK_CONNECTION_TIMED_OUT, -241, "There was no response. The server could be down\n\ or is not responding.\n\n\ If you are unable to connect again later, contact\n\ the server's administrator.") -/* #define MK_CONNECTION_REFUSED -242 */ +/* #define MK_CONNECTION_REFUSED -242 */ ResDef(MK_CONNECTION_REFUSED, -242, -MOZ_NAME_BRAND"'s network connection was refused by the server:\n\ - %.200s\n\ +MOZ_NAME_BRAND"'s network connection was refused by the server \n\ +%.200s.\n\ The server may not be accepting connections or\n\ may be busy.\n\n\ Try connecting again later.") #ifdef XP_WIN -/* #define MK_UNABLE_TO_CREATE_SOCKET -243 */ +/* #define MK_UNABLE_TO_CREATE_SOCKET -243 */ ResDef(MK_UNABLE_TO_CREATE_SOCKET , -243, MOZ_NAME_BRAND" was unable to create a network socket connection.\n\ There may be insufficient system resources or the network\n\ @@ -284,14 +292,14 @@ Try connecting again later or try restarting "MOZ_NAME_PRODUCT".") #ifdef XP_WIN -/* #define MK_UNABLE_TO_ACCEPT_SOCKET -245 */ +/* #define MK_UNABLE_TO_ACCEPT_SOCKET -245 */ ResDef(MK_UNABLE_TO_ACCEPT_SOCKET, -245, MOZ_NAME_BRAND" is unable to complete a socket connection \n\ with this server. There may be insufficient system\n\ resources.\n\n\ Try restarting "MOZ_NAME_PRODUCT" or restarting Windows.") #else -/* #define MK_UNABLE_TO_ACCEPT_SOCKET -245 */ +/* #define MK_UNABLE_TO_ACCEPT_SOCKET -245 */ ResDef(MK_UNABLE_TO_ACCEPT_SOCKET, -245, MOZ_NAME_BRAND" is unable to complete a socket connection\n\ with this server. There may be insufficient system\n\ @@ -300,14 +308,14 @@ Try restarting "MOZ_NAME_PRODUCT".") #endif -/* #define MK_UNABLE_TO_CONNECT_TO_PROXY -246 */ +/* #define MK_UNABLE_TO_CONNECT_TO_PROXY -246 */ ResDef(MK_UNABLE_TO_CONNECT_TO_PROXY, -246, MOZ_NAME_BRAND" is unable to connect to your proxy server.\n\ The server may be down or may be incorrectly configured.\n\n\ Please verify that your Proxy preferences are correct\n\ and try again, or contact the server's administrator.") -/* #define MK_UNABLE_TO_LOCATE_PROXY -247 */ +/* #define MK_UNABLE_TO_LOCATE_PROXY -247 */ ResDef(MK_UNABLE_TO_LOCATE_PROXY, -247, MOZ_NAME_BRAND" is unable to locate your proxy server.\n\ The server may be down or may be incorrectly configured.\n\n\ @@ -316,12 +324,13 @@ and try again, or contact the server's administrator.") -/* #define MK_ZERO_LENGTH_FILE -251 */ +/* #define MK_ZERO_LENGTH_FILE -251 */ ResDef(MK_ZERO_LENGTH_FILE, -251, -"Document contains no data") +"The document contained no data.\n\ +Try again later, or contact the server's administrator.") -/* #define MK_TCP_READ_ERROR -252 */ +/* #define MK_TCP_READ_ERROR -252 */ ResDef(MK_TCP_READ_ERROR , -252, "A network error occurred while "MOZ_NAME_PRODUCT"\n\ was receiving data.\n(Network Error: %s)\n\n\ @@ -329,53 +338,57 @@ Try connecting again.") -/* #define MK_UNABLE_TO_OPEN_TMP_FILE -253 */ +/* #define MK_UNABLE_TO_OPEN_TMP_FILE -253 */ ResDef(MK_UNABLE_TO_OPEN_TMP_FILE, -253, -MOZ_NAME_BRAND" is unable to open the temporary file:\n\ - %.200s\n\n\ +MOZ_NAME_BRAND" is unable to open the temporary file\n\ +%.200s.\n\n\ Check your `Temporary Directory' setting and try again.") -/* #define MK_COULD_NOT_GET_USERS_MAIL_ADDRESS -235 */ +/* #define MK_COULD_NOT_GET_USERS_MAIL_ADDRESS -235 */ ResDef(MK_COULD_NOT_GET_USERS_MAIL_ADDRESS, -235, "An error occurred sending mail:\n\ the return mail address was invalid.\n\n\ Please verify that your email address is correct\n\ in your Mail preferences and try again.") -/* #define MK_DISK_FULL -250 */ +/* #define MK_DISK_FULL -250 */ ResDef(MK_DISK_FULL, -250, "The disk is full. "MOZ_NAME_PRODUCT" is cancelling the file\n\ transfer and removing the file.\n\n\ Please remove some files and try again.") -/* #define MK_NNTP_AUTH_FAILED -260 -- NNTP authinfo failure -- */ +/* #define MK_NNTP_AUTH_FAILED -260 -- NNTP authinfo failure -- */ ResDef(MK_NNTP_AUTH_FAILED, -260, "An authorization error occurred:\n\n\ %s\n\n\ Please try entering your name and/or password again.") -/* #define MK_MIME_NO_SENDER -266 */ -ResDef(MK_MIME_NO_SENDER, -266, /* From: empty */ -"No sender was specified.") +/* #define MK_MIME_NO_SENDER -266 */ +ResDef(MK_MIME_NO_SENDER, -266, /* From: empty */ +"No sender was specified.\n\ +Please fill in your email address in the\n\ +Mail and Newsgroup preferences.") -/* #define MK_MIME_NO_RECIPIENTS -267 */ -ResDef(MK_MIME_NO_RECIPIENTS, -267, /* To: and Newsgroups: empty */ -"No recipients were specified.") +/* #define MK_MIME_NO_RECIPIENTS -267 */ +ResDef(MK_MIME_NO_RECIPIENTS, -267, /* To: and Newsgroups: empty */ +"No recipients were specified.\n\ +Please enter a recipient in a To: line,\n\ +or a newsgroup in a Group: line..") -/* #define MK_MIME_NO_SUBJECT -268 */ -ResDef(MK_MIME_NO_SUBJECT, -268, /* Subject: empty */ +/* #define MK_MIME_NO_SUBJECT -268 */ +ResDef(MK_MIME_NO_SUBJECT, -268, /* Subject: empty */ "No subject was specified.") -/* #define MK_MIME_ERROR_WRITING_FILE -269 */ +/* #define MK_MIME_ERROR_WRITING_FILE -269 */ ResDef(MK_MIME_ERROR_WRITING_FILE, -269, "Error writing temporary file.") -/* #define MK_MIME_MULTIPART_BLURB -275 */ -ResDef(MK_MIME_MULTIPART_BLURB, -275, /* text preceding multiparts */ +/* #define MK_MIME_MULTIPART_BLURB -275 */ +ResDef(MK_MIME_MULTIPART_BLURB, -275, /* text preceding multiparts */ "This is a multi-part message in MIME format.") -/* #define MK_PRINT_LOSSAGE -278 */ +/* #define MK_PRINT_LOSSAGE -278 */ ResDef(MK_PRINT_LOSSAGE, -278, "Printing stopped. A problem occurred while receiving\n\ the document. Transmission may have been interrupted\n\ @@ -383,147 +396,148 @@ or there may be insufficient space to write the file.\n\n\ Try again. Check that space is available in the\n\ temporary directory or restart "MOZ_NAME_PRODUCT".") -/* #define MK_SIGNATURE_TOO_LONG -279 */ +/* #define MK_SIGNATURE_TOO_LONG -279 */ ResDef(MK_SIGNATURE_TOO_LONG, -279, "Your signature exceeds the recommended four lines.") -/* #define MK_SIGNATURE_TOO_WIDE -280 */ +/* #define MK_SIGNATURE_TOO_WIDE -280 */ ResDef(MK_SIGNATURE_TOO_WIDE, -280, "Your signature exceeds the recommended 79 columns.\n\ For most readers, the lines will appear truncated, or\n\ will be wrapped unattractively. \n\n\ Please edit it to keep the lines shorter than 80 characters.") -ResDef(MK_UNABLE_TO_CONNECT2, -281, +ResDef(MK_UNABLE_TO_CONNECT2, -281, "A network error occurred:\n\ unable to connect to server\n\ The server may be down or unreachable.\n\n\ Try connecting again later.") -/* #define MK_CANT_LOAD_HELP_TOPIC -282 */ -ResDef(MK_CANT_LOAD_HELP_TOPIC, -282, +/* #define MK_CANT_LOAD_HELP_TOPIC -282 */ +ResDef(MK_CANT_LOAD_HELP_TOPIC, -282, "Unable to load the requested help topic") -/* #define MK_TIMEBOMB_MESSAGE -301 */ +/* #define MK_TIMEBOMB_MESSAGE -301 */ ResDef(MK_TIMEBOMB_MESSAGE, -301, "This copy of "MOZ_NAME_PRODUCT" has expired.\n\ This pre-release copy of "MOZ_NAME_FULL" has expired\n\ and can only be used to download a newer version of "MOZ_NAME_PRODUCT".") -/* #define MK_TIMEBOMB_URL_PROHIBIT -302 */ +/* #define MK_TIMEBOMB_URL_PROHIBIT -302 */ ResDef(MK_TIMEBOMB_URL_PROHIBIT, -302, "This trial or pre-release copy of "MOZ_NAME_FULL" has expired\n\ and can only be used to purchase or download a newer version of "MOZ_NAME_PRODUCT".") -/* #define MK_NO_WAIS_PROXY -303 */ +/* #define MK_NO_WAIS_PROXY -303 */ ResDef(MK_NO_WAIS_PROXY, -303, "No WAIS proxy is configured.\n\n\ Check your Proxy preferences and try again.") -/* #define MK_NNTP_ERROR_MESSAGE -304 */ +/* #define MK_NNTP_ERROR_MESSAGE -304 */ ResDef(MK_NNTP_ERROR_MESSAGE, -304, "A News (NNTP) error occurred:\n\ %.100s") -/* #define MK_NNTP_NEWSGROUP_SCAN_ERROR -305 */ -ResDef(MK_NNTP_NEWSGROUP_SCAN_ERROR, -305, -"A News error occurred. The scan of all discussion groups is incomplete.\n\ +/* #define MK_NNTP_NEWSGROUP_SCAN_ERROR -305 */ +ResDef(MK_NNTP_NEWSGROUP_SCAN_ERROR, -305, +"A News error occurred. The scan of all newsgroups is incomplete.\n\ \n\ -Try to View All Discussion Groups again.") +Try to View All Newsgroups again.") -/* #define MK_CREATING_NEWSRC_FILE -306 */ +/* #define MK_CREATING_NEWSRC_FILE -306 */ ResDef(MK_CREATING_NEWSRC_FILE, -306, MOZ_NAME_BRAND" could not find a News file (newsrc)\n\ and is creating one for you.") -/* #define MK_NNTP_SERVER_NOT_CONFIGURED -307 */ +/* #define MK_NNTP_SERVER_NOT_CONFIGURED -307 */ ResDef(MK_NNTP_SERVER_NOT_CONFIGURED,-307, "No NNTP server is configured.\n\n\ -Check your Mail and Groups preferences and try again.") +Check your Mail and News preferences and try again.") -/* #define MK_COMMUNICATIONS_ERROR -308 */ -ResDef(MK_COMMUNICATIONS_ERROR, -308, -"Communications exception (%d).") +/* #define MK_COMMUNICATIONS_ERROR -308 */ +ResDef(MK_COMMUNICATIONS_ERROR, -308, +"A communications error occurred.\n\ +Please try again.") -/* #define MK_SECURE_NEWS_PROXY_ERROR -309 */ +/* #define MK_SECURE_NEWS_PROXY_ERROR -309 */ ResDef(MK_SECURE_NEWS_PROXY_ERROR, -309, MOZ_NAME_BRAND" was unble to connect to the secure news server\n\ because of a proxy error") /* #define MK_POP3_SERVER_ERROR -311 generic pop3 error code */ -ResDef(MK_POP3_SERVER_ERROR, -311, -"An error occurred with the POP3 server.\n\ +ResDef(MK_POP3_SERVER_ERROR, -311, +"An error occurred with the POP3 mail server.\n\ You should contact the administrator for this server\n\ or try again later.") /* #define MK_POP3_USERNAME_UNDEFINED -312 no username defined */ -ResDef(MK_POP3_USERNAME_UNDEFINED, -312, +ResDef(MK_POP3_USERNAME_UNDEFINED, -312, MOZ_NAME_BRAND" is unable to use the mail server because\n\ you have not provided a username. Please provide\n\ one in the preferences and try again") /* #define MK_POP3_PASSWORD_UNDEFINED -313 no password defined */ -ResDef(MK_POP3_PASSWORD_UNDEFINED, -313, +ResDef(MK_POP3_PASSWORD_UNDEFINED, -313, "Error getting mail password.") -/* #define MK_POP3_USERNAME_FAILURE -314 failure in USER step */ -ResDef(MK_POP3_USERNAME_FAILURE, -314, +/* #define MK_POP3_USERNAME_FAILURE -314 failure in USER step */ +ResDef(MK_POP3_USERNAME_FAILURE, -314, "An error occurred while sending your user name to the mail server.\n\ You should contact the administrator for this server\n\ or try again later.") -/* #define MK_POP3_PASSWORD_FAILURE -315 failure in PASS step */ -ResDef(MK_POP3_PASSWORD_FAILURE, -315, +/* #define MK_POP3_PASSWORD_FAILURE -315 failure in PASS step */ +ResDef(MK_POP3_PASSWORD_FAILURE, -315, "An error occurred while sending your password to the mail server.\n\ You should contact the administrator for this server\n\ or try again later.") -/* #define MK_POP3_NO_MESSAGES -316 no mail messages on pop server */ -ResDef(MK_POP3_NO_MESSAGES, -316, -"No new messages on server") +/* #define MK_POP3_NO_MESSAGES -316 no mail messages on pop server */ +ResDef(MK_POP3_NO_MESSAGES, -316, +"There are no new messages on the server.") -/* #define MK_POP3_LIST_FAILURE -317 LIST command failed */ -ResDef(MK_POP3_LIST_FAILURE, -317, -"An error occurred while listing messages on the POP3 server.\n\ +/* #define MK_POP3_LIST_FAILURE -317 LIST command failed */ +ResDef(MK_POP3_LIST_FAILURE, -317, +"An error occurred while listing messages on the POP3 mail server.\n\ You should contact the administrator for this server\n\ or try again later.") -/* #define MK_POP3_LAST_FAILURE -318 LAST command failed */ -ResDef(MK_POP3_LAST_FAILURE, -318, -"An error occurred while querying the POP3 server for\n\ +/* #define MK_POP3_LAST_FAILURE -318 LAST command failed */ +ResDef(MK_POP3_LAST_FAILURE, -318, +"An error occurred while querying the POP3 mail server for\n\ the last processed message.\n\ You should contact the administrator for this server\n\ or try again later.") /* #define MK_POP3_RETR_FAILURE -319 RETR command failed, continues */ -ResDef(MK_POP3_RETR_FAILURE, -319, -"An error occurred while getting messages from the POP3 server.\n\ +ResDef(MK_POP3_RETR_FAILURE, -319, +"An error occurred while getting messages from the POP3 mail server.\n\ You should contact the administrator for this server\n\ or try again later.") -/* #define MK_POP3_DELE_FAILURE -320 DELE command failed */ -ResDef(MK_POP3_DELE_FAILURE, -320, -"An error occurred while removing messages from the POP3 server.\n\ +/* #define MK_POP3_DELE_FAILURE -320 DELE command failed */ +ResDef(MK_POP3_DELE_FAILURE, -320, +"An error occurred while removing messages from the POP3 mail server.\n\ You should contact the administrator for this server\n\ or try again later.") -/* #define MK_POP3_OUT_OF_DISK_SPACE -321 */ -ResDef(MK_POP3_OUT_OF_DISK_SPACE, -321, +/* #define MK_POP3_OUT_OF_DISK_SPACE -321 */ +ResDef(MK_POP3_OUT_OF_DISK_SPACE, -321, "There isn't enough room on the local disk to download\n\ -your mail from the POP3 server. Please make room and\n\ +your mail from the POP3 mail server. Please make room and\n\ try again. (The `Empty Trash' and `Compress This Folder'\n\ commands may recover some space.)") -/* #define MK_POP3_MESSAGE_WRITE_ERROR -322 */ -ResDef(MK_POP3_MESSAGE_WRITE_ERROR, -322, +/* #define MK_POP3_MESSAGE_WRITE_ERROR -322 */ +ResDef(MK_POP3_MESSAGE_WRITE_ERROR, -322, "An error occurred while saving mail messages.") /* #define MK_COULD_NOT_PUT_FILE -325 FTP could not put file */ -ResDef(MK_COULD_NOT_PUT_FILE, -325, +ResDef(MK_COULD_NOT_PUT_FILE, -325, "Could not post the file: %.80s.\n\ For reason:\n\ %.200s\n\n\ @@ -531,7 +545,7 @@ You may not have permission to write to\n\ this directory.\n\ Check the permissions and try again.") -/* #define MK_TIMEBOMB_WARNING_MESSAGE -326 */ +/* #define MK_TIMEBOMB_WARNING_MESSAGE -326 */ ResDef(MK_TIMEBOMB_WARNING_MESSAGE, -326, "This is a pre-release copy of "MOZ_NAME_FULL" that\n\ will expire at %s.\n\ @@ -542,23 +556,23 @@ choose Software from the Help menu.") /* #define MK_UNABLE_TO_DELETE_FILE */ ResDef(MK_UNABLE_TO_DELETE_FILE, -327, "Could not delete file:\n\ - %s") + %s") /* #define MK_UNABLE_TO_DELETE_DIRECTORY */ ResDef(MK_UNABLE_TO_DELETE_DIRECTORY, -328, "Could not remove directory:\n\ - %s") + %s") /* #define MK_MKDIR_FILE_ALREADY_EXISTS */ ResDef(MK_MKDIR_FILE_ALREADY_EXISTS, -329, "Cannot create directory because a file or\n\ directory of that name already exists: \n\ - %s") + %s") /* #define MK_COULD_NOT_CREATE_DIRECTORY */ ResDef(MK_COULD_NOT_CREATE_DIRECTORY, -330, "Could not create directory:\n\ - %s") + %s") /* #define MK_NOT_A_DIRECTORY */ ResDef(MK_NOT_A_DIRECTORY, -331, @@ -569,103 +583,110 @@ ResDef(MK_NOT_A_DIRECTORY, -331, ResDef(MK_COMPUSERVE_AUTH_FAILED, -332, "Authorization failed") -/* #define MK_RELATIVE_TIMEBOMB_MESSAGE -333 */ +/* #define MK_RELATIVE_TIMEBOMB_MESSAGE -333 */ ResDef(MK_RELATIVE_TIMEBOMB_MESSAGE, -333, "This trial copy of "MOZ_NAME_PRODUCT" has expired.\n\n\ To purchase a regular copy of "MOZ_NAME_FULL"\n(\ which will not expire) choose Software from the Help menu.") -/* #define MK_RELATIVE_TIMEBOMB_WARNING_MESSAGE -334 */ +/* #define MK_RELATIVE_TIMEBOMB_WARNING_MESSAGE -334 */ ResDef(MK_RELATIVE_TIMEBOMB_WARNING_MESSAGE, -334, "This trial copy of "MOZ_NAME_FULL" \n\ will expire at %s.\n\n\ To purchase a regular copy of "MOZ_NAME_FULL"\n(\ which will not expire) choose Software from the Help menu.") -/* #define MK_REDIRECT_ATTEMPT_NOT_ALLOWED -335 */ +/* #define MK_REDIRECT_ATTEMPT_NOT_ALLOWED -335 */ ResDef(MK_REDIRECT_ATTEMPT_NOT_ALLOWED, -335, "There was an attempt to redirect a url request,\n\ but the attempt was not allowed by the client.") -/* #define MK_BAD_GZIP_HEADER -336 */ +/* #define MK_BAD_GZIP_HEADER -336 */ ResDef(MK_BAD_GZIP_HEADER, -336, "Corruption was detected in the compressed GZip file that was requested") /* Mail/News errors */ -ResDef(MK_MSG_CANT_COPY_TO_SAME_FOLDER, -401, - "Can't move or copy messages to the folder they're already in.") +ResDef(MK_MSG_CANT_COPY_TO_SAME_FOLDER, -401, + "Can't move or copy messages to the folder they're already in.") #ifdef XP_WIN16 -ResDef(MK_MSG_CANT_COPY_TO_QUEUE_FOLDER, -402, - "Cannot copy messages into the 'Unsent' folder:\n\ -That folder is only for holding messages which\n\ -have been deferred for later delivery.") +ResDef(MK_MSG_CANT_COPY_TO_QUEUE_FOLDER, -402, + "Cannot copy messages into the 'Unsent' folder:\n\ +That folder is only for storing messages\n\ +to be sent later.") #else -ResDef(MK_MSG_CANT_COPY_TO_QUEUE_FOLDER, -402, - "Cannot copy messages into the 'Unsent Messages' folder:\n\ -That folder is only for holding messages which\n\ -have been deferred for later delivery.") +ResDef(MK_MSG_CANT_COPY_TO_QUEUE_FOLDER, -402, + "Cannot copy messages into the 'Unsent Messages' folder:\n\ +That folder is only for storing messages\n\ +to be sent later.") #endif -ResDef(MK_MSG_CANT_COPY_TO_DRAFTS_FOLDER, -403, - "Cannot copy messages into the `unsent drafts' folder:\n\ -That folder is only for holding messages which have\n\ -have not yet been queued delivery.") +ResDef(MK_MSG_CANT_COPY_TO_DRAFTS_FOLDER, -403, + "Cannot copy messages into the `Drafts' folder:\n\ +That folder is only for holding drafts of messages which have\n\ +not yet been sent.") -ResDef(MK_MSG_CANT_CREATE_FOLDER, -404, - "Couldn't create the folder!") +#ifdef XP_WIN +ResDef(MK_MSG_CANT_CREATE_FOLDER, -404, + "Couldn't create the folder! Your hard disk may be full\n\ +or the folder pathname may be too long.") +#else +ResDef(MK_MSG_CANT_CREATE_FOLDER, -404, + "Couldn't create the folder! Your hard disk may be full.") +#endif -ResDef(MK_MSG_FOLDER_ALREADY_EXISTS, -405, - "The folder already exists.") +ResDef(MK_MSG_FOLDER_ALREADY_EXISTS, -405, + "A folder with that name already exists.") -ResDef(MK_MSG_FOLDER_NOT_EMPTY, -406, - "Can't delete a folder without first deleting the messages in it.") +ResDef(MK_MSG_FOLDER_NOT_EMPTY, -406, + "Can't delete a folder without first deleting the messages in it.") -ResDef(MK_MSG_CANT_DELETE_FOLDER, -407, - "Can't delete a folder without first deleting the messages in it.") +ResDef(MK_MSG_CANT_DELETE_FOLDER, -407, + "Can't delete a folder without first deleting the messages in it.") -ResDef(MK_MSG_CANT_CREATE_INBOX, -408, - "Couldn't create default inbox folder!") +ResDef(MK_MSG_CANT_CREATE_INBOX, -408, + "Couldn't create default inbox folder!") -ResDef(MK_MSG_CANT_CREATE_MAIL_DIR, -409, - "Couldn't create a mail folder directory. Mail will not work!") +ResDef(MK_MSG_CANT_CREATE_MAIL_DIR, -409, + "Couldn't create a mail folder directory. Mail will not work!") -ResDef(MK_MSG_NO_POP_HOST, -410, - "No mail server has been specified in preferences.") +ResDef(MK_MSG_NO_POP_HOST, -410, + "No mail server has been specified. Please enter your mail \n\ +server in the preferences (select Preferences from the Edit menu).") -ResDef(MK_MSG_MESSAGE_CANCELLED, -414, - "Message cancelled.") +ResDef(MK_MSG_MESSAGE_CANCELLED, -414, + "Message cancelled.") -ResDef(MK_MSG_COULDNT_OPEN_FCC_FILE, -415, - "Couldn't open Sent Mail file. \n\ - Please verify that your Mail preferences are correct.") +ResDef(MK_MSG_COULDNT_OPEN_FCC_FILE, -415, + "Couldn't open Sent Mail file. \n\ + Please verify that your Mail preferences are correct.") -ResDef(MK_MSG_FOLDER_UNREADABLE, -416, - "Folder no longer exists?") +ResDef(MK_MSG_FOLDER_UNREADABLE, -416, + "Couldn't find the folder.") -ResDef(MK_MSG_FOLDER_SUMMARY_UNREADABLE, -417, - "Folder summary file no longer exists?") +ResDef(MK_MSG_FOLDER_SUMMARY_UNREADABLE, -417, + "Couldn't find the summary file.") -ResDef(MK_MSG_TMP_FOLDER_UNWRITABLE, -418, - "Couldn't open temporary folder file for output.") +ResDef(MK_MSG_TMP_FOLDER_UNWRITABLE, -418, + "Couldn't open temporary folder file for output.") -ResDef(MK_MSG_ID_NOT_IN_FOLDER, -419, - "The specified message doesn't exist in that folder.\n\ +ResDef(MK_MSG_ID_NOT_IN_FOLDER, -419, + "The specified message doesn't exist in that folder.\n\ It may have been deleted or moved into another folder.") -ResDef(MK_MSG_NEWSRC_UNPARSABLE, -420, - "A newsrc file exists but is unparsable.") +ResDef(MK_MSG_NEWSRC_UNPARSABLE, -420, + "A newsrc file exists but is unparsable.") -ResDef(MK_MSG_NO_RETURN_ADDRESS, -421, - "Your email address has not been specified.\n\ -Before sending mail or discussion messages, you must specify a\n\ -return address in Mail and Groups Preferences.") +ResDef(MK_MSG_NO_RETURN_ADDRESS, -421, + "Your email address has not been specified.\n\ +Before sending mail or news messages, you must specify a\n\ +return address in Mail and News Preferences.") #if 0 /* Windows and Mac resource only understand 254 chars per string */ -ResDef(MK_MSG_NO_RETURN_ADDRESS_AT, -421, - "The return email address set in Preferences is: %s\n\ +ResDef(MK_MSG_NO_RETURN_ADDRESS_AT, -421, + "The return email address set in Preferences is: %s\n\ \n\ This does not appear to be complete (it contains no `@' and host name.)\n\ A valid email address will be of the form `USER@HOST', where USER is\n\ @@ -676,8 +697,8 @@ name will have at least one `.' in it, and will usually end in `.com',\n\ your full email address is, please consult your system administrator.") /* Windows and Mac resource only understand 254 chars per string */ -ResDef(MK_MSG_NO_RETURN_ADDRESS_DOT, -422, - "The return email address set in Preferences is: %s\n\ +ResDef(MK_MSG_NO_RETURN_ADDRESS_DOT, -422, + "The return email address set in Preferences is: %s\n\ \n\ This does not appear to be complete (it contains no `.' in the host name.)\n\ A valid email address will be of the form `USER@HOST', where USER is\n\ @@ -687,54 +708,54 @@ name will have at least one `.' in it, and will usually end in `.com',\n\ `.edu', `.net', or a two-letter country code. If you are unsure what\n\ your full email address is, please consult your system administrator.") #else -ResDef(MK_MSG_NO_RETURN_ADDRESS_AT, -423, - "The return email address set in Preferences is: %s\n\ +ResDef(MK_MSG_NO_RETURN_ADDRESS_AT, -423, + "The return email address set in Preferences is: %s\n\ \n\ This appears to be incomplete (it contains no `@'). Examples of\n\ correct email addresses are `fred@xyz.com' and `sue@xyz.gov.au'.") -ResDef(MK_MSG_NO_RETURN_ADDRESS_DOT, -424, - "The return email address set in Preferences is: %s\n\ +ResDef(MK_MSG_NO_RETURN_ADDRESS_DOT, -424, + "The return email address set in Preferences is: %s\n\ \n\ This appears to be incomplete (it contains no `.'). Examples of\n\ correct email addresses are `fred@xyz.com' and `sue@xyz.gov.au'.") #endif ResDef(MK_MSG_NO_SMTP_HOST,-425, - "No SMTP server has been specified in Mail and Groups Preferences.") + "No outgoing mail (SMTP) server has been specified in Mail and News Preferences.") -ResDef(MK_NNTP_CANCEL_CONFIRM, -426, - "Are you sure you want to cancel this message?") +ResDef(MK_NNTP_CANCEL_CONFIRM, -426, + "Are you sure you want to cancel this message?") -ResDef(MK_NNTP_CANCEL_DISALLOWED, -427, - "This message does not appear to be from you.\n\ +ResDef(MK_NNTP_CANCEL_DISALLOWED, -427, + "This message does not appear to be from you.\n\ You may only cancel your own posts, not those made by others.") -ResDef(MK_NNTP_CANCEL_ERROR, -428, - "Unable to cancel message!") +ResDef(MK_NNTP_CANCEL_ERROR, -428, + "Unable to cancel message!") -ResDef(MK_NNTP_NOT_CANCELLED, -429, - "Message not cancelled.") +ResDef(MK_NNTP_NOT_CANCELLED, -429, + "Message not cancelled.") -ResDef(MK_NEWS_ERROR_FMT, -430, - "Error!\nDiscussion group server responded: %.512s\n") +ResDef(MK_NEWS_ERROR_FMT, -430, + "Error!\nNews server responded: %.512s\n") -ResDef(MK_MSG_NON_MAIL_FILE_READ_QUESTION, -431, - "%.300s does not appear to be a mail file.\n\ +ResDef(MK_MSG_NON_MAIL_FILE_READ_QUESTION, -431, + "%.300s does not appear to be a mail file.\n\ Attempt to read it anyway?") -ResDef(MK_MSG_NON_MAIL_FILE_WRITE_QUESTION, -432, - "%.300s does not appear to be a mail file.\n\ +ResDef(MK_MSG_NON_MAIL_FILE_WRITE_QUESTION, -432, + "%.300s does not appear to be a mail file.\n\ Attempt to write it anyway?") -ResDef(MK_MSG_ERROR_WRITING_NEWSRC, -433, - "Error saving newsrc file!") +ResDef(MK_MSG_ERROR_WRITING_NEWSRC, -433, + "Error saving newsrc file!") -ResDef(MK_MSG_ERROR_WRITING_MAIL_FOLDER, -434, - "Error writing mail file!") +ResDef(MK_MSG_ERROR_WRITING_MAIL_FOLDER, -434, + "Error writing mail file!") -ResDef(MK_MSG_OFFER_COMPRESS, -435, +ResDef(MK_MSG_OFFER_COMPRESS, -435, "At least one of your mail folders is wasting a lot\n\ of disk space. If you compress your Mail folders now,\n\ you can recover %ld Kbytes of disk space. Compressing\n\ @@ -742,14 +763,14 @@ folders might take a while.\n\ \n\ Compress folders now?") -ResDef(MK_MSG_SEARCH_FAILED, -436, +ResDef(MK_MSG_SEARCH_FAILED, -436, "Not found.") -ResDef(MK_MSG_EMPTY_MESSAGE, -437, +ResDef(MK_MSG_EMPTY_MESSAGE, -437, "You haven't typed anything, and there is no attachment.\n\ Send anyway?") -ResDef(MK_MSG_DOUBLE_INCLUDE, -438, +ResDef(MK_MSG_DOUBLE_INCLUDE, -438, "You have included the same document twice: first as a quoted\n\ document (meaning: with '>' at the beginning of each line), and\n\ then as an attachment (meaning: as a second part of the message,\n\ @@ -784,75 +805,80 @@ corrected.") #endif -ResDef(MK_MSG_MISSING_SUBJECT, -441, +ResDef(MK_MSG_MISSING_SUBJECT, -441, "This message has no subject. Send anyway?") -ResDef(MK_MSG_MIXED_SECURITY, -442, +ResDef(MK_MSG_MIXED_SECURITY, -442, "It will not be possible to send this message encrypted to all of the\n\ addressees. Send it anyway?") -ResDef (MK_MSG_CAN_ONLY_DELETE_MAIL_FOLDERS, -443, - "Can only delete mail folders.") +ResDef (MK_MSG_CAN_ONLY_DELETE_MAIL_FOLDERS, -443, + "Can only delete mail folders.") -ResDef(MK_MSG_FOLDER_BUSY, -444, +ResDef(MK_MSG_FOLDER_BUSY, -444, "Can't copy messages because the mail folder is in use.\n\ Please wait until other copy operations are \n\ complete and try again.\n" ) -ResDef(MK_MSG_PANES_OPEN_ON_FOLDER, -445, +ResDef(MK_MSG_PANES_OPEN_ON_FOLDER, -445, "Can't delete message folder '%s\' because you are viewing\n\ its contents. Please close those windows and try again.") -ResDef(MK_MSG_INCOMPLETE_NEWSGROUP_LIST, -446, -"The complete list of discussion groups was not retrieved for\n\ -this discussion group server. Operations will not proceed normally\n\ -until all discussion groups have been retrieved.\n\ +ResDef(MK_MSG_INCOMPLETE_NEWSGROUP_LIST, -446, +"The complete list of newsgroups was not retrieved for\n\ +this news server. Operations will not proceed normally\n\ +until all newsgroups have been retrieved.\n\ \n\ -Click on the 'All Groups' tab to continue retrieving\n\ -discussion groups.") +Click on the 'All Newsgroups' tab to continue retrieving\n\ +newsgroups.") -ResDef(MK_MSG_ONLINE_IMAP_WITH_NO_BODY, -447, -"This IMAP message cannot be moved while offline. It has no attached body.") +ResDef(MK_MSG_ONLINE_IMAP_WITH_NO_BODY, -447, +"This message cannot be moved while Communicator is offline.\n\ +It has not been downloaded for offline reading.\n\ +Select Go Online from the File menu, then try again.") -ResDef(MK_MSG_ONLINE_COPY_FAILED, -448, +ResDef(MK_MSG_ONLINE_COPY_FAILED, -448, "The IMAP message copy failed. A source message was not found.") -ResDef(MK_MSG_ONLINE_MOVE_FAILED, -449, +ResDef(MK_MSG_ONLINE_MOVE_FAILED, -449, "The IMAP message move failed.\n\ The copy succeeded but a source message was not deleted.") -ResDef(MK_MSG_CONFIRM_CONTINUE_IMAP_SYNC, -450, -"A playback operation failed. Continue?\n") +ResDef(MK_MSG_CONFIRM_CONTINUE_IMAP_SYNC, -450, +"A problem has occured uploading an offline change.\n\ + Continue uploading remaining offline changes (OK) \n\ + or try again later (Cancel)") -ResDef(MK_MSG_CANT_MOVE_INBOX, -451, +ResDef(MK_MSG_CANT_MOVE_INBOX, -451, "You cannot move your Inbox Folder.") -ResDef(MK_MSG_CANT_FIND_SNM, -452, +ResDef(MK_MSG_CANT_FIND_SNM, -452, "Could not find the summary information\n\ for the %s IMAP folder.") -ResDef(MK_MSG_NO_UNDO_DURING_IMAP_FOLDER_LOAD, -453, +ResDef(MK_MSG_NO_UNDO_DURING_IMAP_FOLDER_LOAD, -453, "You cannot undo or redo a folder action while\n\ - the folder is loading.") + the folder is loading. Wait until the folder has\n\ + finished loading, then try again.") -ResDef(MK_MSG_MOVE_TARGET_NO_INFERIORS, -454, +ResDef(MK_MSG_MOVE_TARGET_NO_INFERIORS, -454, "The targeted destination folder does not allow subfolders.") -ResDef(MK_MSG_PARENT_TARGET_NO_INFERIORS, -455, +ResDef(MK_MSG_PARENT_TARGET_NO_INFERIORS, -455, "The selected parent folder does not allow subfolders.\n\ Try selecting the server folder and typing\n\ 'parent/newFolder' to create a new hierarchy.") -ResDef(MK_MSG_COPY_TARGET_NO_SELECT, -456, +ResDef(MK_MSG_COPY_TARGET_NO_SELECT, -456, "The targeted destination folder cannot hold messages.") -ResDef(MK_MSG_TRASH_NO_INFERIORS, -457, +ResDef(MK_MSG_TRASH_NO_INFERIORS, -457, "This mail server cannot undo folder deletes, delete anyway?") -ResDef(MK_MSG_CANT_COPY_TO_QUEUE_FOLDER_OLD, -458, - "Cannot copy messages into the 'Outbox' folder:\n\ -That folder is only for holding messages which\n\ -have been deferred for later delivery.") +ResDef(MK_MSG_CANT_COPY_TO_QUEUE_FOLDER_OLD, -458, + "Cannot copy messages into the 'Outbox' folder:\n\ +That folder is only for storing messages\n\ +to be sent later.") ResDef(MK_MSG_DELIVERY_FAILURE_1_OLD, -459, "Delivery failed for 1 message.\n\n\ @@ -867,27 +893,26 @@ Before they can be delivered, the errors must be\n\ corrected.") ResDef(MK_MSG_NO_MAIL_TO_NEWS, -461, - "You can't move a mail folder into a discussion group.") + "You can't move a mail folder into a newsgroup.") ResDef(MK_MSG_NO_NEWS_TO_MAIL, -462, - "You can't move a discussion group into a mail folder.") + "You can't move a newsgroup into a mail folder.") ResDef(MK_MSG_BOGUS_SERVER_MAILBOX_UID_STATE, -463, "Mail Server Problem: The UID's for the messages in this\n\ - folder are not increasing. Contact your sysadmin.") + folder are not increasing. Contact your system administrator.") ResDef(MK_MSG_IMAP_SERVER_NOT_IMAP4, -464, "This mail server is not an IMAP4 mail server.") -ResDef(MK_MSG_HTML_IMAP_NO_CACHED_BODY, -465, -"IMAP Go Online!\n\ +ResDef(MK_MSG_HTML_IMAP_NO_CACHED_BODY, -465, +"Go Online to View This Message\n\ The body of this message has not been downloaded from \n\ the server for reading offline. To read this message \n\ -you must first go online using the 'Go Online' menu item \n\ -in the File menu and view the message again.") +select 'Go Online' from the File menu and view the message again.") ResDef(MK_MSG_COMPRESS_FAILED, -466, - "Compress failed.") + "Compress failed.") ResDef(MK_MSG_LOTS_NEW_IMAP_FOLDERS, -467, "At least 30 new IMAP folders have been found.\n\ @@ -896,10 +921,10 @@ Press to continue or to change\n\ the IMAP server directory.") ResDef(MK_MSG_IMAP_DIR_PROMPT, -468, - "Enter IMAP server directory name.") + "Enter IMAP server directory name.") ResDef(MK_MSG_NO_POST_TO_DIFFERENT_HOSTS_ALLOWED, -469, -"Posting to discussion groups on different hosts is not supported.") +"Posting to newsgroups on different hosts is not supported.") ResDef(MK_MSG_CANT_MOVE_OFFLINE_MOVE_RESULT, -470, "This message was moved here while offline. You have to \n\ @@ -913,12 +938,26 @@ ResDef(MK_MSG_MAIL_DIRECTORY_CHANGED, -472, will take effect the next time\n\ you restart Communicator.") +ResDef(MK_MSG_UNABLE_TO_SAVE_DRAFT, -473, +MOZ_NAME_BRAND" is unable to save your message as draft.\n\ +Please verify that your Mail preferences are correct\n\ +and try again.") + +ResDef(MK_MSG_UNABLE_TO_SAVE_TEMPLATE, -474, +MOZ_NAME_BRAND" is unable to save your message as template.\n\ +Please verify that your Mail preferences are correct\n\ +and try again.") + +ResDef(MK_SENDMAIL_BAD_TLS, -475, +"Your SMTP mail server could not start a secure connection.\n\ +You have requested to send mail ONLY in secure mode and therefore \ +the connection has been aborted. Please check your preferences.") + END_STR(mcom_include_merrors_i_strings) /* WARNING: DO NOT TAKE ERROR CODE -666, it is used internally by the message lib */ - /* General security error codes */ #define NO_SECURITY_ERROR_ENUM @@ -927,142 +966,142 @@ END_STR(mcom_include_merrors_i_strings) RES_START BEGIN_STR(mcom_include_secerr_i_strings) -ResDef(SEC_ERROR_IO, SEC_ERROR_BASE + 0, +ResDef(SEC_ERROR_IO, SEC_ERROR_BASE + 0, "An I/O error occurred during security authorization.\n\ Please try your connection again") -ResDef(SEC_ERROR_LIBRARY_FAILURE, SEC_ERROR_BASE + 1, +ResDef(SEC_ERROR_LIBRARY_FAILURE, SEC_ERROR_BASE + 1, "The security library has experienced an error.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_BAD_DATA, SEC_ERROR_BASE + 2, +ResDef(SEC_ERROR_BAD_DATA, SEC_ERROR_BASE + 2, "The security library has received bad data.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_OUTPUT_LEN, SEC_ERROR_BASE + 3, +ResDef(SEC_ERROR_OUTPUT_LEN, SEC_ERROR_BASE + 3, "The security library has experienced an error.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_INPUT_LEN, SEC_ERROR_BASE + 4, +ResDef(SEC_ERROR_INPUT_LEN, SEC_ERROR_BASE + 4, "The security library has experienced an error.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_INVALID_ARGS, SEC_ERROR_BASE + 5, +ResDef(SEC_ERROR_INVALID_ARGS, SEC_ERROR_BASE + 5, "The security library has experienced an error.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_INVALID_ALGORITHM, SEC_ERROR_BASE + 6, +ResDef(SEC_ERROR_INVALID_ALGORITHM, SEC_ERROR_BASE + 6, "The security library has experienced an error.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_INVALID_AVA, SEC_ERROR_BASE + 7, +ResDef(SEC_ERROR_INVALID_AVA, SEC_ERROR_BASE + 7, "The security library has experienced an error.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_INVALID_TIME, SEC_ERROR_BASE + 8, +ResDef(SEC_ERROR_INVALID_TIME, SEC_ERROR_BASE + 8, "The security library has experienced an error.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_BAD_DER, SEC_ERROR_BASE + 9, +ResDef(SEC_ERROR_BAD_DER, SEC_ERROR_BASE + 9, "The security library has encountered an improperly formatted\n\ DER-encoded message.") -ResDef(SEC_ERROR_BAD_SIGNATURE, SEC_ERROR_BASE + 10, +ResDef(SEC_ERROR_BAD_SIGNATURE, SEC_ERROR_BASE + 10, "The server's certificate has an invalid signature.\n\ You will not be able to connect to this site securely.") -ResDef(SEC_ERROR_EXPIRED_CERTIFICATE, SEC_ERROR_BASE + 11, +ResDef(SEC_ERROR_EXPIRED_CERTIFICATE, SEC_ERROR_BASE + 11, "This operation cannot be performed because a required\n\ certificate has expired. Click on the `Security' icon\n\ for more information about certificates.") -ResDef(SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_BASE + 12, +ResDef(SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_BASE + 12, "This operation cannot be performed because a required\n\ certificate has been revoked. Click on the `Security'\n\ icon for more information about certificates.") -ResDef(SEC_ERROR_UNKNOWN_ISSUER, SEC_ERROR_BASE + 13, +ResDef(SEC_ERROR_UNKNOWN_ISSUER, SEC_ERROR_BASE + 13, "The certificate issuer for this server is not recognized by\n\ "MOZ_NAME_PRODUCT". The security certificate may or may not be valid.\n\n\ "MOZ_NAME_PRODUCT" refuses to connect to this server.") -ResDef(SEC_ERROR_BAD_KEY, SEC_ERROR_BASE + 14, +ResDef(SEC_ERROR_BAD_KEY, SEC_ERROR_BASE + 14, "The server's public key is invalid.\n\ You will not be able to connect to this site securely.") -ResDef(SEC_ERROR_BAD_PASSWORD, SEC_ERROR_BASE + 15, +ResDef(SEC_ERROR_BAD_PASSWORD, SEC_ERROR_BASE + 15, "The security password entered is incorrect.") -ResDef(SEC_ERROR_RETRY_PASSWORD, SEC_ERROR_BASE + 16, +ResDef(SEC_ERROR_RETRY_PASSWORD, SEC_ERROR_BASE + 16, "You did not enter your new password correctly. Please try again.") -ResDef(SEC_ERROR_NO_NODELOCK, SEC_ERROR_BASE + 17, +ResDef(SEC_ERROR_NO_NODELOCK, SEC_ERROR_BASE + 17, "The security library has experienced an error.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_BAD_DATABASE, SEC_ERROR_BASE + 18, +ResDef(SEC_ERROR_BAD_DATABASE, SEC_ERROR_BASE + 18, "The security library has experienced a database error.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_NO_MEMORY, SEC_ERROR_BASE + 19, +ResDef(SEC_ERROR_NO_MEMORY, SEC_ERROR_BASE + 19, "The security library has experienced an out of memory error.\n\ Please try to reconnect.") -ResDef(SEC_ERROR_UNTRUSTED_ISSUER, SEC_ERROR_BASE + 20, +ResDef(SEC_ERROR_UNTRUSTED_ISSUER, SEC_ERROR_BASE + 20, "The certificate issuer for this server has been marked as\n\ not trusted by the user. "MOZ_NAME_PRODUCT" refuses to connect to this\n\ server.") -ResDef(SEC_ERROR_UNTRUSTED_CERT, SEC_ERROR_BASE + 21, +ResDef(SEC_ERROR_UNTRUSTED_CERT, SEC_ERROR_BASE + 21, "The certificate for this server has been marked as not\n\ trusted by the user. "MOZ_NAME_PRODUCT" refuses to connect to this\n\ server.") -ResDef(SEC_ERROR_DUPLICATE_CERT, (SEC_ERROR_BASE + 22), +ResDef(SEC_ERROR_DUPLICATE_CERT, (SEC_ERROR_BASE + 22), "The Certificate that you are trying to download\n\ already exists in your database.") -ResDef(SEC_ERROR_DUPLICATE_CERT_NAME, (SEC_ERROR_BASE + 23), +ResDef(SEC_ERROR_DUPLICATE_CERT_NAME, (SEC_ERROR_BASE + 23), "You are trying to download a certificate whose name\n\ is the same as one that already exists in your database.\n\ If you want to download the new certificate you should\n\ delete the old one first.") -ResDef(SEC_ERROR_ADDING_CERT, (SEC_ERROR_BASE + 24), +ResDef(SEC_ERROR_ADDING_CERT, (SEC_ERROR_BASE + 24), "Error adding certificate to your database") -ResDef(SEC_ERROR_FILING_KEY, (SEC_ERROR_BASE + 25), +ResDef(SEC_ERROR_FILING_KEY, (SEC_ERROR_BASE + 25), "Error refiling the key for this certificate") -ResDef(SEC_ERROR_NO_KEY, (SEC_ERROR_BASE + 26), +ResDef(SEC_ERROR_NO_KEY, (SEC_ERROR_BASE + 26), "The Private Key for this certificate can\n\ not be found in your key database") -ResDef(SEC_ERROR_CERT_VALID, (SEC_ERROR_BASE + 27), +ResDef(SEC_ERROR_CERT_VALID, (SEC_ERROR_BASE + 27), "This certificate is valid.") -ResDef(SEC_ERROR_CERT_NOT_VALID, (SEC_ERROR_BASE + 28), +ResDef(SEC_ERROR_CERT_NOT_VALID, (SEC_ERROR_BASE + 28), "This certificate is not valid.") -ResDef(SEC_ERROR_CERT_NO_RESPONSE, (SEC_ERROR_BASE + 29), +ResDef(SEC_ERROR_CERT_NO_RESPONSE, (SEC_ERROR_BASE + 29), "No Response") -ResDef(SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE, (SEC_ERROR_BASE + 30), +ResDef(SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE, (SEC_ERROR_BASE + 30), "The certificate authority that issued this site's\n\ certificate has expired.\n\ Check your system date and time.") -ResDef(SEC_ERROR_CRL_EXPIRED, (SEC_ERROR_BASE + 31), +ResDef(SEC_ERROR_CRL_EXPIRED, (SEC_ERROR_BASE + 31), "The certificate revocation list for this certificate authority\n\ that issued this site's certificate has expired.\n\ Reload a new certificate revocation list or check your system data and time.") -ResDef(SEC_ERROR_CRL_BAD_SIGNATURE, (SEC_ERROR_BASE + 32), +ResDef(SEC_ERROR_CRL_BAD_SIGNATURE, (SEC_ERROR_BASE + 32), "The certificate revocation list for this certificate authority\n\ that issued this site's certificate has an invalid signature.\n\ Reload a new certificate revocation list.") -ResDef(SEC_ERROR_CRL_INVALID, (SEC_ERROR_BASE + 33), +ResDef(SEC_ERROR_CRL_INVALID, (SEC_ERROR_BASE + 33), "The certificate revocation list you are trying to load has\n\ an invalid format.") @@ -1082,240 +1121,240 @@ ResDef(SEC_ERROR_PATH_LEN_CONSTRAINT_INVALID,(SEC_ERROR_BASE + 37), ResDef(SEC_ERROR_CERT_USAGES_INVALID,(SEC_ERROR_BASE + 38), "Certificate usages is invalid.") -ResDef(SEC_INTERNAL_ONLY, (SEC_ERROR_BASE + 39), +ResDef(SEC_INTERNAL_ONLY, (SEC_ERROR_BASE + 39), "**Internal ONLY module**") -ResDef(SEC_ERROR_INVALID_KEY, (SEC_ERROR_BASE + 40), +ResDef(SEC_ERROR_INVALID_KEY, (SEC_ERROR_BASE + 40), "The system tried to use a key which does not support\n\ the requested operation.") ResDef(SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION,(SEC_ERROR_BASE + 41), "Certificate contains unknown critical extension.") -ResDef(SEC_ERROR_OLD_CRL, (SEC_ERROR_BASE + 42), +ResDef(SEC_ERROR_OLD_CRL, (SEC_ERROR_BASE + 42), "The certificate revocation list you are trying to load is not\n\ later than the current one.") -ResDef(SEC_ERROR_NO_EMAIL_CERT, (SEC_ERROR_BASE + 43), +ResDef(SEC_ERROR_NO_EMAIL_CERT, (SEC_ERROR_BASE + 43), "This message cannot be encrypted or signed because you do not\n\ yet have an email certificate. Click on the `Security' icon for more\n\ information about certificates.") -ResDef(SEC_ERROR_NO_RECIPIENT_CERTS_QUERY, (SEC_ERROR_BASE + 44), +ResDef(SEC_ERROR_NO_RECIPIENT_CERTS_QUERY, (SEC_ERROR_BASE + 44), "This message cannot be encrypted because you do not have\n\ certificates for each of the recipients. Clicking on the\n\ `Security' icon will give you more information.\n\ \n\ Turn off encryption and send the message anyway?") -ResDef(SEC_ERROR_NOT_A_RECIPIENT, (SEC_ERROR_BASE + 45), +ResDef(SEC_ERROR_NOT_A_RECIPIENT, (SEC_ERROR_BASE + 45), "The data cannot be decrypted because you are not a recipient;\n\ either it was not intended for you, or a matching certificate or\n\ Private Key cannot be found in your local database.") -ResDef(SEC_ERROR_PKCS7_KEYALG_MISMATCH, (SEC_ERROR_BASE + 46), +ResDef(SEC_ERROR_PKCS7_KEYALG_MISMATCH, (SEC_ERROR_BASE + 46), "The data cannot be decrypted because the key encryption\n\ algorithm it used does not match that of your certificate.") -ResDef(SEC_ERROR_PKCS7_BAD_SIGNATURE, (SEC_ERROR_BASE + 47), +ResDef(SEC_ERROR_PKCS7_BAD_SIGNATURE, (SEC_ERROR_BASE + 47), "Signature verification failed due to no signer found,\n\ too many signers found, or improper or corrupted data.") -ResDef(SEC_ERROR_UNSUPPORTED_KEYALG, (SEC_ERROR_BASE + 48), +ResDef(SEC_ERROR_UNSUPPORTED_KEYALG, (SEC_ERROR_BASE + 48), "An unsupported or unknown key algorithm was encountered;\n\ the current operation cannot be completed.") -ResDef(SEC_ERROR_DECRYPTION_DISALLOWED, (SEC_ERROR_BASE + 49), +ResDef(SEC_ERROR_DECRYPTION_DISALLOWED, (SEC_ERROR_BASE + 49), "The data cannot be decrypted because it was encrypted using an\n\ algorithm or key size which is not allowed by this configuration.") #ifdef FORTEZZA /* Fortezza Alerts */ -ResDef(XP_SEC_FORTEZZA_BAD_CARD, (SEC_ERROR_BASE + 50), +ResDef(XP_SEC_FORTEZZA_BAD_CARD, (SEC_ERROR_BASE + 50), "The Fortezza Card in Socket %d has not been properly initialized.\ Please remove it and return it to your issuer.") -ResDef(XP_SEC_FORTEZZA_NO_CARD, (SEC_ERROR_BASE + 51), +ResDef(XP_SEC_FORTEZZA_NO_CARD, (SEC_ERROR_BASE + 51), "No cards Found") -ResDef(XP_SEC_FORTEZZA_NONE_SELECTED, (SEC_ERROR_BASE + 52), +ResDef(XP_SEC_FORTEZZA_NONE_SELECTED, (SEC_ERROR_BASE + 52), "No Card Selected") -ResDef(XP_SEC_FORTEZZA_MORE_INFO, (SEC_ERROR_BASE + 53), +ResDef(XP_SEC_FORTEZZA_MORE_INFO, (SEC_ERROR_BASE + 53), "Please Select a personality to get more info on") -ResDef(XP_SEC_FORTEZZA_PERSON_NOT_FOUND, (SEC_ERROR_BASE + 54), +ResDef(XP_SEC_FORTEZZA_PERSON_NOT_FOUND, (SEC_ERROR_BASE + 54), "Personality not found") -ResDef(XP_SEC_FORTEZZA_NO_MORE_INFO, (SEC_ERROR_BASE + 55), +ResDef(XP_SEC_FORTEZZA_NO_MORE_INFO, (SEC_ERROR_BASE + 55), "No more information on that Personality") -ResDef(XP_SEC_FORTEZZA_BAD_PIN, (SEC_ERROR_BASE + 56), +ResDef(XP_SEC_FORTEZZA_BAD_PIN, (SEC_ERROR_BASE + 56), "Invalid Pin") -ResDef(XP_SEC_FORTEZZA_PERSON_ERROR, (SEC_ERROR_BASE + 57), +ResDef(XP_SEC_FORTEZZA_PERSON_ERROR, (SEC_ERROR_BASE + 57), "Couldn't initialize personalities") #endif /* FORTEZZA */ -ResDef(SEC_ERROR_NO_KRL, (SEC_ERROR_BASE + 58), +ResDef(SEC_ERROR_NO_KRL, (SEC_ERROR_BASE + 58), "No key revocation list for this site's certificate has been found.\n\ You must load the key revocation list before continuing.") -ResDef(SEC_ERROR_KRL_EXPIRED, (SEC_ERROR_BASE + 59), +ResDef(SEC_ERROR_KRL_EXPIRED, (SEC_ERROR_BASE + 59), "The key revocation list for this site's certificate has expired.\n\ Reload a new key revocation list.") -ResDef(SEC_ERROR_KRL_BAD_SIGNATURE, (SEC_ERROR_BASE + 60), +ResDef(SEC_ERROR_KRL_BAD_SIGNATURE, (SEC_ERROR_BASE + 60), "The key revocation list for this site's certificate has an invalid signature.\n\ Reload a new key revocation list.") -ResDef(SEC_ERROR_REVOKED_KEY, (SEC_ERROR_BASE + 61), +ResDef(SEC_ERROR_REVOKED_KEY, (SEC_ERROR_BASE + 61), "The key for this site's certificate has been revoked.\n\ You will be unable to access this site securely.") -ResDef(SEC_ERROR_KRL_INVALID, (SEC_ERROR_BASE + 62), +ResDef(SEC_ERROR_KRL_INVALID, (SEC_ERROR_BASE + 62), "The key revocation list you are trying to load has\n\ an invalid format.") -ResDef(SEC_ERROR_NEED_RANDOM, (SEC_ERROR_BASE + 63), +ResDef(SEC_ERROR_NEED_RANDOM, (SEC_ERROR_BASE + 63), "The security library is out of random data.") -ResDef(SEC_ERROR_NO_MODULE, (SEC_ERROR_BASE + 64), +ResDef(SEC_ERROR_NO_MODULE, (SEC_ERROR_BASE + 64), "The security library could not find a security module which can\n\ perform the requested operation.") -ResDef(SEC_ERROR_NO_TOKEN, (SEC_ERROR_BASE + 65), +ResDef(SEC_ERROR_NO_TOKEN, (SEC_ERROR_BASE + 65), "The security card or token does not exist, needs to be initialized\n\ or has been removed.") -ResDef(SEC_ERROR_READ_ONLY, (SEC_ERROR_BASE + 66), +ResDef(SEC_ERROR_READ_ONLY, (SEC_ERROR_BASE + 66), "The security library has experienced a database error.\n\ You will probably be unable to connect to this site securely.") -ResDef(SEC_ERROR_NO_SLOT_SELECTED, (SEC_ERROR_BASE + 67), +ResDef(SEC_ERROR_NO_SLOT_SELECTED, (SEC_ERROR_BASE + 67), "No slot or token was selected.") -ResDef(SEC_ERROR_CERT_NICKNAME_COLLISION, (SEC_ERROR_BASE + 68), +ResDef(SEC_ERROR_CERT_NICKNAME_COLLISION, (SEC_ERROR_BASE + 68), "A certificate with the same name already exists.") -ResDef(SEC_ERROR_KEY_NICKNAME_COLLISION, (SEC_ERROR_BASE + 69), +ResDef(SEC_ERROR_KEY_NICKNAME_COLLISION, (SEC_ERROR_BASE + 69), "A key with the same name already exists.") -ResDef(SEC_ERROR_SAFE_NOT_CREATED, (SEC_ERROR_BASE + 70), +ResDef(SEC_ERROR_SAFE_NOT_CREATED, (SEC_ERROR_BASE + 70), "An error occurred while creating safe object") -ResDef(SEC_ERROR_BAGGAGE_NOT_CREATED, (SEC_ERROR_BASE + 71), +ResDef(SEC_ERROR_BAGGAGE_NOT_CREATED, (SEC_ERROR_BASE + 71), "An error occurred while creating safe object") -ResDef(XP_JAVA_REMOVE_PRINCIPAL_ERROR, (SEC_ERROR_BASE + 72), +ResDef(XP_JAVA_REMOVE_PRINCIPAL_ERROR, (SEC_ERROR_BASE + 72), "Couldn't remove the principal") -ResDef(XP_JAVA_DELETE_PRIVILEGE_ERROR, (SEC_ERROR_BASE + 73), +ResDef(XP_JAVA_DELETE_PRIVILEGE_ERROR, (SEC_ERROR_BASE + 73), "Couldn't delete the privilege") -ResDef(XP_JAVA_CERT_NOT_EXISTS_ERROR, (SEC_ERROR_BASE + 74), +ResDef(XP_JAVA_CERT_NOT_EXISTS_ERROR, (SEC_ERROR_BASE + 74), "This principal doesn't have a certificate") -ResDef(SEC_ERROR_BAD_EXPORT_ALGORITHM, (SEC_ERROR_BASE + 75), +ResDef(SEC_ERROR_BAD_EXPORT_ALGORITHM, (SEC_ERROR_BASE + 75), "The operation cannot be performed because the required\n\ algorithm is not allowed by this configuration.") -ResDef(SEC_ERROR_EXPORTING_CERTIFICATES, (SEC_ERROR_BASE + 76), +ResDef(SEC_ERROR_EXPORTING_CERTIFICATES, (SEC_ERROR_BASE + 76), "Unable to export certificates. An error occurred attempting to\n\ export the certificates.") -ResDef(SEC_ERROR_IMPORTING_CERTIFICATES, (SEC_ERROR_BASE + 77), +ResDef(SEC_ERROR_IMPORTING_CERTIFICATES, (SEC_ERROR_BASE + 77), "An error occurred attempting to import the certificates.") -ResDef(SEC_ERROR_PKCS12_DECODING_PFX, (SEC_ERROR_BASE + 78), +ResDef(SEC_ERROR_PKCS12_DECODING_PFX, (SEC_ERROR_BASE + 78), "Unable to import certificates. The file specified is either\n\ corrupt or is not a valid file.") -ResDef(SEC_ERROR_PKCS12_INVALID_MAC, (SEC_ERROR_BASE + 79), +ResDef(SEC_ERROR_PKCS12_INVALID_MAC, (SEC_ERROR_BASE + 79), "Unable to import certificates. Either the integrity password\n\ is incorrect or the data in the file specified has been tampered\n\ with or corrupted in some manner.") -ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_MAC_ALGORITHM, (SEC_ERROR_BASE + 80), +ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_MAC_ALGORITHM, (SEC_ERROR_BASE + 80), "Unable to import certificates. The algorithm used to generate the\n\ integrity information for this file is not supported in the application.") #ifndef MOZ_COMMUNICATOR_NAME -ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_TRANSPORT_MODE, (SEC_ERROR_BASE + 81), +ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_TRANSPORT_MODE, (SEC_ERROR_BASE + 81), "Unable to import certificates. "MOZ_NAME_PRODUCT" only supports password\n\ integrity and password privacy modes for importing certificates.") #else -ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_TRANSPORT_MODE, (SEC_ERROR_BASE + 81), +ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_TRANSPORT_MODE, (SEC_ERROR_BASE + 81), "Unable to import certificates. Communicator only supports password\n\ integrity and password privacy modes for importing certificates.") #endif -ResDef(SEC_ERROR_PKCS12_CORRUPT_PFX_STRUCTURE, (SEC_ERROR_BASE + 82), +ResDef(SEC_ERROR_PKCS12_CORRUPT_PFX_STRUCTURE, (SEC_ERROR_BASE + 82), "Unable to import certificates. The file containing the certificates\n\ is corrupt. Required information is either missing or invalid.") #ifndef MOZ_COMMUNICATOR_NAME -ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_PBE_ALGORITHM, (SEC_ERROR_BASE + 83), +ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_PBE_ALGORITHM, (SEC_ERROR_BASE + 83), "Unable to import certificates. The algorithm used to encrypt the\n\ contents is not supported by "MOZ_NAME_PRODUCT".") #else -ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_PBE_ALGORITHM, (SEC_ERROR_BASE + 83), +ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_PBE_ALGORITHM, (SEC_ERROR_BASE + 83), "Unable to import certificates. The algorithm used to encrypt the\n\ contents is not supported by Communicator.") #endif #ifndef MOZ_COMMUNICATOR_NAME -ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_VERSION, (SEC_ERROR_BASE + 84), +ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_VERSION, (SEC_ERROR_BASE + 84), "Unable to import certificates. The file is a version not supported by\n\ "MOZ_NAME_PRODUCT".") #else -ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_VERSION, (SEC_ERROR_BASE + 84), +ResDef(SEC_ERROR_PKCS12_UNSUPPORTED_VERSION, (SEC_ERROR_BASE + 84), "Unable to import certificates. The file is a version not supported by\n\ Communicator.") #endif -ResDef(SEC_ERROR_PKCS12_PRIVACY_PASSWORD_INCORRECT, (SEC_ERROR_BASE + 85), +ResDef(SEC_ERROR_PKCS12_PRIVACY_PASSWORD_INCORRECT, (SEC_ERROR_BASE + 85), "Unable to import certificates. The privacy password specified is\n\ incorrect.") #ifndef MOZ_COMMUNICATOR_NAME -ResDef(SEC_ERROR_PKCS12_CERT_COLLISION, (SEC_ERROR_BASE + 86), +ResDef(SEC_ERROR_PKCS12_CERT_COLLISION, (SEC_ERROR_BASE + 86), "Unable to import certificates. A certificate with the same nickname,\n\ as one being imported already exists in your "MOZ_NAME_PRODUCT" database.") #else -ResDef(SEC_ERROR_PKCS12_CERT_COLLISION, (SEC_ERROR_BASE + 86), +ResDef(SEC_ERROR_PKCS12_CERT_COLLISION, (SEC_ERROR_BASE + 86), "Unable to import certificates. A certificate with the same nickname,\n\ as one being imported already exists in your Communicator database.") #endif -ResDef(SEC_ERROR_USER_CANCELLED, (SEC_ERROR_BASE + 87), +ResDef(SEC_ERROR_USER_CANCELLED, (SEC_ERROR_BASE + 87), "The user pressed cancel.") -ResDef(SEC_ERROR_PKCS12_DUPLICATE_DATA, (SEC_ERROR_BASE + 88), +ResDef(SEC_ERROR_PKCS12_DUPLICATE_DATA, (SEC_ERROR_BASE + 88), "Certificates could not be imported since they already exist on \ the machine.") -ResDef(SEC_ERROR_MESSAGE_SEND_ABORTED, (SEC_ERROR_BASE + 89), +ResDef(SEC_ERROR_MESSAGE_SEND_ABORTED, (SEC_ERROR_BASE + 89), "Message not sent.") -ResDef(SEC_ERROR_INADEQUATE_KEY_USAGE, (SEC_ERROR_BASE + 90), +ResDef(SEC_ERROR_INADEQUATE_KEY_USAGE, (SEC_ERROR_BASE + 90), "The certificate is not approved for the attempted operation.") -ResDef(SEC_ERROR_INADEQUATE_CERT_TYPE, (SEC_ERROR_BASE + 91), +ResDef(SEC_ERROR_INADEQUATE_CERT_TYPE, (SEC_ERROR_BASE + 91), "The certificate is not approved for the attempted application.") -ResDef(SEC_ERROR_CERT_ADDR_MISMATCH, (SEC_ERROR_BASE + 92), +ResDef(SEC_ERROR_CERT_ADDR_MISMATCH, (SEC_ERROR_BASE + 92), "The email address in the signing certificate does not match\n\ the email address in the message headers. If these two\n\ addresses do not belong to the same person, then this could\n\ be an attempt at forgery.") -ResDef(SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY, (SEC_ERROR_BASE + 93), +ResDef(SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY, (SEC_ERROR_BASE + 93), "Unable to import certificates. An error occurred while attempting\n\ to import the Private Key associated with the certificate being imported.") -ResDef(SEC_ERROR_PKCS12_IMPORTING_CERT_CHAIN, (SEC_ERROR_BASE + 94), +ResDef(SEC_ERROR_PKCS12_IMPORTING_CERT_CHAIN, (SEC_ERROR_BASE + 94), "Unable to import certificates. An error occurred while attempting\n\ to import the certificate chain associated with the certificate\n\ being imported.") @@ -1324,37 +1363,37 @@ ResDef(SEC_ERROR_PKCS12_UNABLE_TO_LOCATE_OBJECT_BY_NAME, (SEC_ERROR_BASE + 95), "Unable to export certificates. An error occurred while trying to locate\n\ a certificate or a key by its nickname.") -ResDef(SEC_ERROR_PKCS12_UNABLE_TO_EXPORT_KEY, (SEC_ERROR_BASE + 96), +ResDef(SEC_ERROR_PKCS12_UNABLE_TO_EXPORT_KEY, (SEC_ERROR_BASE + 96), "Unable to export certificates. The Private Key associated with a\n\ certificate could not be located or could not be exported from the\n\ key database.") -ResDef(SEC_ERROR_PKCS12_UNABLE_TO_WRITE, (SEC_ERROR_BASE + 97), +ResDef(SEC_ERROR_PKCS12_UNABLE_TO_WRITE, (SEC_ERROR_BASE + 97), "Unable to export certificates. An error occurred while trying to write\n\ the export file. Make sure the destination drive is not full and try\n\ exporting again.") -ResDef(SEC_ERROR_PKCS12_UNABLE_TO_READ, (SEC_ERROR_BASE + 98), +ResDef(SEC_ERROR_PKCS12_UNABLE_TO_READ, (SEC_ERROR_BASE + 98), "Unable to import certificates. An error occurred while reading the\n\ import file. Please make sure the file exists and is not corrupt and\n\ then try importing the file again.") -ResDef(SEC_ERROR_PKCS12_KEY_DATABASE_NOT_INITIALIZED, (SEC_ERROR_BASE + 99), +ResDef(SEC_ERROR_PKCS12_KEY_DATABASE_NOT_INITIALIZED, (SEC_ERROR_BASE + 99), "Unable to export certificates. The database which contains\n\ Private Keys has not been initialized. Either your key database\n\ is corrupt or has been deleted. There is no key associated with\n\ this certificate.") -ResDef(SEC_ERROR_KEYGEN_FAIL, (SEC_ERROR_BASE + 100), +ResDef(SEC_ERROR_KEYGEN_FAIL, (SEC_ERROR_BASE + 100), "Unable to generate Public/Private Key Pair.") -ResDef(SEC_ERROR_INVALID_PASSWORD, (SEC_ERROR_BASE + 101), +ResDef(SEC_ERROR_INVALID_PASSWORD, (SEC_ERROR_BASE + 101), "The password you entered is invalid. Please pick a different one.") -ResDef(SEC_ERROR_RETRY_OLD_PASSWORD, (SEC_ERROR_BASE + 102), +ResDef(SEC_ERROR_RETRY_OLD_PASSWORD, (SEC_ERROR_BASE + 102), "You did not enter your old password correctly. Please try again.") -ResDef(SEC_ERROR_BAD_NICKNAME, (SEC_ERROR_BASE + 103), +ResDef(SEC_ERROR_BAD_NICKNAME, (SEC_ERROR_BASE + 103), "The Certificate Name you entered is already in use by another certificate.") ResDef(SEC_ERROR_NOT_FORTEZZA_ISSUER, (SEC_ERROR_BASE + 104), @@ -1379,11 +1418,11 @@ ResDef(SEC_ERROR_JS_ADD_MOD_FAILURE, (SEC_ERROR_BASE + 108), ResDef(SEC_ERROR_JS_DEL_MOD_FAILURE, (SEC_ERROR_BASE + 109), "Unable to delete module") -ResDef(SEC_ERROR_OLD_KRL, (SEC_ERROR_BASE + 110), +ResDef(SEC_ERROR_OLD_KRL, (SEC_ERROR_BASE + 110), "The key revocation list you are trying to load is not\n\ later than the current one.") -ResDef(SEC_ERROR_CKL_CONFLICT, (SEC_ERROR_BASE + 111), +ResDef(SEC_ERROR_CKL_CONFLICT, (SEC_ERROR_BASE + 111), "The CKL you are trying to load has a different issuer\n\ than your current CKL. You must first delete your\n\ current CKL.") @@ -1462,7 +1501,7 @@ ResDef(XP_DIALOG_CONTINUE_BUTTON_STRINGS, (SEC_DIALOG_STRING_BASE + 11), "\ ") ResDef(XP_DIALOG_CANCEL_OK_BUTTON_STRINGS, - (SEC_DIALOG_STRING_BASE + 12), "\ + (SEC_DIALOG_STRING_BASE + 12), "\
  \ Enter your old password:

Enter your new password. Leave \ the password fields blank if you don't want a password.

\
\ %-cont-%") -ResDef(XP_PW_CHANGE_STRINGS_2, (SEC_DIALOG_STRING_BASE + 87), "\ +ResDef(XP_PW_CHANGE_STRINGS_2, (SEC_DIALOG_STRING_BASE + 87), "\ New Password:
Type it again to confirm:\ %-cont-%") -ResDef(XP_PW_CHANGE_STRINGS_3, (SEC_DIALOG_STRING_BASE + 88), "\ +ResDef(XP_PW_CHANGE_STRINGS_3, (SEC_DIALOG_STRING_BASE + 88), "\

Important: Your password cannot be recovered. If \ you forget it, you will lose all of your certificates.") -/* unused (SEC_DIALOG_STRING_BASE + 89) */ +/* unused (SEC_DIALOG_STRING_BASE + 89) */ -ResDef(XP_PW_CHANGE_FAILURE_STRINGS, (SEC_DIALOG_STRING_BASE + 90), "\ +ResDef(XP_PW_CHANGE_FAILURE_STRINGS, (SEC_DIALOG_STRING_BASE + 90), "\ %sec-banner-begin%%0%%sec-banner-end%\ Your attempt to change your password failed.

This may be because your \ %-cont-%") #ifndef MOZ_COMMUNICATOR_NAME -ResDef(XP_PW_CHANGE_FAILURE_STRINGS_1, (SEC_DIALOG_STRING_BASE + 91), "\ +ResDef(XP_PW_CHANGE_FAILURE_STRINGS_1, (SEC_DIALOG_STRING_BASE + 91), "\ key database is inaccessible (which can happen if you were already \ running a "MOZ_NAME_PRODUCT" when you started this one), or because of some other \ %-cont-%") #else -ResDef(XP_PW_CHANGE_FAILURE_STRINGS_1, (SEC_DIALOG_STRING_BASE + 91), "\ +ResDef(XP_PW_CHANGE_FAILURE_STRINGS_1, (SEC_DIALOG_STRING_BASE + 91), "\ key database is inaccessible (which can happen if you were already \ running a Communicator when you started this one), or because of some other \ %-cont-%") #endif -ResDef(XP_PW_CHANGE_FAILURE_STRINGS_2, (SEC_DIALOG_STRING_BASE + 92), "\ +ResDef(XP_PW_CHANGE_FAILURE_STRINGS_2, (SEC_DIALOG_STRING_BASE + 92), "\ error.

It may indicate that your key database file has been corrupted, \ in which case you should try to get it from of a backup, if possible. As \ %-cont-%") -ResDef(XP_PW_CHANGE_FAILURE_STRINGS_3, (SEC_DIALOG_STRING_BASE + 93), "\ +ResDef(XP_PW_CHANGE_FAILURE_STRINGS_3, (SEC_DIALOG_STRING_BASE + 93), "\ a last resort, you may need to delete your key database, after which you \ will have to obtain new personal Certificates.") ResDef(XP_DIALOG_CANCEL_OK_MOREINFO_BUTTON_STRINGS, - (SEC_DIALOG_STRING_BASE + 94), "\ + (SEC_DIALOG_STRING_BASE + 94), "\ \ %-cont-%") ResDef(XP_DIALOG_CANCEL_OK_MOREINFO_BUTTON_STRINGS_1, - (SEC_DIALOG_STRING_BASE + 95), "\ + (SEC_DIALOG_STRING_BASE + 95), "\
\   \ %-cont-%") ResDef(XP_DIALOG_CANCEL_OK_MOREINFO_BUTTON_STRINGS_2, - (SEC_DIALOG_STRING_BASE + 96),"\ + (SEC_DIALOG_STRING_BASE + 96),"\
") -/* unused (SEC_DIALOG_STRING_BASE + 97) */ +/* unused (SEC_DIALOG_STRING_BASE + 97) */ -/* unused (SEC_DIALOG_STRING_BASE + 98) */ +/* unused (SEC_DIALOG_STRING_BASE + 98) */ ResDef(XP_PANEL_ONLY_BUTTON_STRINGS, (SEC_DIALOG_STRING_BASE + 99), "\

%1%") -ResDef( XP_SMIME_RC2_CBC_40, (SEC_DIALOG_STRING_BASE + 161), \ +ResDef( XP_SMIME_RC2_CBC_40, (SEC_DIALOG_STRING_BASE + 161), \ "RC2 encryption in CBC mode with a 40-bit key") -ResDef( XP_SMIME_RC2_CBC_64, (SEC_DIALOG_STRING_BASE + 162), \ +ResDef( XP_SMIME_RC2_CBC_64, (SEC_DIALOG_STRING_BASE + 162), \ "RC2 encryption in CBC mode with a 64-bit key") -ResDef( XP_SMIME_RC2_CBC_128, (SEC_DIALOG_STRING_BASE + 163), \ +ResDef( XP_SMIME_RC2_CBC_128, (SEC_DIALOG_STRING_BASE + 163), \ "RC2 encryption in CBC mode with a 128-bit key") -ResDef( XP_SMIME_DES_CBC, (SEC_DIALOG_STRING_BASE + 164), \ +ResDef( XP_SMIME_DES_CBC, (SEC_DIALOG_STRING_BASE + 164), \ "DES encryption in CBC mode with a 56-bit key") -ResDef( XP_SMIME_DES_EDE3, (SEC_DIALOG_STRING_BASE + 165), \ +ResDef( XP_SMIME_DES_EDE3, (SEC_DIALOG_STRING_BASE + 165), \ "DES EDE3 encryption in CBC mode with a 168-bit key") -ResDef( XP_SMIME_RC5PAD_64_16_40, (SEC_DIALOG_STRING_BASE + 166), \ +ResDef( XP_SMIME_RC5PAD_64_16_40, (SEC_DIALOG_STRING_BASE + 166), \ "RC5 encryption in CBC mode with a 40-bit key") -ResDef( XP_SMIME_RC5PAD_64_16_64, (SEC_DIALOG_STRING_BASE + 167), \ +ResDef( XP_SMIME_RC5PAD_64_16_64, (SEC_DIALOG_STRING_BASE + 167), \ "RC5 encryption in CBC mode with a 64-bit key") -ResDef( XP_SMIME_RC5PAD_64_16_128, (SEC_DIALOG_STRING_BASE + 168), \ +ResDef( XP_SMIME_RC5PAD_64_16_128, (SEC_DIALOG_STRING_BASE + 168), \ "RC5 encryption in CBC mode with a 128-bit key") @@ -2331,7 +2370,7 @@ for: %3%
Signed by: %4%

%5%") -ResDef(XP_USER_CERT_NICKNAME_STRINGS, (SEC_DIALOG_STRING_BASE + 186), "\ +ResDef(XP_USER_CERT_NICKNAME_STRINGS, (SEC_DIALOG_STRING_BASE + 186), "\ You can use the name provided or enter a new one.") ResDef(XP_USER_CERT_DL_MOREINFO_STRINGS, (SEC_DIALOG_STRING_BASE + 187), "\ @@ -2355,31 +2394,31 @@ traditional username and password security methods. For more information \ about Certificates, choose Security Info from the Communicator menu.") #endif -ResDef(XP_USER_CERT_SAVE_STRINGS, (SEC_DIALOG_STRING_BASE + 190), "\ +ResDef(XP_USER_CERT_SAVE_STRINGS, (SEC_DIALOG_STRING_BASE + 190), "\ %sec-banner-begin%%0%%sec-banner-end%\ You should make a copy of your new Certificate.

If you lose your Certificate \ %-cont-%") -ResDef(XP_USER_CERT_SAVE_STRINGS_1, (SEC_DIALOG_STRING_BASE + 191), "\ +ResDef(XP_USER_CERT_SAVE_STRINGS_1, (SEC_DIALOG_STRING_BASE + 191), "\ it cannot be recovered. Only you hold your Private Key. Without it \ you will not be able to read any email that you received using that \ %-cont-%") -ResDef(XP_USER_CERT_SAVE_STRINGS_2, (SEC_DIALOG_STRING_BASE + 192), "\ +ResDef(XP_USER_CERT_SAVE_STRINGS_2, (SEC_DIALOG_STRING_BASE + 192), "\ Certificate.

To make a copy, click Save As and decide where you \ would like to save your Certificate. If possible, you should save it on a \ %-cont-%") -ResDef(XP_USER_CERT_SAVE_STRINGS_3, (SEC_DIALOG_STRING_BASE + 193), "\ +ResDef(XP_USER_CERT_SAVE_STRINGS_3, (SEC_DIALOG_STRING_BASE + 193), "\ floppy disk that you keep in a safe location.

") -ResDef(XP_USER_CERT_SAVE_TITLE, (SEC_DIALOG_STRING_BASE + 194), "\ +ResDef(XP_USER_CERT_SAVE_TITLE, (SEC_DIALOG_STRING_BASE + 194), "\ Save User Certificate") -/* unused (SEC_DIALOG_STRING_BASE + 195) */ +/* unused (SEC_DIALOG_STRING_BASE + 195) */ -/* unused (SEC_DIALOG_STRING_BASE + 196) */ +/* unused (SEC_DIALOG_STRING_BASE + 196) */ #ifndef MOZ_COMMUNICATOR_NAME ResDef(XP_KEY_GEN_DIALOG_STRINGS, (SEC_DIALOG_STRING_BASE + 197), "\ @@ -2549,7 +2588,7 @@ Next>") ResDef(XP_SEC_BACK_KLUDGE, (SEC_DIALOG_STRING_BASE + 233), "\ \ %-cont-%") #else -ResDef(XP_KEY_GEN_MOREINFO_STRINGS_1, (SEC_DIALOG_STRING_BASE + 460), "\ +ResDef(XP_KEY_GEN_MOREINFO_STRINGS_1, (SEC_DIALOG_STRING_BASE + 460), "\ requesting to identify you to Web\ Sites and via Email. You Private Key never leaves your computer, and if you \ choose, will be protected by a Communicator password.

\ %-cont-%") #endif -ResDef(XP_KEY_GEN_MOREINFO_STRINGS_2, (SEC_DIALOG_STRING_BASE + 461), "\ +ResDef(XP_KEY_GEN_MOREINFO_STRINGS_2, (SEC_DIALOG_STRING_BASE + 461), "\ Passwords are particularly important if you are in an environment where other \ people have access to your computer, either physically or over a network. \ %-cont-%") -ResDef(XP_KEY_GEN_MOREINFO_STRINGS_3, (SEC_DIALOG_STRING_BASE + 462), "\ +ResDef(XP_KEY_GEN_MOREINFO_STRINGS_3, (SEC_DIALOG_STRING_BASE + 462), "\ Do not give others your password, because that would allow them to use your \ Certificate to impersonate you.

\ %-cont-%") #ifndef MOZ_COMMUNICATOR_NAME -ResDef(XP_KEY_GEN_MOREINFO_STRINGS_4, (SEC_DIALOG_STRING_BASE + 463), "\ +ResDef(XP_KEY_GEN_MOREINFO_STRINGS_4, (SEC_DIALOG_STRING_BASE + 463), "\ "MOZ_NAME_PRODUCT" uses a complex mathematical operation to generate your private \ key. It may take up to severeal minutes to complete. If you interrupt \ %-cont-%") #else -ResDef(XP_KEY_GEN_MOREINFO_STRINGS_4, (SEC_DIALOG_STRING_BASE + 463), "\ +ResDef(XP_KEY_GEN_MOREINFO_STRINGS_4, (SEC_DIALOG_STRING_BASE + 463), "\ Communicator uses a complex mathematical operation to generate your private \ key. It may take up to severeal minutes to complete. If you interrupt \ %-cont-%") #endif #ifndef MOZ_COMMUNICATOR_NAME -ResDef(XP_KEY_GEN_MOREINFO_STRINGS_5, (SEC_DIALOG_STRING_BASE + 464), "\ +ResDef(XP_KEY_GEN_MOREINFO_STRINGS_5, (SEC_DIALOG_STRING_BASE + 464), "\ "MOZ_NAME_PRODUCT" during this process, it will not create your key, and you will \ have to reapply for your Certificate.") #else -ResDef(XP_KEY_GEN_MOREINFO_STRINGS_5, (SEC_DIALOG_STRING_BASE + 464), "\ +ResDef(XP_KEY_GEN_MOREINFO_STRINGS_5, (SEC_DIALOG_STRING_BASE + 464), "\ Communicator during this process, it will not create your key, and you will \ have to reapply for your Certificate.") #endif -ResDef(XP_PW_MOREINFO_STRINGS, (SEC_DIALOG_STRING_BASE + 465), "\ +ResDef(XP_PW_MOREINFO_STRINGS, (SEC_DIALOG_STRING_BASE + 465), "\ %sec-banner-begin%%0%%sec-banner-end%\ Passwords are particularly important if you are in an environment where other \ %-cont-%") -ResDef(XP_PW_MOREINFO_STRINGS_1, (SEC_DIALOG_STRING_BASE + 466), "\ +ResDef(XP_PW_MOREINFO_STRINGS_1, (SEC_DIALOG_STRING_BASE + 466), "\ people have access to your computer, either physically or over a network. \ Do not give others your password, because that would allow them to use your \ %-cont-%") -ResDef(XP_PW_MOREINFO_STRINGS_2, (SEC_DIALOG_STRING_BASE + 467), "\ +ResDef(XP_PW_MOREINFO_STRINGS_2, (SEC_DIALOG_STRING_BASE + 467), "\ Certificate to impersonate you.

The safest passwords are at least 8 \ characters long, include both letters, and number or symbols, and contain \ no words found in a dictionary.") @@ -3720,15 +3759,15 @@ ResDef(XP_DIALOG_JS_HEADER_STRINGS_WITH_UTF8_CHARSET, (SEC_DIALOG_STRING_BASE + \ %0%