void
QvisPostableWindowSimpleObserver::makeDefaultHelper()
{
    if(makeDefaultConfirm)
    {
        QString msg(tr("Do you really want to make these the default attributes?"));

        // Ask the user if he really wants to set the defaults
        int button = QMessageBox::warning(0, "VisIt", msg, tr("Ok"), tr("Cancel"),
                                          tr("Yes, Do not prompt again"), 0, 1);

        if(button == 0)
        {
            // The user actually chose to set the defaults.
            makeDefault();
        }
        else if(button == 2)
        {
            // Make it so no confirmation is needed.
            makeDefaultConfirm = false;
            GlobalAttributes *globalAtts = GetViewerState()->GetGlobalAttributes();
            globalAtts->SetMakeDefaultConfirm(false);
            globalAtts->Notify();

            makeDefault();
        }
    }
    else
        makeDefault();
}
void
QvisOperatorWindow::SetOperatorOptions()
{
    PlotList *plots = GetViewerState()->GetPlotList();

    // If there are plots, see if the operator should be applied.
    if(plots->GetNumPlots() > 0)
    {
        bool applyToAll = GetViewerState()->GetGlobalAttributes()->GetApplyOperator();
        int i, j;

        // Look to see if the operator exists in the plots
        bool found = false;
        for(i = 0; i < plots->GetNumPlots() && !found; ++i)
        {
            const Plot &plot = plots->operator[](i);
            if(plot.GetActiveFlag() || applyToAll)
            {
                for(j = 0; j < plot.GetNumOperators(); ++j)
                {
                     if(operatorType == plot.GetOperator(j))
                     {
                         found = true;
                         break;
                     }
                }
            }
        }

        // If the operator was not found in the plot list, ask the user whether
        // the operator should be added to the plots.
        if(!found)
        {
            int button = 0;

            // Only ask the user if we are not automatically adding the
            // operator.
            if(!GetViewerState()->GetGlobalAttributes()->GetAutomaticallyAddOperator())
            {
                OperatorPluginManager *opMgr = GetViewerProxy()->GetOperatorPluginManager();

                // Create a prompt for the user.
                GUIOperatorPluginInfo *info = opMgr->GetGUIPluginInfo(
                                              opMgr->GetEnabledID(operatorType));
                QString menuName, *s = 0;
                if(info)
                {
                    s = info->GetMenuName();
                    menuName = *s;
                }

                QString msg = tr("No %1 operator was found for the selected plots.\n"
                                 "Do you want to apply the %2 operator?\n\n").
                              arg(menuName).arg(menuName);

                if(s != 0)
                    delete s;

                QMessageBox msgBox;
                msgBox.setWindowTitle("VisIt");
                msgBox.setText(msg);
                QPushButton *yesButton    = msgBox.addButton(QMessageBox::Yes);
                QPushButton *noButton     = msgBox.addButton(QMessageBox::No);
                QPushButton *yesAllButton = msgBox.addButton(tr("Yes, Do not prompt again"),
                                                             QMessageBox::ActionRole);
                
                msgBox.exec();
                QPushButton *clicked = (QPushButton*)msgBox.clickedButton();
                if ( clicked == yesButton) 
                {
                    // connect
                    button = 0;
                }
                else if (clicked == noButton) 
                {
                    button = 1;
                }
                else if (clicked == yesAllButton) 
                {
                    button = 2;
                }
            }

            if(button == 0)
            {
                // Set the client attributes, and set the 'fromDefault' flag
                // to false in the call to AddOperator, so that the operator 
                // knows to initialize the atts from client rather than the 
                // ususal default atts. 
                GetViewerMethods()->AddInitializedOperator(operatorType);
            }
            else if (button == 2)
            {
                // Make it so no confirmation is needed.
                GlobalAttributes *globalAtts = GetViewerState()->GetGlobalAttributes();
                globalAtts->SetAutomaticallyAddOperator(true);
                globalAtts->Notify();

                // Set the client attributes, and set the 'fromDefault' flag
                // to false in the call to AddOperator, so that the operator 
                // knows to initialize the atts from client rather than the 
                // ususal default atts. 
                GetViewerMethods()->AddInitializedOperator(operatorType);
            }
        }
        else
            GetViewerMethods()->SetOperatorOptions(operatorType);
    }
}