Reverting out changes which should have landed on the branch

This commit is contained in:
davidm 1998-05-19 04:06:40 +00:00
parent 4d0b3d4759
commit f32c2dbacb
10 changed files with 1841 additions and 1100 deletions

File diff suppressed because it is too large Load Diff

View File

@ -199,8 +199,32 @@ class CBrowserLanguagesMediator : public CPrefsMediator
LTextColumn *mAddLanguageList;
};
//======================================
#pragma mark
class CBrowserApplicationsMediator : public CPrefsMediator
//======================================
{
public:
#ifdef EDITOR
enum { class_ID = PrefPaneID::eBrowser_Applications };
CBrowserApplicationsMediator(LStream*);
virtual ~CBrowserApplicationsMediator() {};
virtual void ListenToMessage(MessageT inMessage, void *ioParam);
virtual void LoadMainPane();
virtual void WritePrefs();
private:
Boolean mModified; // Have any MIMEs been modified
CMIMEListPane* mMIMETable; // Scrolling table of MIME types
CMimeList mDeletedTypes;
void EditMimeEntry();
void NewMimeEntry();
void DeleteMimeEntry();
};
#ifdef EDITOR
//======================================
#pragma mark
class CEditorMainMediator : public CPrefsMediator

View File

@ -347,10 +347,7 @@ void CMenuTable::HiliteCellActively(const STableCell &inCell, Boolean /* inHilit
StColorPenState::Normalize();
UDrawingUtils::SetHiliteModeOn();
TableIndexT woRow = mCollapsableTree->GetWideOpenIndex(inCell.row);
Uint32 nestingLevel = mCollapsableTree->GetNestingLevel(woRow);
cellFrame.left += (mFirstIndent +nestingLevel*mLevelIndent );
cellFrame.left += (mFirstIndent - 1);
::InvertRect(&cellFrame);
}
}
@ -365,10 +362,7 @@ void CMenuTable::HiliteCellInactively(const STableCell &inCell, Boolean /* inHil
StColorPenState saveColorPen; // Preserve color & pen state
StColorPenState::Normalize();
TableIndexT woRow = mCollapsableTree->GetWideOpenIndex(inCell.row);
Uint32 nestingLevel = mCollapsableTree->GetNestingLevel(woRow);
cellFrame.left += (mFirstIndent +nestingLevel*mLevelIndent );
cellFrame.left += (mFirstIndent - 1);
UDrawingUtils::SetHiliteModeOn();
::PenMode(srcXor);
::FrameRect(&cellFrame);

View File

@ -49,15 +49,9 @@
#include "uapp.h"
#include "CBrowserApplicationsMediator.h"
#include "CLocationIndependenceMediator.h"
// define this to have the prefs dialog open showing the last pane you
// used, with all twisties expanded
#define PREFS_DIALOG_REMEMBERS_PANE
CPrefsDialog* CPrefsDialog::sThis = nil;
PrefPaneID::ID CPrefsDialog::sLastPrefPane = PrefPaneID::eNoPaneSpecified;
CPrefsDialog *CPrefsDialog::sThis = nil;
//-----------------------------------
CPrefsDialog::CPrefsDialog()
@ -76,18 +70,14 @@ CPrefsDialog::~CPrefsDialog()
// all panes are freed by PowerPlant since they are subcommanders of this dialog...
}
//-----------------------------------
void CPrefsDialog::EditPrefs(
Expand_T expand,
PrefPaneID::ID pane,
Selection_T selection)
Expand_T expand,
PrefPaneID::ID pane,
Selection_T selection)
//-----------------------------------
{
#ifdef PREFS_DIALOG_REMEMBERS_PANE
pane = (pane != PrefPaneID::eNoPaneSpecified) ? pane : sLastPrefPane;
#endif
if (sThis)
{
// very suspicious
@ -108,10 +98,6 @@ void CPrefsDialog::EditPrefs(
XP_Bool useIC;
prefResult = PREF_GetBoolPref(useInternetConfigPrefName, &useIC);
CPrefsMediator::UseIC(useIC);
// make sure the prefs cache is empty before we may use it
MPreferenceBase::InitTempPrefCache();
sThis->DoPrefsWindow(expand, pane, selection);
}
@ -181,9 +167,9 @@ void CPrefsDialog::CheckForVCard()
//-----------------------------------
void CPrefsDialog::DoPrefsWindow(
Expand_T expand,
PrefPaneID::ID pane,
Selection_T selection)
Expand_T expand,
PrefPaneID::ID pane,
Selection_T selection)
//-----------------------------------
{
if (!mWindow)
@ -212,17 +198,18 @@ void CPrefsDialog::DoPrefsWindow(
// Now have to collapse the all the rows except appearence
// This is icky
#ifndef PREFS_DIALOG_REMEMBERS_PANE
mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eBrowser_Main ) );
mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eMailNews_Main ) );
#ifdef EDITOR
mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eEditor_Main ) );
#endif // Editor
#ifdef MOZ_MAIL_NEWS
mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eOffline_Main ) );
mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eMailNews_Main ) );
#endif // MOZ_MAIL_NEWS
#ifdef EDITOR
mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eEditor_Main ) );
#endif // EDITOR
#ifdef MOZ_OFFLINE
mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eOffline_Main ) );
#endif // MOZ_OFFLINE
mTable->CollapseRow( mTable->FindMessage ( PrefPaneID::eAdvanced_Main ) );
#endif
mTable->UnselectAllCells();
STableCell initialCell( 1, 1 );
@ -438,21 +425,11 @@ void CPrefsDialog::ListenToMessage(
void CPrefsDialog::Finished()
//-----------------------------------
{
sLastPrefPane = (PrefPaneID::ID)mTable->GetSelectedMessage();
mWindow->DoClose();
mWindow = nil;
sThis = nil;
if (MPreferenceBase::GetWriteOnDestroy()) // the controls wrote themselves
{
// sub-dialogs of the main prefs dialog, e.g. the mail server edit dialog,
// write their prefs into a temporary tree which MPreferenceBase knows about.
// So tell MPreferenceBase to copy these temp prefs into the main prefs, and
// delete that tree.
MPreferenceBase::CopyCachedPrefsToMainPrefs();
PREF_SavePrefFile();
}
delete this;
}
@ -469,10 +446,8 @@ void CPrefsDialog::RegisterViewClasses()
RegisterClass_(CBrowserApplicationsMediator);
RegisterClass_(CAdvancedCacheMediator);
RegisterClass_(CAdvancedProxiesMediator);
CBrowserApplicationsMediator::RegisterViewClasses();
RegisterClass_(CMailNewsIdentityMediator);
#ifdef MOZ_MAIL_NEWS
RegisterClass_(CMailNewsIdentityMediator);
RegisterClass_(CMailNewsMainMediator);
RegisterClass_(CMailNewsMessagesMediator);
RegisterClass_(CMailNewsOutgoingMediator);
@ -480,7 +455,6 @@ void CPrefsDialog::RegisterViewClasses()
RegisterClass_(CMailNewsNewsServerMediator);
RegisterClass_(CReceiptsMediator);
RegisterClass_(CMailNewsDirectoryMediator);
RegisterClass_(CMailNewsAddressingMediator );
#endif // MOZ_MAIL_NEWS
#ifdef EDITOR
RegisterClass_(CEditorMainMediator);
@ -492,7 +466,4 @@ void CPrefsDialog::RegisterViewClasses()
// And a dialog class:
RegisterClass_(CLDAPServerPropDialog);
#endif
#ifdef MOZ_LOC_INDEP
RegisterClass_(CLocationIndependenceMediator);
#endif
} // CPrefsDialog::RegisterViewClasses

View File

@ -67,8 +67,10 @@ class CPrefsDialog
#ifdef MOZ_MAIL_NEWS
, eExpandOffline = PrefPaneID::eOffline_Main
#endif
#ifdef EDITOR
, eExpandAdvanced = PrefPaneID::eAdvanced_Main
, eExpandAll = PrefPaneID::eNoPaneSpecified
#endif
};
enum Selection_T
@ -126,9 +128,7 @@ class CPrefsDialog
static void CheckForVCard();
void Finished();
static CPrefsDialog *sThis;
static PrefPaneID::ID sLastPrefPane;
static CPrefsDialog *sThis;
LWindow *mWindow;
CPrefsMediator *mCurrentMediator;

View File

@ -319,8 +319,8 @@ void CPrefsMediator::ListenToMessage(MessageT inMessage, void */*ioParam*/)
switch (inMessage)
{
case eCommitPrefs:
MPreferenceBase::SetWriteOnDestroy(true);
WritePrefs();
MPreferenceBase::SetWriteOnDestroy(true);
break;
case eCancelPrefs:
Canceled();
@ -615,7 +615,22 @@ void CPrefsMediator::SetPrefWithFolderPopup( const char *prefName,
if (!folderName || !*folderName)
return;
PREF_SetPathPref(prefName, folderName, FALSE);
// make alias
FSSpec fileSpec;
OSErr iErr = CFileMgr::FSSpecFromLocalUnixPath(folderName, &fileSpec);
if (!iErr)
{
AliasHandle aliasH;
iErr = NewAlias(nil, &fileSpec, &aliasH);
if (!iErr)
{
Size lByteCnt = GetHandleSize((Handle)aliasH);
HLock((Handle)aliasH);
PREF_SetBinaryPref(prefName, *aliasH, lByteCnt);
DisposeHandle((Handle)aliasH);
}
}
}
}
#endif // MOZ_MAIL_NEWS
@ -753,3 +768,4 @@ void CPrefsMediator::RegisterViewClasses()
RegisterClass_( CControlExtension);
RegisterClass_(CDragOrderTextList);
}

