NS_IMETHODIMP
sbRemoteNotificationManager::Notify(nsITimer* aTimer)
{
  TRACE(("sbRemoteNotificationManager[0x%.8x] - Notify", this));

  NS_ENSURE_ARG_POINTER(aTimer);

  nsresult rv;

  if (mCancelPending) {
    nsRefPtr<sbRemoteNotificationManager> kungFuDeathGrip(this);
    nsresult rv, rv2;
    // clear the status bar text
    mCurrentActionType = eNone;
    rv = UpdateStatus();

    // and clear the timer (regardless of if the status bar was cleared)
    // keep the return value so we always return the worst one
    rv2 = mTimer->Cancel();
    mTimer = nsnull;

    // kung fu death grip, matched in Notify. without this the manager goes
    // away before the timer and deadlocks - bug7970
    NS_RELEASE_THIS();

    NS_ENSURE_SUCCESS(rv, rv);
    return rv2;
  }

  PRTime now = PR_Now();

  // If we're currently showing a message, check to see if it has been up
  // long enough
  if (mCurrentActionType > eNone) {
    if (now > mPriorityList[mCurrentActionType].mDisplayUntilTime) {
      mPriorityList[mCurrentActionType].mDisplayUntilTime = 0;
    }
    else {
      // The current message still has time left, do nothing
      return NS_OK;
    }
  }

  // Is there another message waiting to be displayed?  If so, bump the
  // display until time, update status message and return
  for (ActionType i = eDownload; i <= eEditedPlaylist; i = ActionType(i + 1)) {
    if (mPriorityList[i].mDisplayUntilTime > 0) {
      mCurrentActionType = i;
      mPriorityList[i].mDisplayUntilTime = now + MAX_NOTIFICATION_TIME;
      rv = UpdateStatus();
      NS_ENSURE_SUCCESS(rv, rv);

      return NS_OK;
    }
  }

  // If we get here, there are no messages to display, so cancel the timer.
  return Cancel();
}
Esempio n. 2
0
  printf("  Finally Actions: %i\n", sact->numFinallyActs);
  for(i = 0; i < sact->numFinallyActs; i++)
  {
    outputSWF_ACTION(4, sact->FinallyActs + i);
  }
  printf("  ## TRY END ##\n\n");
}

