Przeglądaj źródła

Add basic support for closing windows to webui

Fixes issue 4314

Change-Id: I62af278b04867b23e83f4319c56780db9ea00e16
Reviewed-on: http://gerrit.dmdirc.com/1468
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
tags/0.6.5
Chris Smith 14 lat temu
rodzic
commit
155db175d0

+ 17
- 0
src/com/dmdirc/addons/ui_web/res/javascript/dmdirc.js Wyświetl plik

@@ -22,6 +22,11 @@ function setSpeed(what, speed) {
22 22
     document.getElementById(what + '_' + speed).style.textDecoration = 'underline';
23 23
 }
24 24
 
25
+function treeview_remove(id) {
26
+    var el = document.getElementById(id);
27
+    el.parentNode.removeChild(el);
28
+}
29
+
25 30
 function treeview_add(name, id, type, parent) {
26 31
     var parentNode;
27 32
 
@@ -400,6 +405,16 @@ function window_create(window, parent) {
400 405
         onException:excFunc, onSuccess: handlerFunc})
401 406
 }
402 407
 
408
+function window_close(id) {
409
+    treeview_remove(id);
410
+    windows.unset(id);
411
+
412
+    if (activeWindow == id) {
413
+        // TODO: Focus another window, or reset textview/title/etc if there
414
+        //       are no more windows
415
+    }
416
+}
417
+
403 418
 function window_show(id) {
404 419
     treeview_setactive(id);
405 420
     title_settext(windows.get(id).title)
@@ -483,6 +498,8 @@ function handlerFunc(transport) {
483 498
             profiles_add(event.arg1);
484 499
         } else if (event.type == 'newwindow') {
485 500
             window_create(event.arg1);
501
+        } else if (event.type == 'closewindow') {
502
+            window_close(event.arg1);
486 503
         } else if (event.type == 'newchildwindow') {
487 504
             window_create(event.arg1[1], event.arg1[0]);
488 505
         } else if (event.type == 'clearwindow') {

+ 1
- 1
src/com/dmdirc/addons/ui_web/res/style.css Wyświetl plik

@@ -78,7 +78,7 @@ body {
78 78
 }
79 79
 
80 80
 #treeview li {
81
-    list-style-image: url('/static/images/dmdirc.gif');
81
+    list-style-image: url('/dmdirc/icon.png');
82 82
     margin: 3px 0px;
83 83
     padding: 0px;
84 84
 }

+ 1
- 1
src/com/dmdirc/addons/ui_web/uicomponents/WebWindow.java Wyświetl plik

@@ -202,7 +202,7 @@ public class WebWindow implements Window, IRCDocumentListener, FrameInfoListener
202 202
     /** {@inheritDoc} */
203 203
     @Override
204 204
     public void close() {
205
-        //TODO FIXME
205
+        DynamicRequestHandler.addEvent(new Event("closewindow", myID));
206 206
     }
207 207
 
208 208
     public String getType() {

Ładowanie…
Anuluj
Zapisz