Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9134/src/gui

Modified Files:
        wxOptionsDlg.cpp 
Log Message:
added the possibility to choose the config source to save changes to

Index: wxOptionsDlg.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxOptionsDlg.cpp,v
retrieving revision 1.424
retrieving revision 1.425
diff -b -u -2 -r1.424 -r1.425
--- wxOptionsDlg.cpp    5 Jul 2005 21:25:02 -0000       1.424
+++ wxOptionsDlg.cpp    6 Jul 2005 22:03:04 -0000       1.425
@@ -2364,5 +2364,6 @@
    // some others are not shown when we're inside an identity or folder dialog
    // but only in the global one
-   wxGlobalOptionsDialog *dialog = GET_PARENT_OF_CLASS(this, 
wxGlobalOptionsDialog);
+   wxGlobalOptionsDialog *
+      dialog = GET_PARENT_OF_CLASS(this, wxGlobalOptionsDialog);
    bool isIdentDialog = dialog && !dialog->IsGlobalOptionsDialog();
    bool isFolderDialog = !dialog;
@@ -2546,6 +2547,7 @@
 
    // mark the dialog as being dirty
-   wxOptionsEditDialog *dialog = GET_PARENT_OF_CLASS(this, 
wxOptionsEditDialog);
-   CHECK( dialog, FALSE, _T("option page without option dialog?") );
+   wxOptionsEditDialog *dialog = GetOptionsDialog();
+   if ( !dialog )
+      return false;
 
    if ( m_aVitalControls.Index(control) != -1 )
@@ -2925,4 +2927,6 @@
 bool wxOptionsPage::TransferDataFromWindow()
 {
+   ConfigSource * const configForSave = GetConfigForSave();
+
    String strValue;
    long lValue = 0;
@@ -3028,10 +3032,10 @@
       if ( m_aDefaults[n].IsNumeric() )
       {
-         m_Profile->writeEntry(m_aDefaults[n].name, (int)lValue);
+         m_Profile->writeEntry(m_aDefaults[n].name, (int)lValue, 
configForSave);
       }
       else
       {
          // it's a string
-         m_Profile->writeEntry(m_aDefaults[n].name, strValue);
+         m_Profile->writeEntry(m_aDefaults[n].name, strValue, configForSave);
       }
    }
@@ -3351,16 +3355,8 @@
    {
       // something changed - make us dirty
-      wxOptionsEditDialog *
-         dialog = GET_PARENT_OF_CLASS(this, wxOptionsEditDialog);
-
+      wxOptionsEditDialog *dialog = GetOptionsDialog();
       if ( dialog )
-      {
          dialog->SetDirty();
       }
-      else
-      {
-         FAIL_MSG( _T("options page without a parent dialog?") );
-      }
-   }
 }
 
@@ -3400,6 +3396,6 @@
    {
       // something changed - make us dirty
-      wxOptionsEditDialog *dialog = GET_PARENT_OF_CLASS(this, 
wxOptionsEditDialog);
-      wxCHECK_RET( dialog, _T("options page without a parent dialog?") );
+      wxOptionsEditDialog *dialog = GetOptionsDialog();
+      if ( dialog )
       dialog->SetDirty();
    }
@@ -3460,5 +3456,6 @@
             {
                m_Profile->writeEntry(MP_MSGVIEW_VIEWER,
-                                     m_nameViewers[(size_t)sel]);
+                                     m_nameViewers[(size_t)sel],
+                                     GetConfigForSave());
             }
          }
@@ -3533,4 +3530,7 @@
    CHECK( radio, false, _T("where is the initial selection radio box?") );
 
+   ConfigSource * const configForSave = GetConfigForSave();
+
+   bool showFirstUnread;
    int sel = radio->GetSelection();
    switch ( sel )
@@ -3539,6 +3539,7 @@
       case FolderViewPage_Show_First:
          m_Profile->writeEntry(MP_AUTOSHOW_FIRSTMESSAGE,
-                               sel == FolderViewPage_Show_First);
-         m_Profile->writeEntry(MP_AUTOSHOW_FIRSTUNREADMESSAGE, false);
+                               sel == FolderViewPage_Show_First,
+                               configForSave);
+         showFirstUnread = false;
          break;
 
@@ -3548,7 +3549,11 @@
 
       case FolderViewPage_Show_Unread:
-         m_Profile->writeEntry(MP_AUTOSHOW_FIRSTUNREADMESSAGE, true);
+         showFirstUnread = true;
    }
 
+   m_Profile->writeEntry(MP_AUTOSHOW_FIRSTUNREADMESSAGE,
+                         showFirstUnread,
+                         configForSave);
+
    return true;
 }
@@ -3575,6 +3580,6 @@
    {
       // something changed - make us dirty
-      wxOptionsEditDialog *dialog = GET_PARENT_OF_CLASS(this, 
wxOptionsEditDialog);
-      wxCHECK_RET( dialog, _T("options page without a parent dialog?") );
+      wxOptionsEditDialog *dialog = GetOptionsDialog();
+      if ( dialog )
       dialog->SetDirty();
    }
@@ -3644,5 +3649,7 @@
          else // we're the new home folder
          {
-            profile->writeEntry(MP_FTREE_HOME, GetFolderName());
+            profile->writeEntry(MP_FTREE_HOME,
+                                GetFolderName(),
+                                GetConfigForSave());
          }
       }
@@ -3771,5 +3778,7 @@
          authsDisabled.MakeUpper();
 
-         m_Profile->writeEntry(MP_SMTP_DISABLED_AUTHS, authsDisabled);
+         m_Profile->writeEntry(MP_SMTP_DISABLED_AUTHS,
+                               authsDisabled,
+                               GetConfigForSave());
       }
    }
@@ -4278,6 +4287,6 @@
       if ( ReenablePersistentMessageBoxes(this) )
       {
-         wxOptionsEditDialog *dialog = GET_PARENT_OF_CLASS(this, 
wxOptionsEditDialog);
-         wxCHECK_RET( dialog, _T("options page without a parent dialog?") );
+         wxOptionsEditDialog *dialog = GetOptionsDialog();
+         if ( dialog )
          dialog->SetDirty();
       }
@@ -4296,5 +4305,6 @@
    // TODO this should be table based too probably...
    m_Profile->writeEntry(GetPersMsgBoxName(M_MSGBOX_CONFIRM_EXIT),
-                           !wxPMessageBoxIsDisabled(MP_CONFIRMEXIT));
+                         !wxPMessageBoxIsDisabled(MP_CONFIRMEXIT),
+                         GetConfigForSave());
 
    bool rc = wxOptionsPage::TransferDataToWindow();
@@ -4883,16 +4893,15 @@
       m_sources->AppendRows(1);
 
-      // first config is always the unnamed/local one
-      wxString name = n == 0 ? wxString(_("Local machine"))
-                             : i->GetName().AfterLast(_T('/')),
-               type = i->GetType(),
+      wxString type = i->GetType(),
                spec = i->GetSpec();
 
 #ifdef OS_WIN
+      // special case: the unnamed/local config may use registry and not a file
+      // under Windows
       if ( n == 0 && spec.empty() )
          type = gettext_noop("registry");
 #endif // OS_WIN
 
-      m_sources->SetCellValue(n, Col_Name, name);
+      m_sources->SetCellValue(n, Col_Name, i->GetName());
       m_sources->SetCellValue(n, Col_Type, wxGetTranslation(type));
       m_sources->SetCellValue(n, Col_Spec, spec);



-------------------------------------------------------
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

Reply via email to