Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

89
LINES

< > BotCompany Repo | #1020554 // VNC Viewer Tray Icon

JavaX source code (Dynamic Module) [tags: @@3CJeP archive archiveoCtjp7Gp archivesblVwkkG use-pretranspiled] - run with: Stefan's OS

Uses 1689K of libraries. Click here for Pure Java version (23770L/126K).

1  
!7
2  
3  
concept Profile {
4  
  S name, options;
5  
  S computerID; // to send clipboard etc (optional)
6  
  S passwordID; // global ID to send to #1029670
7  
8  
  bool hasPassword() { ret nempty(passwordID); }
9  
  bool hasComputerID() { ret nempty(computerID); }
10  
}
11  
12  
cmodule2 VNCViewerTrayIcon > DynCRUD<Profile> {
13  
  transient TrayIcon trayIcon;
14  
  switchable bool inProcess; // don't think true works yet
15  
  transient ReliableSingleThread rstMakeTrayIcon = dm_rst(this, r makeTrayIcon);
16  
17  
  SimpleCRUD<Profile> makeCRUD() {
18  
    var crud = super.makeCRUD();
19  
    //crud.editOnDoubleClick = false;
20  
    ret crud;
21  
  }
22  
  
23  
  start {
24  
    db();
25  
    onConceptsChangeAndNow(r { doLater(2.0, rstMakeTrayIcon) });
26  
  }
27  
28  
  void makeTrayIcon enter {
29  
    disposeTrayIcon(trayIcon);
30  
    new L menuItems; // no left-click action
31  
    for (Profile p : sortConceptsByID(list(Profile)))
32  
      if (nemptyAfterTrim(p.options))
33  
        addAll(menuItems, "VNC to " + p.name, rThread { launch(p) });
34  
    add(menuItems, "---");
35  
    L<Profile> withComputerID = filter(p -> p.hasComputerID(), list(Profile));
36  
    if (nempty(withComputerID)) {
37  
      for (Profile p : withComputerID) {
38  
        addAll(menuItems, "Send clipboard to " + p.name, rThreadEnter { dm_sendClipboardTo_verbose(p.computerID) });
39  
        addAll(menuItems, "Grab clipboard from " + p.name, rThreadEnter { dm_grabClipboardFrom_verbose(p.computerID) });
40  
      }
41  
      add(menuItems, "---");
42  
    }
43  
    addAll(menuItems, "VNC Viewer Connection Dialog", rThread { if (inProcess) launchVNCViewer_inProcess(); else launchVNCViewer() });
44  
    addAll(menuItems, "Edit Profiles...", rThread dm_activateOSAndModule);
45  
    pcall {
46  
      trayIcon = installTrayIcon(#1101468, "Start VNC Viewer", menuItems);
47  
    }
48  
  }
49  
  
50  
  afterVisualize {
51  
    // TODO: disable when at beginning/end of list
52  
    addSelectionDependentButton("Move Up", r {
53  
      Profile a = selected(), b = itemBefore(list(), a);
54  
      if (a != null && b != null)
55  
        swapConceptIDs(a, b);
56  
    });
57  
    addSelectionDependentButton("Move Down", r {
58  
      Profile a = selected(), b = itemAfter(list(), a);
59  
      if (a != null && b != null)
60  
        swapConceptIDs(a, b);
61  
    });
62  
    addSelectionDependentButton("Connect", rThreadEnter {
63  
      launch(selected());
64  
    });
65  
66  
    tablePopupMenu_first(table(), voidfunc(JPopupMenu menu, int row) {
67  
      Profile p = selected(), ret if null;
68  
      addMenuItem(menu, "Connect", r { launch(p) });
69  
      if (p.hasPassword())
70  
        addMenuItem(menu, "Copy password", rThreadEnter { copyPassword(p) });
71  
      if (p.hasComputerID())
72  
        addMenuItem(menu, "Send clipboard there", rThreadEnter { dm_sendClipboardTo_verbose(p.computerID) });
73  
    });
74  
  }
75  
76  
  void cleanMeUp {
77  
    disposeTrayIcon(trayIcon);
78  
  }
79  
80  
  void copyPassword(Profile p) {
81  
    dm_copyPasswordForGlobalIDToClipboard(p.passwordID);
82  
  }
83  
84  
  void launch(Profile p) {
85  
    if (p == null) ret;
86  
    copyPassword(p);
87  
    if (inProcess) launchVNCViewer_inProcess(p.options); else launchVNCViewer(p.options);
88  
  }
89  
}

download  show line numbers  debug dex  old transpilations   

Relations

Travelled to 10 computer(s): bhatertpkbcr, cfunsshuasjs, gjtlkbvenryc, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

Comments [hide]

ID Author/Program Comment Date
2311 ncmufcmu 555 2024-10-01 04:08:41
2309 ncmufcmu 555 2024-10-01 04:08:41
2308 ncmufcmu 555 2024-10-01 04:04:32
2307 ncmufcmu 555 2024-10-01 04:04:32
2306 ncmufcmu 555 2024-10-01 04:04:32
2305 ncmufcmu 555 2024-10-01 04:04:32
2304 ncmufcmu 555 2024-10-01 04:04:31
2303 ncmufcmu 555 2024-10-01 04:04:29
2301 ncmufcmu 555 2024-10-01 04:04:25
2300 ncmufcmu 555 2024-10-01 04:04:23
2299 ncmufcmu 555 2024-10-01 04:04:22
2298 ncmufcmu 555 2024-10-01 04:04:20
2297 ncmufcmu 555 2024-10-01 04:04:19
2296 ncmufcmu 555 2024-10-01 04:04:18
2295 ncmufcmu 555 2024-10-01 04:04:17
2294 ncmufcmu 555 2024-10-01 04:04:16
2291 ncmufcmu 555 2024-10-01 04:04:13
2285 ncmufcmu 555 2024-10-01 04:04:12
2284 ncmufcmu 555 2024-10-01 04:04:12
2283 ncmufcmu @@yPopw 2024-10-01 04:04:12
2282 ncmufcmu 555????%2527%2522\'\" 2024-10-01 04:04:12
2281 ncmufcmu 555'" 2024-10-01 04:04:12
2280 ncmufcmu 555 2024-10-01 04:04:12
2279 ncmufcmu 555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||' 2024-10-01 04:04:12
2278 ncmufcmu 555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15) 2024-10-01 04:04:11
2277 ncmufcmu 555J7eTHuqM')) OR 893=(SELECT 893 FROM PG_SLEEP(15))-- 2024-10-01 04:04:11
2276 ncmufcmu 5551GXWhmhy') OR 388=(SELECT 388 FROM PG_SLEEP(15))-- 2024-10-01 04:04:10
2275 ncmufcmu 5553Dzz3Phi' OR 28=(SELECT 28 FROM PG_SLEEP(15))-- 2024-10-01 04:04:10
2274 ncmufcmu 555-1)) OR 405=(SELECT 405 FROM PG_SLEEP(15))-- 2024-10-01 04:04:08
2273 ncmufcmu 555-1) OR 797=(SELECT 797 FROM PG_SLEEP(15))-- 2024-10-01 04:04:08
2272 ncmufcmu 555-1 OR 524=(SELECT 524 FROM PG_SLEEP(15))-- 2024-10-01 04:04:05
2271 ncmufcmu 555prg9C5E9'; waitfor delay '0:0:15' -- 2024-10-01 04:04:05
2270 ncmufcmu 555-1 waitfor delay '0:0:15' -- 2024-10-01 04:04:05
2269 ncmufcmu 555-1); waitfor delay '0:0:15' -- 2024-10-01 04:04:04
2268 ncmufcmu 555-1; waitfor delay '0:0:15' -- 2024-10-01 04:04:04
2267 ncmufcmu (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/ 2024-10-01 04:04:04
2266 ncmufcmu 5550"XOR(555*if(now()=sysdate(),sleep(15),0))XOR"Z 2024-10-01 04:04:04
2265 ncmufcmu 5550'XOR(555*if(now()=sysdate(),sleep(15),0))XOR'Z 2024-10-01 04:04:04
2264 ncmufcmu 555*if(now()=sysdate(),sleep(15),0) 2024-10-01 04:04:04
2263 ncmufcmu -1" OR 2+571-571-1=0+0+0+1 -- 2024-10-01 04:04:04
2262 ncmufcmu -1' OR 2+277-277-1=0+0+0+1 or 'V2HSnZGR'=' 2024-10-01 04:04:04
2261 ncmufcmu -1' OR 2+727-727-1=0+0+0+1 -- 2024-10-01 04:04:04
2260 ncmufcmu -1 OR 2+391-391-1=0+0+0+1 2024-10-01 04:04:04
2259 ncmufcmu -1 OR 2+674-674-1=0+0+0+1 -- 2024-10-01 04:04:04
2258 ncmufcmu 555 2024-10-01 04:04:04
2257 ncmufcmu 555 2024-10-01 04:04:03
2233 ncmufcmu 555 2024-10-01 04:03:41
2157 ncmufcmu 555 2024-10-01 04:02:45
2156 ncmufcmu 555 2024-10-01 04:02:45
2155 ncmufcmu 555 2024-10-01 04:02:45
2154 ncmufcmu 555 2024-10-01 04:02:45
2153 ncmufcmu 555 2024-10-01 04:02:45
2152 ncmufcmu 555 2024-10-01 04:02:44
2151 ncmufcmu 555 2024-10-01 04:02:43
2150 ncmufcmu 555 2024-10-01 04:02:42
2149 ncmufcmu 555 2024-10-01 04:02:41
2148 ncmufcmu 555 2024-10-01 04:02:41
2147 ncmufcmu 555 2024-10-01 04:02:40
2146 ncmufcmu 555 2024-10-01 04:02:39
2145 ncmufcmu 555 2024-10-01 04:02:38

add comment

Snippet ID: #1020554
Snippet name: VNC Viewer Tray Icon
Eternal ID of this version: #1020554/53
Text MD5: 8d2f2b9c03a0540f5207a288e3205819
Transpilation MD5: fb791ecf3633e64811a17f211b5a7263
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): Yes
Created/modified: 2024-09-27 15:22:28
Source code size: 2978 bytes / 89 lines
Pitched / IR pitched: No / No
Views / Downloads: 925 / 12891
Version history: 52 change(s)
Referenced in: [show references]