#define ActionType( action ) \
{ action, #action, NULL }

#define ActionTypeLong( action ) \
{ action, #action, output##action }

static struct SWFActionName actions[] = {
  ActionType (SWFACTION_END),
  /* v3 actions */
  /* Simple Actions */
  ActionType (SWFACTION_NEXTFRAME),
  ActionType (SWFACTION_PLAY),
  ActionType (SWFACTION_STOP),
  ActionType (SWFACTION_TOGGLEQUALITY),
  ActionType (SWFACTION_STOPSOUNDS),
  /* Actions with additional Data */
  ActionTypeLong (SWFACTION_GOTOFRAME),
  ActionTypeLong (SWFACTION_GETURL),
  ActionTypeLong (SWFACTION_WAITFORFRAME),
  ActionTypeLong (SWFACTION_SETTARGET),
  ActionType (SWFACTION_GOTOLABEL),
  /* v4 actions */
  ActionTypeLong (SWFACTION_PUSH),
Esempio n. 3
0
void ConstraintWidget::applyConfiguration(void)
{
	try
	{
		Constraint *constr=nullptr;
		unsigned i, col_id, count;
		Column *column=nullptr;
		ObjectTableWidget *aux_col_tab=nullptr;
		vector<ExcludeElement> excl_elems;

		startConfiguration<Constraint>();

		constr=dynamic_cast<Constraint *>(this->object);
		constr->setConstraintType(ConstraintType(constr_type_cmb->currentText()));
    constr->setExpression(expression_txt->toPlainText().toUtf8());

		if(fill_factor_chk->isChecked())
			constr->setFillFactor(fill_factor_sb->value());
		else
			constr->setFillFactor(0);

		constr->setMatchType(MatchType(match_cmb->currentText()));
		constr->setDeferrable(deferrable_chk->isChecked());
		constr->setDeferralType(DeferralType(deferral_cmb->currentText()));
    constr->setActionType(ActionType(on_delete_cmb->currentText()),Constraint::DELETE_ACTION);
    constr->setActionType(ActionType(on_update_cmb->currentText()),Constraint::UPDATE_ACTION);
		constr->setNoInherit(no_inherit_chk->isChecked());

		if(indexing_chk->isChecked())
			constr->setIndexType(IndexingType(indexing_cmb->currentText()));
		else
			constr->setIndexType(BaseType::null);

		if(constr->getConstraintType()==ConstraintType::foreign_key)
			constr->setReferencedTable(dynamic_cast<BaseTable *>(ref_table_sel->getSelectedObject()));

		constr->removeColumns();
		for(col_id=Constraint::SOURCE_COLS; col_id <= Constraint::REFERENCED_COLS; col_id++)
		{
			aux_col_tab=(col_id==Constraint::SOURCE_COLS ? columns_tab : ref_columns_tab);

			count=aux_col_tab->getRowCount();
			for(i=0; i < count; i++)
			{
				column=reinterpret_cast<Column *>(aux_col_tab->getRowData(i).value<void *>());
				constr->addColumn(column, col_id);
			}
		}

		excl_elems_wgt->getElements(excl_elems);
		constr->addExcludeElements(excl_elems);

		//Raises an error if the user try to create a primary key that has columns added by relationship (not supported)
		if(constr->getConstraintType()==ConstraintType::primary_key &&
			 constr->isReferRelationshipAddedColumn())
			throw Exception(ERR_PK_USING_COLS_ADDED_BY_REL,__PRETTY_FUNCTION__,__FILE__,__LINE__);

		BaseObjectWidget::applyConfiguration();

		/* Raises an error if the constraint type requires at least one column to be assinged and
		there is no columns configured on the form */
		if(((constr->getConstraintType()==ConstraintType::foreign_key ||
				 constr->getConstraintType()==ConstraintType::primary_key) &&
				constr->getColumnCount(Constraint::SOURCE_COLS)==0) ||
			 (constr->getConstraintType()==ConstraintType::foreign_key &&
				constr->getColumnCount(Constraint::REFERENCED_COLS)==0))
			throw Exception(ERR_CONSTR_NO_COLUMNS,__PRETTY_FUNCTION__,__FILE__,__LINE__);

		finishConfiguration();

		//For the foreign keys, updates the fk relationships on the model
		if(constr->getConstraintType()==ConstraintType::foreign_key)
			this->model->updateTableFKRelationships(dynamic_cast<Table *>(this->table));
	}
	catch(Exception &e)
	{
		Messagebox msg_box;

		cancelConfiguration();
		msg_box.show(e);
	}
}
Esempio n. 4
0
void ConstraintWidget::applyConfiguration(void)
{
	try
	{
		Constraint *constr=NULL;
		unsigned i, col_id, count;
		Column *column=NULL;
		ObjectTableWidget *aux_col_tab=NULL;

		startConfiguration<Constraint>();

		constr=dynamic_cast<Constraint *>(this->object);
		constr->setConstraintType(ConstraintType(constr_type_cmb->currentText()));
		constr->setCheckExpression(check_expr_txt->toPlainText().toUtf8());
		constr->setFillFactor(fill_factor_sb->value());
		constr->setMatchType(MatchType(match_cmb->currentText()));
		constr->setDeferrable(deferrable_chk->isChecked());
		constr->setDeferralType(DeferralType(deferral_cmb->currentText()));
		constr->setActionType(ActionType(on_delete_cmb->currentText()),false);
		constr->setActionType(ActionType(on_update_cmb->currentText()),true);

		if(constr->getConstraintType()==ConstraintType::foreign_key)
			constr->setReferencedTable(ref_table_sel->getSelectedObject());

		constr->removeColumns();
		for(col_id=Constraint::SOURCE_COLS; col_id <= Constraint::REFERENCED_COLS; col_id++)
		{
			aux_col_tab=(col_id==Constraint::SOURCE_COLS ? columns_tab : ref_columns_tab);

			count=aux_col_tab->getRowCount();
			for(i=0; i < count; i++)
			{
				column=reinterpret_cast<Column *>(aux_col_tab->getRowData(i).value<void *>());
				constr->addColumn(column, col_id);
			}
		}

		BaseObjectWidget::applyConfiguration();

		/* Raises an error if the constraint type requires at least one column to be assinged and
		there is no columns configured on the form */
		if(((constr->getConstraintType()==ConstraintType::foreign_key ||
				 constr->getConstraintType()==ConstraintType::primary_key) &&
				constr->getColumnCount(Constraint::SOURCE_COLS)==0) ||
			 (constr->getConstraintType()==ConstraintType::foreign_key &&
				constr->getColumnCount(Constraint::REFERENCED_COLS)==0))
			throw Exception(ERR_CONSTR_NO_COLUMNS,__PRETTY_FUNCTION__,__FILE__,__LINE__);

		finishConfiguration();

		//For the foreign keys, updates the fk relationships on the model
		if(constr->getConstraintType()==ConstraintType::foreign_key)
			this->model->updateTableFKRelationships(this->table);
	}
	catch(Exception &e)
	{
		MessageBox msg_box;

		cancelConfiguration();
		msg_box.show(e);
	}
}