View File

@ -93,35 +93,17 @@ void CReceiptsMediator::DoCustomDialog()
}
dialog->Show();
dialog->Select();
Int32 popupValue[3];
// Store the dialog popup values in case cancel is hit
for (int32 i =0; i<3; i++ )
{
LGAPopup* popup = dynamic_cast<LGAPopup*>( dialog->FindPaneByID( i+ 1) );
XP_ASSERT( popup );
popupValue[i] = popup->GetValue();
}
MessageT message = msg_Nothing;
do {
message = mCustomDialogHandler->DoDialog();
} while (message != msg_OK && message != msg_Cancel);
} while (message != msg_OK && message != msg_Cancel); // actually, there's no cancel.
// Use the result.
if (message == msg_OK)
{
// Nothing to do, the prefs are written out when the dialog is destroyed.
}
else if ( message == msg_Cancel )
{
// Restore values from when the dialog was first put up
for ( int32 i =0; i<3; i++ )
{
LGAPopup* popup = dynamic_cast<LGAPopup*>( dialog->FindPaneByID( i+ 1) );
XP_ASSERT( popup );
popup->SetValue(popupValue[i]);
}
}
}
catch(...)
{

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,6 @@
#include "CPrefsMediator.h"
#include "MPreference.h"
#include "UNewFolderDialog.h"
#include <LGADialogBox.h>
@ -30,8 +29,6 @@ class LGACheckbox;
class MSG_IMAPHost;
class MSG_Host;
class CDragOrderTextList;
class StDialogHandler;
//======================================
#pragma mark
@ -49,8 +46,8 @@ class CMailNewsIdentityMediator : public CPrefsMediator
virtual void ListenToMessage(MessageT inMessage, void *ioParam);
virtual void UpdateFromIC();
// virtual void UpdateFromIC(); // don't need this because the IC checkbox is on
// this pane
virtual void LoadPrefs();
};
@ -92,16 +89,8 @@ class CMailNewsOutgoingMediator : public CPrefsMediator
virtual void WritePrefs();
virtual void ListenToMessage(MessageT inMessage, void* ioParam);
protected:
void FixCaptionNameForFCC(UFolderDialogs::FolderKind kind, const char* mailOrNews);
void FixCaptionNameForFCC(UFolderDialogs::FolderKind kind, const char* mailOrNews,
Boolean onServer);
protected:
char* mFolderURL[UFolderDialogs::num_kinds];
// indexed by UFolderDialogs::FolderKind
#ifdef HORRIBLE_HACK
Boolean mFolderIsDefault[UFolderDialogs::num_kinds]; // HACK
#endif // HORRIBLE_HACK
#define kNumFolderKinds 4
char* mFolderURL[kNumFolderKinds];
}; // class CMailNewsOutgoingMediator
//======================================
@ -118,54 +107,28 @@ protected:
, mServersDirty(false)
{}
// note that if you add members to this in inheriting classes,
// you need to change the constructor resources to increase the
// list data size
struct CellContents
{
CellContents(const char* inName = nil)
: description(inName) {}
CStr255 description;
CellContents(const char* inName = nil);
Str255 description;
};
Boolean GetHostFromRow(
TableIndexT inRow,
CellContents& outCellData,
UInt32 inDataSize) const;
Boolean GetHostFromSelectedRow(
CellContents& outCellData,
UInt32 inDataSize) const;
Boolean HostExistsElsewhereInTable(
const CStr255& inHostName,
TableIndexT &outFoundRow) const;
void SetHostDataForRow(
TableIndexT inRow,
const CellContents& inCellData,
UInt32 inDataSize) const;
void AppendNewRow(
const CellContents &inCellData,
Uint32 inDataSize,
Boolean inRefresh = true);
void DeleteSelectedRow(
Boolean inRefresh = true);
void UpdateSelectedRow(
const CellContents &inCellData,
Uint32 inDataSize,
Boolean inRefresh = true);
virtual TableIndexT CountRows();
virtual void UpdateButtons();
virtual void AddButton() = 0;
virtual void EditButton() = 0;
virtual void DeleteButton() = 0;
void ClearList();
virtual void LoadList() = 0;
virtual void WriteList() = 0;
virtual Boolean Listen(MessageT inMessage, void *ioParam);
void LoadMainPane();
static Boolean ServerIsInCommaSeparatedList(const char *inServerName, const char *inServerList);
Boolean GetHostFromRow(
TableIndexT inRow,
CellContents& outCellData,
UInt32 inDataSize) const;
Boolean GetHostFromSelectedRow(
CellContents& outCellData,
UInt32 inDataSize) const;
virtual void UpdateButtons();
virtual void AddButton() = 0;
virtual void EditButton() = 0;
virtual void DeleteButton() = 0;
void ClearList();
virtual void LoadList() = 0;
virtual void WriteList() = 0;
virtual Boolean Listen(MessageT inMessage, void *ioParam);
void LoadMainPane();
CPrefsMediator* mMediatorSelf;
CDragOrderTextList* mServerTable;
@ -206,8 +169,7 @@ class CMailNewsMailServerMediator
virtual void LoadPrefs();
virtual void WritePrefs();
static Boolean NoAtSignValidationFunc(CValidEditField *noAtSign);
static Boolean ValidateServerName(const CStr255& inServerName, Boolean inNewServer, const CServerListMediator* inServerList);
static Boolean NoAtSignValidationFunc(CValidEditField *noAtSign);
private:
enum ServerType
@ -216,18 +178,10 @@ class CMailNewsMailServerMediator
ePOPServer = 0,
eIMAPServer = 1
};
Boolean UsingPop() const; // Hope this goes away.
void NoteServerChanges(Boolean inPOP, const CStr255& inServerName);
void SetPOPServerName(const CStr255& inName);
void GetPOPServerName(CStr255& outName) const;
MSG_IMAPHost* FindMSG_Host(const char* inHostName);
Boolean UsingPop() const; // Hope this goes away.
// MServerListMediatorMixin overrides
struct CellContents : public MServerListMediatorMixin::CellContents
{
CellContents() {}
CellContents(const char* inName)
: MServerListMediatorMixin::CellContents(inName) {}
};
virtual void AddButton();
virtual void EditButton();
virtual void DeleteButton();
@ -237,13 +191,11 @@ class CMailNewsMailServerMediator
// Data
protected:
ServerType mServerType;
#ifdef BEFORE_INVISIBLE_POPSERVER_NAME_EDITFIELD_TRICK_WAS_THOUGHT_OF
char* mPopServerName;
#endif
}; // class CMailNewsMailServerMediator
//======================================
#pragma mark
//======================================
class CMailNewsNewsServerMediator
//======================================
: public CServerListMediator
@ -269,7 +221,7 @@ class CMailNewsNewsServerMediator
CellContents(const char* inName, MSG_Host* inHost)
: MServerListMediatorMixin::CellContents(inName)
, serverData(inHost) {}
MSG_Host* serverData;
MSG_Host* serverData;
};
virtual void AddButton();
virtual void EditButton();
@ -315,7 +267,7 @@ class CMailNewsDirectoryMediator
virtual void AddButton();
virtual void EditButton();
virtual void DeleteButton();
virtual void LoadList(); // only call this once, on creating the list for the first time
virtual void LoadList();
virtual void WriteList();
virtual void UpdateButtons();
@ -346,43 +298,11 @@ class COfflineNewsMediator : public CPrefsMediator
virtual ~COfflineNewsMediator() {};
virtual void LoadMainPane();
// virtual void WritePrefs();
virtual void ListenToMessage(
MessageT inMessage,
void *ioParam);
virtual void WritePrefs();
static Boolean SinceDaysValidationFunc(CValidEditField *sinceDays);
}; // class COfflineNewsMediator
#ifdef MOZ_MAIL_NEWS
//======================================
#pragma mark
class CMailNewsAddressingMediator
//======================================
: public CPrefsMediator
{
private:
typedef CPrefsMediator Inherited;
public:
enum { class_ID = PrefPaneID::eMailNews_Addressing, eDirectoryPopup = 'DrPu' };
CMailNewsAddressingMediator(LStream* ): CPrefsMediator( class_ID ), mLDAPList(NULL) {};
virtual ~CMailNewsAddressingMediator()
{
if( mLDAPList )
XP_ListDestroy( mLDAPList );
};
virtual void LoadPrefs();
virtual void WritePrefs();
protected:
XP_List* mLDAPList;
};
#endif // MOZ_MAIL_NEWS
//======================================
class CLDAPServerPropDialog : public LGADialogBox
// This class brings up a dialog for editing the LDAP Server properties (duh). This has

View File

@ -50,24 +50,17 @@ struct PrefPaneID
#ifdef MOZ_MAIL_NEWS
, eMailNews_Messages = 12058
, eMailNews_HTMLFormatting = 12072
, eMailNews_Outgoing = 12073
, eMailNews_Outgoing = 12073 //<-¥¥¥ Current max. Please move as nec.!
, eMailNews_MailServer = 12059
, eMailNews_NewsServer = 12060
, eMailNews_Directory = 12061
, eMailNews_Receipts = 12070
, eMailNews_Addressing = 12071
, eMailNews_SpecialFolders = 12071
#endif // MOZ_MAIL_NEWS
#ifdef EDITOR
, eEditor_Main = 12062
, eEditor_Publish = 12063
#endif // EDITOR
#ifdef MOZ_LOC_INDEP
, eLocationIndependence = 12074
, eLocationIndependence_Server = 12075
, eLocationIndependence_File = 12076 //<-¥¥¥ Current max. Please move as nec.!
#endif // MOZ_LOC_INDEP
#ifdef MOZ_MAIL_NEWS
, eOffline_Main = 12064
, eOffline_News = 12065