Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24170/src/gui
Modified Files:
wxOptionsDlg.cpp
Log Message:
fixed non-working buttons in the compose page of the identity edit dialog
Index: wxOptionsDlg.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxOptionsDlg.cpp,v
retrieving revision 1.404
retrieving revision 1.405
diff -b -u -2 -r1.404 -r1.405
--- wxOptionsDlg.cpp 21 Mar 2004 02:26:11 -0000 1.404
+++ wxOptionsDlg.cpp 21 Apr 2004 21:54:20 -0000 1.405
@@ -727,4 +727,7 @@
}
+protected:
+ Profile *GetProfile() const { return m_profile; }
+
private:
// the number and descriptions of the pages we show
@@ -753,5 +756,4 @@
Profile *profile = Profile::CreateIdentity(identity);
SetProfile(profile);
- profile->DecRef(); // SetProfile() will hold on it
// set the pages descriptions: we use the standard pages of the options
@@ -777,4 +779,16 @@
virtual bool IsGlobalOptionsDialog() const { return FALSE; }
+protected:
+ // handle button clicks
+ void OnButton(wxCommandEvent& event);
+
+ enum
+ {
+ Page_Ident,
+ Page_Network,
+ Page_Compose,
+ Page_Max
+ };
+
private:
// create our pages desc: do it dynamically because they may depend on the
@@ -789,4 +803,5 @@
wxOptionsPageDesc *m_aPages;
+ DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxIdentityOptionsDialog)
};
@@ -864,4 +879,9 @@
END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(wxIdentityOptionsDialog, wxCustomOptionsDialog)
+ EVT_BUTTON(-1, wxIdentityOptionsDialog::OnButton)
+END_EVENT_TABLE()
+
// ============================================================================
// data: both of these arrays *must* be in sync with ConfigFields enum!
@@ -3169,36 +3189,39 @@
void wxOptionsPageCompose::OnButton(wxCommandEvent& event)
{
- bool dirty;
+ if ( !HandleButton(m_Profile, event.GetEventObject(), this) )
+ event.Skip();
+}
- wxObject *obj = event.GetEventObject();
- if ( obj == GetControl(ConfigField_ComposeHeaders) )
+/* static */ bool
+wxOptionsPageCompose::HandleButton(Profile *profile,
+ wxObject *obj,
+ wxOptionsPage *win)
+{
+ bool dirty = false;
+
+ if ( win->IsControl(obj, ConfigField_ComposeHeaders) )
{
// create and show the "outgoing headers" config dialog
- dirty = ConfigureComposeHeaders(m_Profile, this);
+ dirty = ConfigureComposeHeaders(profile, win);
}
- else if ( obj == GetControl(ConfigField_ComposeTemplates) )
+ else if ( win->IsControl(obj, ConfigField_ComposeTemplates) )
{
- dirty = ConfigureTemplates(m_Profile, this);
+ dirty = ConfigureTemplates(profile, win);
}
- else if ( obj == GetControl(ConfigField_XFaceFile) )
+ else if ( win->IsControl(obj, ConfigField_XFaceFile) )
{
- dirty = PickXFaceDialog(m_Profile, this);
- if(dirty)
+ if ( PickXFaceDialog(profile, win) )
{
+ dirty = true;
+
wxXFaceButton *btn = (wxXFaceButton*)obj;
- // Why doesn't UpdateUI() have the same effect here?
- if(READ_CONFIG(m_Profile, MP_COMPOSE_USE_XFACE))
- btn->SetFile(READ_CONFIG(m_Profile,MP_COMPOSE_XFACE_FILE));
- else
- btn->SetFile(_T(""));
+ btn->SetFile(READ_CONFIG_BOOL(profile, MP_COMPOSE_USE_XFACE)
+ ? READ_CONFIG(profile, MP_COMPOSE_XFACE_FILE)
+ : String());
}
}
- else
+ else // not our button
{
- FAIL_MSG(_T("click from alien button in compose view page"));
-
- dirty = FALSE;
-
- event.Skip();
+ return false;
}
@@ -3206,10 +3229,18 @@
{
// 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 = GET_PARENT_OF_CLASS(win, wxOptionsEditDialog);
+ if ( dialog )
+ {
dialog->SetDirty();
}
+ else
+ {
+ FAIL_MSG( _T("options page without a parent dialog?") );
+ }
+ }
+
+ return true;
}
@@ -4492,10 +4523,10 @@
size_t nOffset;
- m_nPages = 3;
- m_aPages = new wxOptionsPageDesc[3];
+ m_nPages = Page_Max;
+ m_aPages = new wxOptionsPageDesc[Page_Max];
// identity page
nOffset = ConfigField_IdentFirst + 1;
- m_aPages[0] = wxOptionsPageDesc
+ m_aPages[Page_Ident] = wxOptionsPageDesc
(
_("Identity"),
@@ -4510,5 +4541,5 @@
// network page
nOffset = ConfigField_NetworkFirst + 1;
- m_aPages[1] = wxOptionsPageDesc
+ m_aPages[Page_Network] = wxOptionsPageDesc
(
_("Network"),
@@ -4523,5 +4554,5 @@
// compose page
nOffset = ConfigField_ComposeFirst + 1;
- m_aPages[2] = wxOptionsPageDesc
+ m_aPages[Page_Compose] = wxOptionsPageDesc
(
_("Compose"),
@@ -4533,5 +4564,21 @@
nOffset
);
-};
+}
+
+void wxIdentityOptionsDialog::OnButton(wxCommandEvent& event)
+{
+ // for now the only buttons we have in this dialog are in the compose page
+ wxObject * const btn = event.GetEventObject();
+ if ( !wxOptionsPageCompose::HandleButton
+ (
+ GetProfile(),
+ btn,
+ (wxOptionsPage *)m_notebook->GetPage(Page_Compose)
+ ) )
+ {
+ // must be one of the std buttons
+ event.Skip();
+ }
+}
// ----------------------------------------------------------------------------
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates