Changeset 176:e4cebe9dc525 for source/class/pf
- Timestamp:
- Jan 20, 2010, 12:29:51 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/class/pf/Application.js
r172 r176 1700 1700 this.prefs.currentConfigName != "Untitled") { 1701 1701 if (this.saveConfig(this.prefs.currentConfigName) != true) { 1702 alert("Save failed!");1702 this.msgWindow.error("Save failed!"); 1703 1703 } 1704 1704 } else { … … 1720 1720 1721 1721 w.open(); 1722 }, 1723 1724 restart : function(force) 1725 { 1726 if (force || this.intendedExit || !this.prefs.warnOnExit) { 1727 location.reload(true); 1728 } else { 1729 this.confirmDialog.confirm("Restart Plasma Formulary?", 1730 function(yesno) { 1731 if (yesno) { 1732 this.intendedExit = true; 1733 this.restart(true); 1734 } 1735 }, this); 1736 } 1737 }, 1738 1739 quit : function(force) 1740 { 1741 if (force || this.intendedExit || !this.prefs.warnOnExit) { 1742 window.close(true); 1743 } else { 1744 this.confirmDialog.confirm("Quit Plasma Formulary?", 1745 function(yesno) { 1746 if (yesno) { 1747 this.intendedExit = true; 1748 this.quit(true); 1749 } 1750 }, this); 1751 } 1722 1752 }, 1723 1753 … … 1751 1781 q = new qx.ui.core.Command("Ctrl+R"); 1752 1782 q.addListener("execute", function(ev) { 1753 if (!this.prefs.warnOnExit || 1754 confirm("Restart Plasma Formulary?")) { 1755 this.intendedExit = true; 1756 location.reload(true); 1757 } 1783 this.restart(false); 1758 1784 }, this); 1759 1785 btn = new qx.ui.menu.Button("Restart", "pf/image/reset.png", q); … … 1762 1788 q = new qx.ui.core.Command("Ctrl+Q"); 1763 1789 q.addListener("execute", function(ev) { 1764 if (!this.prefs.warnOnExit || 1765 confirm("Quit Plasma Formulary?")) { 1766 this.intendedExit = true; 1767 window.close(); 1768 } 1790 this.quit(false); 1769 1791 }, this); 1770 1792 btn = new qx.ui.menu.Button("Quit", "pf/image/exit.png", q); … … 1877 1899 q = new qx.ui.core.Command("F1"); 1878 1900 q.addListener("execute", function(ev) { 1879 alert("Help system not implemented yet");1880 });1901 this.msgWindow.info("Help system not implemented yet."); 1902 }, this); 1881 1903 btn = new qx.ui.menu.Button("Help Contents", 1882 1904 "pf/image/help.png", q); … … 2112 2134 w.setContentPadding(0); 2113 2135 2114 this.doc.add(w , {left: 200, top: 100});2136 this.doc.add(w); 2115 2137 this.saveLoadWindow = w; 2116 2138 … … 2162 2184 var rowData = tm.getRowData(index); 2163 2185 var name = rowData[0]; 2164 if (confirm("Delete \"" + name + "\"?")) { 2165 var index = sm.getLeadSelectionIndex(); 2166 var rowData = tm.getRowData(index); 2167 this.removeConfig(rowData[0]); 2168 this.updateSaveLoadList(); 2186 if (name == this.prefs.currentConfigName) { 2187 this.msgWindow.error("Cannot delete current configuration!"); 2188 } else { 2189 this.confirmDialog.confirm("Delete \"" + name + "\"?", 2190 function(yesno) { 2191 if (yesno) { 2192 this.removeConfig(name); 2193 this.updateSaveLoadList(); 2194 } 2195 }, this); 2169 2196 } 2170 2197 } … … 2176 2203 var rowData = tm.getRowData(index); 2177 2204 var name = rowData[0]; 2178 var newname = prompt("Rename \"" + name + "\" to", name); 2179 if (newname && newname != name) { 2180 this.renameConfig(name, newname); 2181 this.updateSaveLoadList(); 2182 if (name == this.prefs.currentConfigName) { 2183 this.prefs.currentConfigName = newname; 2184 this.gui_configName.setLabel(newname); 2185 } 2186 this.saveLoadTextField.setValue(newname); 2187 } 2205 2206 2207 this.promptDialog.prompt("Rename \"" + name + "\" to", 2208 name, function(newname) { 2209 if (newname && newname != name) { 2210 this.renameConfig(name, newname); 2211 this.updateSaveLoadList(); 2212 if (name == this.prefs.currentConfigName) { 2213 this.prefs.currentConfigName = newname; 2214 this.gui_configName.setLabel(newname); 2215 } 2216 this.saveLoadTextField.setValue(newname); 2217 } 2218 }, this); 2188 2219 } 2189 2220 }, this); … … 2226 2257 var cfgname = this.saveLoadTextField.getValue(); 2227 2258 if (!cfgname) { 2228 alert("Please enter a name!");2259 this.msgWindow.error("Please enter a name!"); 2229 2260 } else { 2230 2261 var type = w.getUserData("type"); … … 2236 2267 } 2237 2268 } else { 2238 alert("Save failed!");2269 this.msgWindow.error("Save failed!"); 2239 2270 } 2240 2271 } else { … … 2244 2275 this.saveLoadWindow.close(); 2245 2276 } else { 2246 alert("Load failed!");2277 this.msgWindow.error("Load failed!"); 2247 2278 } 2248 2279 } … … 2265 2296 w.setLayout(new qx.ui.layout.VBox(10)); 2266 2297 2267 this.doc.add(w , {left: 200, top: 100});2298 this.doc.add(w); 2268 2299 this.prefsWindow = w; 2269 2300 … … 2355 2386 this.prefs.themeName = btn.getModel(); 2356 2387 2357 // this.applyTheme(); 2358 alert("New theme will be applied after restart of the application"); 2388 this.msgWindow.info("New theme will be applied after restart of the application"); 2359 2389 }, this); 2360 2390 … … 2394 2424 2395 2425 this.doc = this.getRoot(); 2396 // this.win = this.doc.getWindow();2397 2426 2398 2427 // Load prefs … … 2474 2503 w.add(a); 2475 2504 2476 this.doc.add(w , {left: 200, top: 100});2505 this.doc.add(w); 2477 2506 this.aboutWindow = w; 2507 2508 this.msgWindow = new pf.ui.MessageWindow(); 2509 this.doc.add(this.msgWindow); 2510 this.confirmDialog = new pf.ui.ConfirmDialog(); 2511 this.doc.add(this.confirmDialog); 2512 this.promptDialog = new pf.ui.PromptDialog(); 2513 this.doc.add(this.promptDialog); 2478 2514 2479 2515 // Handle resize events
Note: See TracChangeset
for help on using the changeset viewer.