Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13704/src/gui
Modified Files:
wxDialogLayout.cpp wxOptionsDlg.cpp
Log Message:
removed ConfigSource parameter from Profile::writeEntty(); added Profile:: and
MFolder::SetConfigSourceForWriting()
Index: wxDialogLayout.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxDialogLayout.cpp,v
retrieving revision 1.115
retrieving revision 1.116
diff -b -u -2 -r1.115 -r1.116
--- wxDialogLayout.cpp 6 Jul 2005 22:02:05 -0000 1.115
+++ wxDialogLayout.cpp 7 Jul 2005 18:48:45 -0000 1.116
@@ -116,4 +116,5 @@
EVT_BUTTON(wxID_APPLY, wxOptionsEditDialog::OnApply)
EVT_BUTTON(wxID_CANCEL, wxOptionsEditDialog::OnCancel)
+ EVT_CHOICE(-1, wxOptionsEditDialog::OnConfigSourceChange)
END_EVENT_TABLE()
@@ -1240,7 +1241,7 @@
m_profileForButtons = NULL;
- m_configForSave = NULL;
-
m_lastBtn = MEventOptionsChangeData::Invalid;
+
+ m_changedConfigSource = false;
}
@@ -1422,21 +1423,4 @@
bool wxOptionsEditDialog::TransferDataFromWindow()
{
- // first decide where to save the changes
- m_configForSave = NULL;
- if ( m_chcSources )
- {
- const int sel = m_chcSources->GetSelection();
- if ( sel != -1 )
- {
- AllConfigSources::List::iterator
- i = AllConfigSources::Get().GetSources().begin();
- for ( int n = 0; n < sel; n++ )
- ++i;
-
- m_configForSave = i.operator->();
- }
- }
-
- // now do save them
const int count = m_notebook->GetPageCount();
for ( int nPage = 0; nPage < count; nPage++ )
@@ -1492,4 +1476,58 @@
}
+void wxOptionsEditDialog::OnConfigSourceChange(wxCommandEvent& event)
+{
+ if ( event.GetEventObject() != m_chcSources )
+ {
+ event.Skip();
+ return;
+ }
+
+ const int sel = m_chcSources->GetSelection();
+ ConfigSource *config = NULL;
+ if ( sel != -1 )
+ {
+ AllConfigSources::List::iterator
+ i = AllConfigSources::Get().GetSources().begin();
+ for ( int n = 0; n < sel; n++ )
+ ++i;
+
+ config = i.operator->();
+ }
+
+ Profile *profile = GetProfile();
+ wxCHECK_RET( profile, _T("no profile in wxOptionsEditDialog?") );
+
+ ConfigSource *configOld = profile->SetConfigSourceForWriting(config);
+
+ // remember the original config source if this is the first time we change
+ // it
+ if ( !m_changedConfigSource )
+ {
+ m_configOld = configOld;
+ m_changedConfigSource = true;
+ }
+}
+
+void wxOptionsEditDialog::EndModal(int rc)
+{
+ if ( m_changedConfigSource )
+ {
+ Profile *profile = GetProfile();
+ if ( profile )
+ {
+ profile->SetConfigSourceForWriting(m_configOld);
+ }
+ else
+ {
+ FAIL_MSG( _T("no profile in wxOptionsEditDialog?") );
+ }
+
+ m_changedConfigSource = false;
+ }
+
+ wxManuallyLaidOutDialog::EndModal(rc);
+}
+
void wxOptionsEditDialog::EnableButtons(bool enable)
{
Index: wxOptionsDlg.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxOptionsDlg.cpp,v
retrieving revision 1.425
retrieving revision 1.426
diff -b -u -2 -r1.425 -r1.426
--- wxOptionsDlg.cpp 6 Jul 2005 22:03:04 -0000 1.425
+++ wxOptionsDlg.cpp 7 Jul 2005 18:48:52 -0000 1.426
@@ -2927,6 +2927,4 @@
bool wxOptionsPage::TransferDataFromWindow()
{
- ConfigSource * const configForSave = GetConfigForSave();
-
String strValue;
long lValue = 0;
@@ -3032,10 +3030,10 @@
if ( m_aDefaults[n].IsNumeric() )
{
- m_Profile->writeEntry(m_aDefaults[n].name, (int)lValue,
configForSave);
+ m_Profile->writeEntry(m_aDefaults[n].name, (int)lValue);
}
else
{
// it's a string
- m_Profile->writeEntry(m_aDefaults[n].name, strValue, configForSave);
+ m_Profile->writeEntry(m_aDefaults[n].name, strValue);
}
}
@@ -3456,6 +3454,5 @@
{
m_Profile->writeEntry(MP_MSGVIEW_VIEWER,
- m_nameViewers[(size_t)sel],
- GetConfigForSave());
+ m_nameViewers[(size_t)sel]);
}
}
@@ -3530,6 +3527,4 @@
CHECK( radio, false, _T("where is the initial selection radio box?") );
- ConfigSource * const configForSave = GetConfigForSave();
-
bool showFirstUnread;
int sel = radio->GetSelection();
@@ -3539,6 +3534,5 @@
case FolderViewPage_Show_First:
m_Profile->writeEntry(MP_AUTOSHOW_FIRSTMESSAGE,
- sel == FolderViewPage_Show_First,
- configForSave);
+ sel == FolderViewPage_Show_First);
showFirstUnread = false;
break;
@@ -3552,7 +3546,5 @@
}
- m_Profile->writeEntry(MP_AUTOSHOW_FIRSTUNREADMESSAGE,
- showFirstUnread,
- configForSave);
+ m_Profile->writeEntry(MP_AUTOSHOW_FIRSTUNREADMESSAGE, showFirstUnread);
return true;
@@ -3649,7 +3641,5 @@
else // we're the new home folder
{
- profile->writeEntry(MP_FTREE_HOME,
- GetFolderName(),
- GetConfigForSave());
+ profile->writeEntry(MP_FTREE_HOME, GetFolderName());
}
}
@@ -3778,7 +3768,5 @@
authsDisabled.MakeUpper();
- m_Profile->writeEntry(MP_SMTP_DISABLED_AUTHS,
- authsDisabled,
- GetConfigForSave());
+ m_Profile->writeEntry(MP_SMTP_DISABLED_AUTHS, authsDisabled);
}
}
@@ -4305,6 +4293,5 @@
// TODO this should be table based too probably...
m_Profile->writeEntry(GetPersMsgBoxName(M_MSGBOX_CONFIRM_EXIT),
- !wxPMessageBoxIsDisabled(MP_CONFIRMEXIT),
- GetConfigForSave());
+ !wxPMessageBoxIsDisabled(MP_CONFIRMEXIT));
bool rc = wxOptionsPage::TransferDataToWindow();
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates