How to know the applet mode in Siebel Open UI - siebel

Does Siebel Open UI have a way of knowing the mode of an applet. For instance Query Mode, Edit Mode or New Mode ?
Thanks in advance

If you are in an event context and cannot access the PM, you can try looking for active controls that are only active/visible in specific modes.
Here is some generic code I use to confirm no applets in the view are in Query Mode, by confirming there are no Go/ExecuteQuery buttons with a specific class visible:
var eQueryBtnCount = $("body").find(".siebui-icon-executequery").filter(function() {return $(this).css('display') !== 'none';}).length;
if (eQueryBtnCount < 1) {
// Do Something that is not available in Query Mode
}

BC have a flag to identify if the applet is in query mode or not.
pm.Get("GetBusComp").IsInQueryState()
This will give you a true or false. Hope this helps.

There is a method in siebel open ui with which you can get the mode of the current applet..
SiebelApp.S_App.GetActiveView().GetApplet("Applet_Name").GetMode();
this will return the mode of current applet

pm.Get("GetMode");
pm.Get("IsInQueryMode")

This is a method in Siebel OpenUI for getting the applet mode:
this.GetPM().Get("GetMode");

Related

Disable QTRadioButton click [duplicate]

Any good way to make a checkbox readonly, but also not grayed-out (hardly visible).
I have used setEnabled(bool) which works, but the checkbox then is grayed-out and hardly readable
I can react on a toggle signal and reset the state. But I would need a kind of flag to determine if the box is read-only and then reset the check state, means I need to create my own CheckBox class.
setCheckable does not work either, it does not allow me to set a checked state at all:
cb = this->ui->cb_RealWorld->isCheckable();
this->ui->cb_RealWorld->setCheckable(true);
this->ui->cb_RealWorld->setChecked(someValue);
this->ui->cb_RealWorld->setCheckable(cb);
So the best thing I have is to use enable/disable and accept the grayed out style.
------- Edit -------
Following the stylesheet examples I was hoping I could set the style of a disabled checkbox like the one of an enabled. Failed so far to do so. More specific: Changing the icon like in the examples does not work for me, maybe because I am using Windows and the icons are not available under the path as in the examples.
PS: Related, but no answer here
Disabling a QCheckbox in a tricky way
Qt - How to disable QCheckBox while retaining checked state?
Following the below my code:
this->ui->cb_RealWorld->setAttribute(Qt::WA_TransparentForMouseEvents);
this->ui->cb_RealWorld->setFocusPolicy(Qt::NoFocus);
This is Devopia's solution as a function:
void SetReadOnly(QCheckBox* checkBox, bool readOnly)
{
checkBox->setAttribute(Qt::WA_TransparentForMouseEvents, readOnly);
checkBox->setFocusPolicy(readOnly ? Qt::NoFocus : Qt::StrongFocus);
}
On Windows, remember to #include "windows.h" and set flags as follows:
this->ui->cb_RealWorld->setWindowFlags(this->ui->cb_RealWorld->windowFlags() | Qt::WindowTransparentForInput);
Inherit from QCheckBox and override nextCheckState method https://doc.qt.io/qt-5/qcheckbox.html#nextCheckState do the trick.
void ReadOnlyCheckBox::nextCheckState()
{
}

How to create a session for Run Dialog in Appium?

By using powershell command I can get the run dialog program id, which is Microsoft.Windows.Shell.RunDialog. However, I can't get this working with the code below. Any idea?
DesiredCapabilities desktopCapabilities = new DesiredCapabilities();
desktopCapabilities.SetCapability("app", "Microsoft.Windows.Shell.RunDialog");
desktopCapabilities.SetCapability("deviceName", "WindowsPC");
desktopCapabilities.SetCapability("platformName", "Windows");
session = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), desktopCapabilities);
Take a look at the answers from this post about the run dialog. My best guess is that winappdriver is calling rundll32.exe and that's not the dialog itself.
You could try your luck changing this line
desktopCapabilities.SetCapability("app", "Microsoft.Windows.Shell.RunDialog");
into
desktopCapabilities.SetCapability("app", "c:\windows\system32\rundll32.exe shell32.dll,#61");
Alternatively, you could get the desktop session and send "windows key + r" to it. Here is how you can get the desktop session.

