コード例 #1
0
ファイル: dialogLocale.cpp プロジェクト: KdeOs/pcbsd
widgetLocale::widgetLocale(QWidget *parent) : QWidget(parent), ui(new Ui::widgetLocale)
{
  //Initialize the Interface
  ui->setupUi(this);
  
  //Connect the signals/slots
  connect(ui->pushCancel, SIGNAL(clicked()), this, SLOT(slotClose()) );
  connect(ui->pushApply, SIGNAL(clicked()), this, SLOT(slotApply()) );
  //Get all the available languages
  locCodeL = getLanguages(); //get language codes
  locL.clear();
  for(int i=0; i<locCodeL.length(); i++){
    QLocale locale(locCodeL[i]);
    locL << QLocale::languageToString(locale.language());
  }
  //Get the current language
  QLocale mylocale;
  QString cLocale = QLocale::languageToString(mylocale.language()) + " ("+mylocale.name()+")";
  qDebug() << "Default Locale:" << cLocale;
  //Setup the interface
  ui->lineCurrentLocale->setText(cLocale); //current language
  for(int i=0; i< locL.length(); i++){
    ui->localeListWidget->addItem(locL[i] + " ("+locCodeL[i]+")"); //Available languages
  }
}
コード例 #2
0
void EnableIndicationsResponseHandler::deliver(
    const OperationContext& context,
    const CIMIndication& cimIndication)
{
    if (cimIndication.isUninitialized())
    {
        MessageLoaderParms message(
            "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
            "The object is not initialized.");

        throw CIMException(CIM_ERR_FAILED, message);
    }

    // ATTN: temporarily convert indication to instance
    CIMInstance cimInstance(cimIndication);

    //  Get list of subscription instance names from context
    Array<CIMObjectPath> subscriptionInstanceNames;

    if (context.contains(SubscriptionInstanceNamesContainer::NAME))
    {
        SubscriptionInstanceNamesContainer container =
            context.get(SubscriptionInstanceNamesContainer::NAME);

        subscriptionInstanceNames = container.getInstanceNames();
    }
    else
    {
        subscriptionInstanceNames.clear();
    }

    ContentLanguageList contentLangs;

    if (context.contains(ContentLanguageListContainer::NAME))
    {
        // Get the Content-Language for this indication.  The provider
        // does not have to add specify a language for the indication.
        ContentLanguageListContainer langContainer =
            context.get(ContentLanguageListContainer::NAME);

        contentLangs = langContainer.getLanguages();
    }
    else
    {
        // The provider did not explicitly set a Content-Language for
        // the indication.  Fall back to the lang set in this object.
        contentLangs = getLanguages();
    }

    Uint32 timeoutMilliSec = 0;
    if (context.contains(TimeoutContainer::NAME))
    {
        TimeoutContainer timeoutContainer =
            context.get(TimeoutContainer::NAME);
        timeoutMilliSec = timeoutContainer.getTimeOut();
    }

    // create message
    CIMProcessIndicationRequestMessage* request =
        new CIMProcessIndicationRequestMessage(
        XmlWriter::getNextMessageId(),
        cimInstance.getPath().getNameSpace(),
        cimInstance,
        subscriptionInstanceNames,
        _provider,
        QueueIdStack(),  // Must be filled in by the callback function
        timeoutMilliSec);

    request->operationContext = context;

    if (request->operationContext.contains(ContentLanguageListContainer::NAME))
    {
        request->operationContext.set(
            ContentLanguageListContainer(contentLangs));
    }
    else
    {
        request->operationContext.insert(
            ContentLanguageListContainer(contentLangs));
    }

    _indicationCallback(request);
}