Ticket #90: Mulberry.diff

File Mulberry.diff, 10.2 kB (added by hgd, 1 year ago)

Patch that uses preferences

  • Mulberry/MacOS/Sources/Application/Preferences_Dialog/Sub-panels/Letter_Panels/CPrefsLetterStyled.cp

     
    2121 
    2222#include "CAdminLock.h" 
    2323#include "CPreferences.h" 
     24#include "CStringUtils.h" 
     25#include "CTextDisplay.h" 
    2426 
    2527#include <LCheckBox.h> 
    2628#include <LPopupButton.h> 
     
    6971        } 
    7072 
    7173        mFormatFlowed = (LCheckBox*) FindPaneByID(paneid_LSFormatFlowed); 
     74        mReplyPrefixes = (CTextDisplay*) FindPaneByID(paneid_DQReplyPrefixes); 
    7275} 
    7376 
    7477// Set prefs 
     
    8790                mHTMLEnriched->SetValue(copyPrefs->htmlMultiAltEnriched.GetValue()); 
    8891        } 
    8992        mFormatFlowed->SetValue(copyPrefs->mFormatFlowed.GetValue()); 
     93         
     94        cdstring replyPrefixes; 
     95        for(cdstrvect::const_iterator iter = copyPrefs->mRecognizeReplyPrefixes.GetValue().begin(); iter != copyPrefs->mRecognizeReplyPrefixes.GetValue().end(); iter++) 
     96        { 
     97                replyPrefixes += *iter; 
     98                replyPrefixes += os_endl; 
     99        } 
     100        mReplyPrefixes->SetText(replyPrefixes); 
    90101} 
    91102 
    92103// Force update of prefs 
     
    105116                copyPrefs->htmlMultiAltPlain.SetValue((mHTMLPlain->GetValue()==1)); 
    106117        } 
    107118        copyPrefs->mFormatFlowed.SetValue((mFormatFlowed->GetValue()==1)); 
     119         
     120        // Only copy text if dirty 
     121        if (mReplyPrefixes->IsDirty()) 
     122        { 
     123                // Copy handle to text with null terminator 
     124                cdstring txt; 
     125                mReplyPrefixes->GetText(txt); 
     126                 
     127                char* s = ::strtok(txt.c_str_mod(), CR); 
     128                cdstrvect accumulate; 
     129                while(s) 
     130                { 
     131                        cdstring copyStr(s); 
     132                        accumulate.push_back(copyStr); 
     133                         
     134                        s = ::strtok(nil, CR); 
     135                } 
     136                copyPrefs->mRecognizeReplyPrefixes.SetValue(accumulate); 
     137        } 
     138         
    108139} 
  • Mulberry/MacOS/Sources/Application/Preferences_Dialog/Sub-panels/Letter_Panels/CPrefsLetterStyled.h

     
    3333const   PaneIDT         paneid_LSHTMLPlain = 'HTPL'; 
    3434const   PaneIDT         paneid_LSHTMLEnr = 'HTEN'; 
    3535const   PaneIDT         paneid_LSFormatFlowed = 'FLOW'; 
     36const   PaneIDT         paneid_DQReplyPrefixes = 'REPP'; 
    3637 
    3738// Mesages 
    3839 
     
    4142// Classes 
    4243class LCheckBox; 
    4344class LPopupButton; 
     45class CTextDisplay; 
    4446 
    4547class CPrefsLetterStyled : public CPrefsTabSubPanel 
    4648{ 
     
    5153        LCheckBox*              mHTMLPlain; 
    5254        LCheckBox*              mHTMLEnriched; 
    5355        LCheckBox*              mFormatFlowed; 
     56        CTextDisplay*   mReplyPrefixes; 
    5457 
    5558public: 
    5659        enum { class_ID = 'Lsty' }; 
  • Mulberry/MacOS/Sources/Application/General/CMulberryApp.cp

     
    1818// Source for CMulberryApp class 
    1919 
    2020 
    21 #define MAKE_APP                        1 
     21#define MAKE_APP                        0 
    2222 
    2323//#define MEMDEBUG                      1 
    2424 
  • Mulberry/Sources_Common/Automation/CActionManager.cp

     
    985985        const char* osubject = msgs.front()->GetEnvelope()->GetSubject(); 
    986986        if (osubject) 
    987987        { 
    988                 if (((osubject[0]!='R') && (osubject[0]!='r')) || 
     988                if ((((osubject[0]!='R') && (osubject[0]!='r')) || 
    989989                        ((osubject[1]!='E') && (osubject[1]!='e')) || 
    990                         (osubject[2]!=':')) 
     990                        (osubject[2]!=':')) && (((osubject[0]!='A') && (osubject[0]!='a')) || 
     991                                                                        ((osubject[1]!='W') && (osubject[1]!='w')) || 
     992                                                                        (osubject[2]!=':'))) 
    991993                        subject += osubject; 
    992994                else 
    993995                        subject = osubject; 
  • Mulberry/Sources_Common/Application/Letter/CLetterWindowCommon.cp

     
    403403                // Set Subject: text 
    404404                cdstring theTxt; 
    405405                const char* subject = theEnv->GetSubject(); 
     406                 
    406407                if (subject) 
    407408                { 
    408                         if (((subject[0]!='R') && (subject[0]!='r')) || 
    409                                 ((subject[1]!='E') && (subject[1]!='e')) || 
    410                                 (subject[2]!=':')) 
    411                         { 
    412                                 theTxt = "Re: "; 
    413                                 theTxt += subject; 
     409                         
     410                        // Compare to recognized reply prefixes 
     411                        theTxt = "Re: "; 
     412                        theTxt += subject; 
     413                         
     414                        cdstring tmpsubj = subject; 
     415                         
     416                        for(cdstrvect::const_iterator iter = CPreferences::sPrefs->mRecognizeReplyPrefixes.GetValue().begin(); iter != CPreferences::sPrefs->mRecognizeReplyPrefixes.GetValue().end(); iter++) { 
     417                                 
     418                                if (tmpsubj.compare_start(*iter, true) == true) 
     419                                        theTxt = subject; 
    414420                        } 
    415                         else 
    416                                 theTxt = subject; 
     421                         
     422                        // if ((((subject[0]!='R') && (subject[0]!='r')) || 
     423                        //      ((subject[1]!='E') && (subject[1]!='e')) || 
     424                        //       (subject[2]!=':')) && (((subject[0]!='A') && (subject[0]!='a')) || 
     425                        //      ((subject[1]!='W') && (subject[1]!='w')) || 
     426                        //      (subject[2]!=':'))) 
     427                        // { 
     428                        //      theTxt = "Re: "; 
     429                        //      theTxt += subject; 
     430                        // } 
     431                        // else 
     432                        //      theTxt = subject; 
    417433                } 
    418434                SetSubject(theTxt); 
    419435                mReplySubject = theTxt; 
  • Mulberry/Sources_Common/Application/Preferences/CPreferencesBits.cp

     
    291291        COPY(mDisplayIdentityFrom) 
    292292        COPY(mAutoSaveDrafts) 
    293293        COPY(mAutoSaveDraftsInterval) 
     294        COPY(mRecognizeReplyPrefixes) 
    294295 
     296 
    295297//--------------------Security 
    296298        COPY(mPreferredPlugin) 
    297299        COPY(mUseMIMESecurity) 
     
    792794        NOTEQUAL(mDisplayIdentityFrom) 
    793795        NOTEQUAL(mAutoSaveDrafts) 
    794796        NOTEQUAL(mAutoSaveDraftsInterval) 
     797        NOTEQUAL(mRecognizeReplyPrefixes) 
    795798 
    796799        // Test Formatting Prefs 
    797800        NOTEQUAL(mURLStyle) 
     
    12901293        SETDIRTY(mDisplayIdentityFrom) 
    12911294        SETDIRTY(mAutoSaveDrafts) 
    12921295        SETDIRTY(mAutoSaveDraftsInterval) 
     1296        SETDIRTY(mRecognizeReplyPrefixes) 
    12931297 
    12941298        // Test Formatting Prefs 
    12951299        SETDIRTY(mURLStyle) 
  • Mulberry/Sources_Common/Application/Preferences/CPreferences.h

     
    208208        CPreferenceValueMap<CColourList>                        mQuoteColours;                                          // Multiple colours for quotes 
    209209        CPreferenceValueMap<cdstrvect>                          mRecognizeQuotes;                                       // Quotes to recognize 
    210210        CPreferenceValueMap<cdstrvect>                          mRecognizeURLs;                                         // URLs to recognize 
     211        CPreferenceValueMap<cdstrvect>                          mRecognizeReplyPrefixes;                        // Reply prefixes to recognize 
    211212 
    212213#if __dest_os == __linux_os 
    213214        CPreferenceValueMap<RGBColor>                           mSelectionColour;                                       // Colour for selections 
  • Mulberry/Sources_Common/Application/Preferences/CPreferenceKeys.h

     
    227227                extern const char* cRecognizeQuotesKey_2_0;             // New in v2.0b6 
    228228                extern const char* cRecognizeURLsKey_1_4;               // Deprecated format as of v2.0b6 
    229229                extern const char* cRecognizeURLsKey_2_0;               // New in v2.0b6 
     230                extern const char* cRecognizeReplyPrefixesKey; 
    230231#if __dest_os == __linux_os 
    231232                extern const char* cSelectionColourKey;                 // New in v2.0.6b3 
    232233#endif 
  • Mulberry/Sources_Common/Application/Preferences/CPreferencesXtra.cp

     
    618618        mDisplayIdentityFrom.mValue = true; 
    619619        mAutoSaveDrafts.mValue = true; 
    620620        mAutoSaveDraftsInterval.mValue = 60; 
     621        mRecognizeReplyPrefixes.mValue.push_back("re:"); 
     622        mRecognizeReplyPrefixes.mValue.push_back("aw:"); 
     623        mRecognizeReplyPrefixes.mValue.push_back("sv:"); 
     624         
    621625} 
    622626 
    623627void CPreferences::InitSecurityPrefs() 
  • Mulberry/Sources_Common/Application/Preferences/CPreferencesRW.cp

     
    417417                WRITETOMAP(mDisplayIdentityFrom, cDisplayIdentityFrom)          // >= v4.0b2 
    418418                WRITETOMAP(mAutoSaveDrafts, cAutoSaveDraftsKey)                         // >= v4.0.3 
    419419                WRITETOMAP(mAutoSaveDraftsInterval, cAutoSaveDraftsIntervalKey)                         // >= v4.0.3 
     420                WRITETOMAP(mRecognizeReplyPrefixes, cRecognizeReplyPrefixesKey) // >= v4.0.9b1 
     421 
    420422        } 
    421423 
    422424//--------------------Security Prefs 
     
    14971499                READFROMMAP(mDisplayIdentityFrom, cDisplayIdentityFrom) 
    14981500                READFROMMAP(mAutoSaveDrafts, cAutoSaveDraftsKey) 
    14991501                READFROMMAP(mAutoSaveDraftsInterval, cAutoSaveDraftsIntervalKey) 
     1502                READFROMMAP(mRecognizeReplyPrefixes, cRecognizeReplyPrefixesKey) 
    15001503 
    15011504                // < v1.4 - convert old fields into new default identity 
    15021505                if (VersionTest(vers_prefs, VERS_1_4_0) < 0) 
  • Mulberry/Sources_Common/Application/Preferences/CPreferenceKeys.cp

     
    242242                const char* cRecognizeQuotesKey_2_0 = "Recognized Quotes v2_0";                 // New in v2.0b6 
    243243                const char* cRecognizeURLsKey_1_4 = "Recognized URLs";                                  // Deprecated format as of v2.0b6 
    244244                const char* cRecognizeURLsKey_2_0 = "Recognized URLs v2_0";                             // New in v2.0b6 
     245                const char* cRecognizeReplyPrefixesKey = "Recognized Reply Prefixes"; 
    245246#if __dest_os == __linux_os 
    246247                const char* cSelectionColourKey = "Selection Colour "OS_PART;                   // New in v2.0.6b3 
    247248#endif