Changeset 694

Show
Ignore:
Timestamp:
09/07/06 20:45:23 (2 years ago)
Author:
SaqImtiaz
Message:

Implemented new notifications system, including tentative audible notifications.

Location:
Trunk/association/browsertools/TiddlySnip/trunk/content
Files:
4 added
7 modified

Legend:

Unmodified
Added
Removed
  • Trunk/association/browsertools/TiddlySnip/trunk/content/browserOverlay.js

    r645 r694  
    22var pref = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); 
    33 
    4 var tiddlySnipUploading = false;     
     4var tiddlySnipUploading = false; 
    55 
    66// Open prefs window. 
     
    5050        if(tiddlySnipUploading) 
    5151            menus[i].setAttribute("disabled",true); 
    52         else  
     52        else 
    5353            menus[i].setAttribute("disabled",false); 
    5454        } 
  • Trunk/association/browsertools/TiddlySnip/trunk/content/browserOverlay.xul

    r645 r694  
    1111    <script type="application/x-javascript" src="tiddler.js"/> 
    1212    <script type="application/x-javascript" src="upload.js"/> 
     13    <script type="application/x-javascript" src="notifier.js"/> 
    1314 
    1415    <popup id="contentAreaContextMenu"> 
     
    3839            oncommand="tiddlySnipPrefs();" /> 
    3940    </menupopup> 
     41     
     42     
     43      <statusbar id="status-bar"> 
     44    <hbox> 
     45      <popupset style="overflow: auto;"> 
     46        <tooltip id="tiddlysnip-popup" style="max-height: none; max-width: none;" onclick="this.hidePopup();"/> 
     47      </popupset> 
     48    </hbox> 
     49  </statusbar> 
    4050</overlay> 
  • Trunk/association/browsertools/TiddlySnip/trunk/content/categories.js

    r645 r694  
    3535    var selectedIndex = categoriesTree.currentIndex; 
    3636 
    37     /* Ignore the button if no schedule selected */ 
    3837    if(selectedIndex == -1) 
    3938        return; 
     
    137136    } 
    138137 
    139     //add no categories message? 
    140138    //link to edit categories? 
    141     var categories = getCategories(); 
    142     for(var n in categories) 
    143     { 
    144         // Create a new menu item to be added 
    145         var tempItem = document.createElement("menuitem"); 
     139    if (noCategories()) 
     140        { 
     141        var item = document.createElement("menuitem"); 
     142        item.setAttribute("label","No categories defined"); 
     143        menu.appendChild(item); 
     144        } 
     145    else 
     146        { 
     147        var categories = getCategories(); 
     148        for(var n in categories) 
     149            { 
     150            // Create a new menu item to be added 
     151            var tempItem = document.createElement("menuitem"); 
    146152 
    147         // Set the new menu item's label 
    148         tempItem.setAttribute("label",n); 
     153            // Set the new menu item's label 
     154            tempItem.setAttribute("label",n); 
    149155 
    150         //Set the function to fire when clicked 
    151         tempItem.setAttribute("oncommand", "tiddlySnip('"+mode+"','"+ categories[n]+"','"+n+"')"); 
     156            //Set the function to fire when clicked 
     157            tempItem.setAttribute("oncommand", "tiddlySnip('"+mode+"','"+ categories[n]+"','"+n+"')"); 
    152158 
    153         // Add the item to our menu 
    154         menu.appendChild(tempItem); 
    155     } 
     159            // Add the item to our menu 
     160            menu.appendChild(tempItem); 
     161            } 
     162        } 
     163} 
     164 
     165function noCategories() 
     166{ 
     167     var prefString = pref.getCharPref("tiddlysnip.categories"); 
     168     return (prefString == ''); 
    156169} 
    157170 
  • Trunk/association/browsertools/TiddlySnip/trunk/content/prefs.js

    r645 r694  
    3030    prefMap['uploaddir'] = readCharPref("uploaddir"); 
    3131    prefMap['uploadbackupdir'] = readCharPref("uploadbackupdir"); 
     32    prefMap['enablenotifications'] = readBoolPref("enablenotifications"); 
     33    prefMap['enablenotifsounds'] = readBoolPref("enablenotifsounds"); 
    3234 
    3335    document.getElementById("show_uploadpass").value = getUploadPassword(); 
     
    8385    document.getElementById('show_backuppathbutton').setAttribute("disabled", !document.getElementById('show_togglebackuppath').checked || !document.getElementById('show_enablebackups').checked); 
    8486    document.getElementById('show_togglebackuppath').setAttribute("disabled", !document.getElementById('show_enablebackups').checked); 
     87    document.getElementById('show_enablenotifsounds').setAttribute("disabled", !document.getElementById('show_enablenotifications').checked); 
    8588    for (var t=0; t<4; t++) 
    8689        { 
  • Trunk/association/browsertools/TiddlySnip/trunk/content/prefs.xul

    r645 r694  
    6767                                    type="checkbox" 
    6868                                    oncommand="changePref('enableclipboard',this.checked);" 
     69                                    /> 
     70                 <checkbox id="show_enablenotifications" 
     71                                    label="Enable notifications on snippet save" 
     72                                    type="checkbox" 
     73                                    oncommand="changePref('enablenotifications',this.checked);" 
     74                                    /> 
     75                 <checkbox id="show_enablenotifsounds" 
     76                                    label="Enable notifications sounds" 
     77                                    type="checkbox" 
     78                                    class="indent" 
     79                                    oncommand="changePref('enablenotifsounds',this.checked);" 
    6980                                    /> 
    7081                            </vbox> 
  • Trunk/association/browsertools/TiddlySnip/trunk/content/tiddlySnip.js

    r647 r694  
    186186        saveFile(fileLoc,newTW); 
    187187        // call notifications here 
     188        notifier("TiddlySnip","Snippet saved: " + title,true); 
    188189        showTW(title); 
    189190        } 
  • Trunk/association/browsertools/TiddlySnip/trunk/content/upload.js

    r645 r694  
    4545        else status = false; 
    4646        subject.data = status; 
    47     }, 
     47        }, 
    4848 
    4949    register: function() 
     
    5454        }, 
    5555 
    56   unregister: function() 
    57       { 
    58       var observerService = Components.classes["@mozilla.org/observer-service;1"] 
     56    unregister: function() 
     57        { 
     58        var observerService = Components.classes["@mozilla.org/observer-service;1"] 
    5959                            .getService(Components.interfaces.nsIObserverService); 
    60       observerService.removeObserver(tiddlySnipUploadObserver, "quit-application-requested"); 
    61       } 
     60        observerService.removeObserver(tiddlySnipUploadObserver, "quit-application-requested"); 
     61        } 
    6262}; 
    6363 
     
    9797                        if(request.responseText.substr(0,1)==0) 
    9898                            { 
    99                             alert("Snippet saved!"); 
    100                             //callbackFn(request.responseText);  // call notifications function here? 
     99                            notifier("TiddlySnip","Snippet saved: " + title,true); 
    101100                            showTW(title); 
    102101                        } 
    103102                            else 
     103                                { 
    104104                                alert(request.responseText); 
     105                                errorSound(); 
     106                                } 
    105107                    } 
    106                   else 
    107                       alert("Upload failed"); 
     108                else 
     109                    { 
     110                    tiddlySnipUploadObserver.unregister(); 
     111                    alert("Upload failed"); 
     112                    errorSound(); 
     113                    } 
    108114                        } 
    109115                        };