Changeset f606f9


Ignore:
Timestamp:
Jul 4, 2008, 2:31:43 PM (13 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
65eabe
Parents:
c76460
Message:

added default folders for fcc, drafts and templates to prevent broken output in settings dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chrome/content/v_identity/vI_prefDialog.js

    rc76460 rf606f9  
    373373var tmplFolderPickerId = "msgStationeryFolderPicker";
    374374
     375function setDefaultCopiesAndFoldersPrefs(identity, server, accountData)
     376{
     377    var am = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
     378    var rootFolder = am.defaultAccount.incomingServer.rootFolder
     379
     380    var fccElement = document.getElementById("VIdent_identity.fccFolder")
     381    var fccElementValue = fccElement.getAttribute("value");
     382    if (!fccElementValue) fccElement.setAttribute("value", rootFolder.server.serverURI + gFccFolderWithDelim)
     383
     384    var draftElement = document.getElementById("VIdent_identity.draftFolder")
     385    var draftElementValue = draftElement.getAttribute("value");
     386    if (!draftElementValue) draftElement.setAttribute("value", rootFolder.server.serverURI + gDraftsFolderWithDelim)
     387
     388    var stationeryElement = document.getElementById("VIdent_identity.stationeryFolder")
     389    var stationeryElementValue = stationeryElement.getAttribute("value");
     390    if (!stationeryElementValue) stationeryElement.setAttribute("value", rootFolder.server.serverURI + gTemplatesFolderWithDelim)
     391}
     392
     393
    375394function onInitCopiesAndFolders()
    376395{
     396    SetSpecialFolderNamesWithDelims();
    377397    SetGlobalRadioElemChoices();
    378                      
     398
     399    setDefaultCopiesAndFoldersPrefs();
     400
    379401    SetFolderDisplay(gFccRadioElemChoice, gFccRadioElemChoiceLocked,
    380402                     "VIdent_fcc",
     
    394416                     "VIdent_identity.stationeryFolder",
    395417                     tmplFolderPickerId);
    396    
     418
    397419    setupFccItems();
    398 
    399     SetSpecialFolderNamesWithDelims();
    400420}
    401421
     
    417437    gTmplRadioElemChoiceLocked = pickerModeElement.getAttribute("disabled");
    418438    if (!gTmplRadioElemChoice) gTmplRadioElemChoice = gDefaultPickerMode;
    419    
    420     //~ alert(gFccRadioElemChoice + " " + gDraftsRadioElemChoice + " " + gTmplRadioElemChoice)
    421439}
    422440
     
    443461    var folderPicker = document.getElementById(folderPickerId);
    444462    var rg = selectAccountRadioElem.radioGroup;
     463
    445464    var folderPickedElement = document.getElementById(folderPickedField);
    446465    var uri = folderPickedElement.getAttribute("value");
     
    450469    // For POP3 accounts, special folders are created at the account creation time.
    451470    var msgFolder = GetMsgFolderFromUri(uri, false);
    452     if (msgFolder) SetFolderPicker(msgFolder.server.serverURI, accountPickerId);
    453     else SetFolderPicker("", accountPickerId);
    454     InitFolderDisplay(folderPickedField, folderPickerId);
     471    SetFolderPicker(msgFolder.server.serverURI, accountPickerId);
     472    SetFolderPicker(uri, folderPickerId);
     473
    455474    switch (pickerMode)
    456475    {
     
    490509}
    491510
    492 // Initialize the folder display based on prefs values
    493 function InitFolderDisplay(fieldname, pickerId) {
    494     var formElement = document.getElementById(fieldname);
    495     var uri = formElement.getAttribute("value");
    496     SetFolderPicker(uri,pickerId);
    497 }
    498 
    499511// Capture any menulist changes
    500512function noteSelectionChange(radioItemId)
     
    582594            uri = picker.getAttribute("uri");
    583595            if (uri) {
    584                 // Create  Folder URI
    585                 uri = uri + folderSuffix;
    586 
     596                uri = uri + folderSuffix;   // Create  Folder URI
    587597                formElement = document.getElementById(folderElementId);
    588598                formElement.setAttribute("value",uri);
     
    594604            uri = picker.getAttribute("uri");
    595605            if (uri) {
    596                 SaveUriFromPicker(folderElementId, folderPickerId);
     606                formElement = document.getElementById(folderElementId);
     607                formElement.setAttribute("value",uri);
    597608            }
    598609            break;
     
    604615    formElement = document.getElementById(folderPickerModeId);
    605616    formElement.setAttribute("value", radioElemChoice);
    606 }
    607 
    608 // Get the URI from the picker and save the value into the corresponding pref
    609 function SaveUriFromPicker(fieldName, pickerId)
    610 {
    611     var picker = document.getElementById(pickerId);
    612     var uri = picker.getAttribute("uri");
    613    
    614     var formElement = document.getElementById(fieldName);
    615     formElement.setAttribute("value",uri);
    616617}
    617618
     
    670671    SetPickerEnabling(enablePickerId, disablePickerId);
    671672
    672     var selectedElementUri;
    673673    var radioElemValue = event.target.value;
    674674   
     
    710710            break;
    711711     }
    712     //~ SetFolderPicker(selectedElementUri, enablePickerId);
    713712}
    714713
Note: See TracChangeset for help on using the changeset viewer.