Disable native Next button in Qt installer framework

I have to disable standard next button, on my custom page via installscript.qs file.
I can disable my own button (that I created in .ui file) via .qs script like this: widget.myButton.setEnabled(false);
This man shows that native buttons represented as enumeration and I cannot disable them same way.
Controller Scripting manual page shows some interactions with native buttons. Like gui.clickButton(buttons.NextButton). I go through whole gui object man and don't found anything useful.
Qt installer framework has a native license check page with Next button logic that I need, but I have not found any samples that do it manually. (license page work because its default license page and it's logic inside framework as I understand).
Finally I found isComplete() method that can be useful for me, but it is for C++ API not for qs.
So how to disable native button via installscript.qs file?
In case someone else end ups here, I finally found a cleaner solution: a dynamic widget has a property complete that can be changed to enable and disable the "Next" button. Set it to false to disable the button.
Controller.prototype.DynamicMyWidgetCallback = function()
{
var currentWidget = gui.currentPageWidget();
if (currentWidget != null)
{
currentWidget.complete = false
}
}
The only solution i had found is call installer.setValue("canContinue" "false");
Then connect page entered event using gui.pageById(QInstaller.TargetDirectory).entered.
connect(Component.prototype.targetPageEntered);
In targetPageEntered check our value:
Component.prototype.targetPageEntered = function () {
if (installer.value("canContinue") != "true") {
gui.clickButton(buttons.BackButton);
QMessageBox.information("someid", "Installer",
"You must do smth to continue", QMessageBox.Ok);
}
}
Of course you need to change the installer.value when user complete required actions.

disable firefox extension programmatically

I'm having a problem trying to disable Firefox extensions programmatically. Right now, I'm modifying the extension.json file , changing the 2 parameters , active and userDisabled , but without any success. Despite the fact that in the extension menu it appears to be disabled , the icon of extensions still appear in the toolbar and I can see that the extensions still work. Is there a way to make this work using C++ ?
That won't work you have to use AddonManager.jsm to change the property like this:
Cu.import('resource://gre/modules/AddonManager.jsm');
AddonManager.getAddonByID('Profilist#jetpack', function(addon) { //id of the addon
console.info('addon:', addon);
addon.userDisabled = false; //set to true to enable it
});

Best way to Enable/Disable CMenu items in real time

I'm working on a project using Visual C++ 6.0, and I need to be able to enable or disable certain menu items depending on the permissions assigned to the currently logged in user. This is the code I'm using:
// If the currently logged in user doesn't have permission to edit invoices
if (!((CMyApp *)AfxGetApp())->UserHasPermission(PERMISSION_EditInvoice))
{
// Disable the Edit Menu
pMain->EnableMenuItem(1, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
}
else
{
// Enable the Edit Menu
pMain->EnableMenuItem(1, MF_BYPOSITION | MF_ENABLED);
}
It does exactly what I want it to do, however I'm trying to find the best place to put it. If I put it in OnInitialUpdate(), I get the results I want, but only for the first invoice opened. If you open a second invoice without closing and re-opening the dialog, the code is not executed again. OnUpdate() isn't called when opening a different invoice, and the only other place I've found that works is OnDraw(), the problem with OnDraw() is that the menu item doesn't visually change state from Grayed out to Enabled or vice versa until you try to click it.
I think you must include this code in a procedure
void check_user_permission();
than you must call it when this events occur:
- OnInitialUpdate()
- new user login (if your software permits user login/logout during the same session)
- new invoice opened
Can it help?
I ended up deciding to disable the Edit Invoice menu item, instead of the Edit menu itself. This proved much easier and cleaner, as it determines permission and enables or disables item every time the main 'Edit menu is opened.
void CViewInvoiceView::OnUpdateEditEditinvoice(CCmdUI* pCmdUI)
{
// If the currently logged in user doesn't have permission to edit invoices
if (!((CJ3App *)AfxGetApp())->UserHasPermission(PERMISSION_EditInvoice))
{
// Disable the Edit Menu
pCmdUI->Enable(false);
}
else
{
// Enable the edit menu
pCmdUI->Enable();
}
}