-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQR_shellui.js
85 lines (77 loc) · 4.17 KB
/
QR_shellui.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var EFSCmdQRfObj=null,EFSCmdQRAddCon=null;var sCurLang="";
function OnNewShellUI( shellUI ) {
return {
OnNewShellFrame: function ( shellFrame ) {
customData = shellFrame; customData.bShowPrintButton=bShowPrintButton;customData.bShowCopyButton=bShowCopyButton;customData.bShowAboutButton=bShowAboutButton;customData.bShowHelpButton=bShowHelpButton;customData.AddCon=bAddVaultConCmd;
// custom action
function showEFS(bAddConCmd) {
if (bAddConCmd) customData.AddCon=true; else customData.AddCon=false;
try {
if (shellFrame.ActiveListing.CurrentSelection.GetObjectVersionsCount()>0||shellFrame.ActiveListing.CurrentSelection.Folders.Count>=0) {
if (sCurLang.substring(0,2)=="de") {shellFrame.ShowPopupDashboard( "QR_de", false, customData );} else {shellFrame.ShowPopupDashboard( "QR_en", false, customData );}
}
} catch (e) { }
}
function toggleMenu( EFSShown ) {
shellFrame.Commands.SetCommandState( EFSCmdQRfObj, CommandLocation_All, ( EFSShown ? CommandState_Hidden : CommandState_Active ) );
if (customData.AddCon) shellFrame.Commands.SetCommandState( EFSCmdQRAddCon, CommandLocation_All, ( EFSShown ? CommandState_Hidden : CommandState_Active ) );
}
// Return ShellFrame Event Handlers
return {
OnStarted: function () {
var vault = shellFrame.ShellUI.Vault;var sVaultLang=String(vault.UserSettingOperations.GetVaultLanguage()).toLowerCase();var langPriority ="";var bIsMFWeb=false;
try {
langPriority = navigator.language || navigator.userLanguage;bIsMFWeb=true;
} catch (e) {
langPriority = vault.SessionInfo.ClientCulture; bIsMFWeb=false;
}
if (sVaultLang=="auto"||sVaultLang=="0"||sVaultLang=="undefined") sCurLang = langPriority; else sCurLang = sVaultLang;
sCurLang=String(sCurLang).toLowerCase();
if (sCurLang.substring(0,2)=="de") {
customData.lang="de";
EFSCmdQRfObj = shellFrame.Commands.CreateCustomCommand( "QR-Mobilelink abrufen...");
if (customData.AddCon) EFSCmdQRAddCon = shellFrame.Commands.CreateCustomCommand( "QR-Mobile Vaultverbindung hinzufügen...");
}
else {
customData.lang="en"; //default
EFSCmdQRfObj = shellFrame.Commands.CreateCustomCommand( "Get QR-Mobilelink...");
if (customData.AddCon) EFSCmdQRAddCon = shellFrame.Commands.CreateCustomCommand( "Add QR-Mobile Vault Connection...");
}
shellFrame.Commands.AddCustomCommandToMenu( EFSCmdQRfObj, MenuLocation_ContextMenu_Misc2_Middle, 0 );
if (customData.AddCon) shellFrame.Commands.AddCustomCommandToMenu( EFSCmdQRAddCon, MenuLocation_ContextMenu_Misc1_Bottom, 0 );
// Register handler to listen custom commands.
shellFrame.Commands.Events.Register(Event_CustomCommand, function(command) {
if(command == EFSCmdQRAddCon) showEFS(true);
else if(command == EFSCmdQRfObj) showEFS(false);
});
},
OnNewShellListing: function ( shellListing ) {
var isCommandInMenu = false;
// Called when a new shell listing is created.
// Return new shell listing Event Handlers
return {
OnStarted: function () {
// Called when a new shell listing is started.
toggleMenu( false ); isCommandInMenu = true;
},
OnSelectionChanged: function (selItems) {
if (shellFrame.CurrentPath!="") {
ShowEFSMenu(false,isCommandInMenu,shellFrame,EFSCmdQRfObj);
}
}
}
} // End ShellFrame Event Handlers
}
} // End ShellUI Event Handlers
}
}
function ShowEFSMenu(bHide, isCommandInMenu, shellFrame, EFSCmdQRfObj) {
if (bHide&&isCommandInMenu) {
shellFrame.Commands.SetCommandState( EFSCmdQRfObj, CommandLocation_All, CommandState_Hidden );
if (customData.AddCon) shellFrame.Commands.SetCommandState( EFSCmdQRAddCon, CommandLocation_All, CommandState_Hidden );
}
else {
if (customData.AddCon) shellFrame.Commands.SetCommandState(EFSCmdQRAddCon, MenuLocation_ContextMenu_Misc1_Bottom, CommandState_Active);
shellFrame.Commands.SetCommandState( EFSCmdQRfObj, MenuLocation_ContextMenu_Misc2_Middle, CommandState_Active );
}
}