Update of /cvsroot/mahogany/M/src/gui
In directory usw-pr-cvs1:/tmp/cvs-serv15241/src/gui

Modified Files:
        wxFolderView.cpp wxMFrame.cpp wxMainFrame.cpp 
Log Message:
1. use the options of the currently selected folder, not the currently opened
   one, for the composer
2. wxMFrame::GetFolderProfile() now always returns non-NULL, IncRef()'d
   pointer just as wxFolderView method of the same name already did


Index: wxFolderView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderView.cpp,v
retrieving revision 1.556
retrieving revision 1.557
diff -b -u -2 -r1.556 -r1.557
--- wxFolderView.cpp    5 Feb 2002 19:06:55 -0000       1.556
+++ wxFolderView.cpp    4 Mar 2002 17:00:46 -0000       1.557
@@ -4731,4 +4731,14 @@
 
 // ----------------------------------------------------------------------------
+// other wxFolderViewFrame methods
+// ----------------------------------------------------------------------------
+
+Profile *wxFolderViewFrame::GetFolderProfile(void) const
+{
+   return m_FolderView ? m_FolderView->GetFolderProfile()
+                       : wxMFrame::GetFolderProfile();
+}
+
+// ----------------------------------------------------------------------------
 // other public functions (from include/FolderView.h)
 // ----------------------------------------------------------------------------

Index: wxMFrame.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMFrame.cpp,v
retrieving revision 1.149
retrieving revision 1.150
diff -b -u -2 -r1.149 -r1.150
--- wxMFrame.cpp        25 Jan 2002 10:27:36 -0000      1.149
+++ wxMFrame.cpp        4 Mar 2002 17:00:47 -0000       1.150
@@ -173,4 +173,19 @@
 
 // ----------------------------------------------------------------------------
+// misc wxMFrame methods
+// ----------------------------------------------------------------------------
+
+Profile *wxMFrame::GetFolderProfile(void) const
+{
+   Profile *profile = mApplication->GetProfile();
+
+   CHECK( profile, NULL, "no global profile??" );
+
+   profile->IncRef();
+
+   return profile;
+}
+
+// ----------------------------------------------------------------------------
 // wxMFrame creation
 // ----------------------------------------------------------------------------
@@ -534,6 +549,6 @@
             }
 
-            Composer *composeView =
-               Composer::CreateNewMessage(templ, GetFolderProfile());
+            Profile_obj profile(GetFolderProfile());
+            Composer *composeView = Composer::CreateNewMessage(templ, profile);
 
             composeView->InitText();
@@ -547,6 +562,6 @@
       case WXMENU_FILE_POST:
          {
-            Composer *composeView =
-               Composer::CreateNewArticle(GetFolderProfile());
+            Profile_obj profile(GetFolderProfile());
+            Composer *composeView = Composer::CreateNewArticle(profile);
 
             composeView->InitText();

Index: wxMainFrame.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMainFrame.cpp,v
retrieving revision 1.145
retrieving revision 1.146
diff -b -u -2 -r1.145 -r1.146
--- wxMainFrame.cpp     5 Dec 2001 17:32:01 -0000       1.145
+++ wxMainFrame.cpp     4 Mar 2002 17:00:47 -0000       1.146
@@ -202,24 +202,11 @@
    {
       Profile *profile = GetProfile();
-      if ( profile )
-      {
-         profile->IncRef();
-      }
-      else // no opened folder in this folder view
-      {
-         // try the profile for the folder in the tree
-         MFolder_obj folder = m_mainFrame->GetFolderTree()->GetSelection();
-         if ( folder )
-         {
-            profile = Profile::CreateProfile(folder->GetFullName());
-         }
-      }
-
       if ( !profile )
       {
          profile = mApplication->GetProfile();
-         profile->IncRef();
       }
 
+      profile->IncRef();
+
       return profile;
    }
@@ -728,7 +715,21 @@
 
 Profile *
-wxMainFrame::GetFolderProfile(void)
+wxMainFrame::GetFolderProfile(void) const
 {
-   return m_FolderView ? m_FolderView->GetProfile() : NULL;
+   // try the profile for the folder in the tree first: like this, the compose
+   // command will use the settings of the currently selected folder and not
+   // the one currently opened which is usually what you want
+   //
+   // this also allows to use the settings of a folder which you can't open now
+   // (e.g. because you're offline)
+   MFolder_obj folder = GetFolderTree()->GetSelection();
+   if ( folder )
+   {
+      return Profile::CreateProfile(folder->GetFullName());
+   }
+
+   // no current selection but maybe an opened folder (weird, but who knows)?
+   return m_FolderView ? m_FolderView->GetFolderProfile()
+                       : wxMFrame::GetFolderProfile();
 }
 


_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to