Ignore:
Timestamp:
Jan 20, 2010, 12:29:51 PM (14 years ago)
Author:
fnevgeny
Branch:
default
Phase:
public
Message:

Use newly added dialogs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/class/pf/Application.js

    r172 r176  
    17001700                this.prefs.currentConfigName != "Untitled") {
    17011701                if (this.saveConfig(this.prefs.currentConfigName) != true) {
    1702                     alert("Save failed!");
     1702                    this.msgWindow.error("Save failed!");
    17031703                }
    17041704            } else {
     
    17201720           
    17211721            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            }
    17221752        },
    17231753       
     
    17511781            q = new qx.ui.core.Command("Ctrl+R");
    17521782            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);
    17581784                }, this);
    17591785            btn = new qx.ui.menu.Button("Restart", "pf/image/reset.png", q);
     
    17621788            q = new qx.ui.core.Command("Ctrl+Q");
    17631789            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);
    17691791                }, this);
    17701792            btn = new qx.ui.menu.Button("Quit", "pf/image/exit.png", q);
     
    18771899            q = new qx.ui.core.Command("F1");
    18781900            q.addListener("execute", function(ev) {
    1879                 alert("Help system not implemented yet");
    1880             });
     1901                this.msgWindow.info("Help system not implemented yet.");
     1902                }, this);
    18811903            btn = new qx.ui.menu.Button("Help Contents",
    18821904                "pf/image/help.png", q);
     
    21122134            w.setContentPadding(0);
    21132135               
    2114             this.doc.add(w, {left: 200, top: 100});
     2136            this.doc.add(w);
    21152137            this.saveLoadWindow = w;
    21162138
     
    21622184                        var rowData = tm.getRowData(index);
    21632185                        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);
    21692196                        }
    21702197                    }
     
    21762203                        var rowData = tm.getRowData(index);
    21772204                        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);
    21882219                    }
    21892220                }, this);
     
    22262257                    var cfgname = this.saveLoadTextField.getValue();
    22272258                    if (!cfgname) {
    2228                         alert("Please enter a name!");
     2259                        this.msgWindow.error("Please enter a name!");
    22292260                    } else {
    22302261                        var type = w.getUserData("type");
     
    22362267                                }
    22372268                            } else {
    2238                                 alert("Save failed!");
     2269                                this.msgWindow.error("Save failed!");
    22392270                            }
    22402271                        } else {
     
    22442275                                this.saveLoadWindow.close();
    22452276                            } else {
    2246                                 alert("Load failed!");
     2277                                this.msgWindow.error("Load failed!");
    22472278                            }
    22482279                        }
     
    22652296            w.setLayout(new qx.ui.layout.VBox(10));
    22662297
    2267             this.doc.add(w, {left: 200, top: 100});
     2298            this.doc.add(w);
    22682299            this.prefsWindow = w;
    22692300           
     
    23552386                    this.prefs.themeName = btn.getModel();
    23562387                   
    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");
    23592389                }, this);
    23602390
     
    23942424           
    23952425            this.doc = this.getRoot();
    2396             // this.win = this.doc.getWindow();
    23972426           
    23982427            // Load prefs
     
    24742503            w.add(a);
    24752504
    2476             this.doc.add(w, {left: 200, top: 100});
     2505            this.doc.add(w);
    24772506            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);
    24782514           
    24792515            // Handle resize events
Note: See TracChangeset for help on using the changeset viewer.