Beispiel #1
0
// Constructor
EditorDialog::EditorDialog(QWidget *parent):
    QDialog(parent),
    _ui(new Ui::EditorDialog)
  #ifdef Q_OS_SYMBIAN
  , _addNewAction(new QAction(tr("Add new"), this)),
    _editAction(new QAction(tr("Edit"), this)),
    _removeAction(new QAction(tr("Remove"), this)),
    _loadAction(new QAction(tr("Load"), this)),
    _saveAction(new QAction(tr("Save"), this)),
    _menu(new QMenu(this)),
    _menuAction(new QAction(tr("Menu"), this)),
    _cancelAction(new QAction(tr("Cancel"), this))
  #endif // Q_OS_SYMBIAN
{
    _ui->setupUi(this);

    connect(_ui->messageList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(Edit()));
    connect(_ui->messageList, SIGNAL(currentRowChanged(int)), this, SLOT(SelectionChanged(int)));
#ifdef Q_OS_SYMBIAN
    _menu->addAction(_addNewAction);
    _menu->addAction(_editAction);
    _menu->addAction(_removeAction);
    _menu->addAction(_loadAction);
    _menu->addAction(_saveAction);

    addAction(_menuAction);
    addAction(_editAction);
    addAction(_cancelAction);

    _menuAction->setMenu(_menu);
    _menuAction->setSoftKeyRole(QAction::PositiveSoftKey);
    _editAction->setSoftKeyRole(QAction::SelectSoftKey);
    _cancelAction->setSoftKeyRole(QAction::NegativeSoftKey);

    connect(_addNewAction, SIGNAL(triggered()), this, SLOT(AddNew()));
    connect(_editAction, SIGNAL(triggered()), this, SLOT(Edit()));
    connect(_removeAction, SIGNAL(triggered()), this, SLOT(Remove()));
    connect(_loadAction, SIGNAL(triggered()), this, SLOT(Load()));
    connect(_saveAction, SIGNAL(triggered()), this, SLOT(accept()));
    connect(_cancelAction, SIGNAL(triggered()), this, SLOT(reject()));
    connect(_ui->messageList, SIGNAL(entered(QModelIndex)), this, SLOT(Edit()));
#else
    connect(_ui->addNew, SIGNAL(clicked()), this, SLOT(AddNew()));
    connect(_ui->edit, SIGNAL(clicked()), this, SLOT(Edit()));
    connect(_ui->remove, SIGNAL(clicked()), this, SLOT(Edit()));
    connect(_ui->load, SIGNAL(clicked()), this, SLOT(Load()));
#endif // Q_OS_SYMBIAN
    SelectionChanged(_ui->messageList->currentRow());
}
STDMETHODIMP CMmQvFutCollection::Add(LONG Key, IMmQvFutAtom* Value, IMmQvFutAtom** pRetVal)
{
	__CHECK_POINTER(pRetVal);

	try
	{
		if(m_coll.find(Key) != m_coll.end())
			CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Future with the same key is already exists."));


		if(!Value)
			*pRetVal = AddNew(Key).Detach();
		else
		{
			_CHK(IMmQvFutCollectionImpl::Add(Key, Value), _T("Fail to add future."));
			Value->AddRef();
			*pRetVal = Value;
		}
	}
	catch(const _com_error& e)
	{
		return Error((PTCHAR)CComErrorWrapper::ErrorDescription(e), IID_IMmQvFutCollection, e.Error());
	}

	return S_OK;
}
STDMETHODIMP CMmQvRequestColl::Add(BSTR Key, IMmQvRequestAtom* Value, IMmQvRequestAtom** pRetVal)
{
	__CHECK_POINTER(pRetVal);
	_bstr_t bsKey(Key);

	try
	{
		if(m_coll.find(bsKey) != m_coll.end())
			EgLib::CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Quote Request component with the same key is already exists."));


		if(!Value)
			*pRetVal = AddNew(bsKey).Detach();
		else
		{
			_CHK(IMmQvRequestCollImpl::Add(bsKey, Value), _T("Fail to add Quote Request."));
			Value->AddRef();
			*pRetVal = Value;
		}
	}
	catch(const _com_error& e)
	{
		return Error((PTCHAR)EgLib::CComErrorWrapper::ErrorDescription(e), IID_IMmQvRequestColl, e.Error());
	}

	return S_OK;
}
Beispiel #4
0
STDMETHODIMP CMmQvExpColl::Add(DATE Key, IMmQvExpAtom* Value, IMmQvExpAtom** pRetVal)
{
	__CHECK_POINTER(pRetVal);

	DATE dtExp = (DATE)(static_cast<long>(Key));
	try
	{
		if(m_coll.find(dtExp) != m_coll.end())
			CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Expiry with the same key is already exists."));

		CComObject<CMmQvExpAtom>* pExp = NULL;

		if(!Value)
			*pRetVal = AddNew(dtExp).Detach();
		else
		{
			_CHK(IMmQvExpCollImpl::Add(dtExp, Value), _T("Fail to add expiry."));
			Value->AddRef();
			*pRetVal = Value;
		}
	}
	catch(const _com_error& e)
	{
		return Error((PTCHAR)CComErrorWrapper::ErrorDescription(e), IID_IMmQvExpColl, e.Error());
	}

	return S_OK;
}
void OBSBasicSourceSelect::on_buttonBox_accepted()
{
	bool useExisting = ui->selectExisting->isChecked();
	bool visible = ui->sourceVisible->isChecked();

	if (useExisting) {
		QListWidgetItem *item = ui->sourceList->currentItem();
		if (!item)
			return;

		AddExisting(QT_TO_UTF8(item->text()), visible, false);
	} else {
		if (ui->sourceName->text().isEmpty()) {
			OBSMessageBox::warning(this,
					QTStr("NoNameEntered.Title"),
					QTStr("NoNameEntered.Text"));
			return;
		}

		if (!AddNew(this, id, QT_TO_UTF8(ui->sourceName->text()),
					visible, newSource))
			return;
	}

	done(DialogCode::Accepted);
}
Beispiel #6
0
STDMETHODIMP CMmRvExpColl::Add(DATE Key, IMmRvExpAtom* Value, IMmRvExpAtom** pRetVal)
{
	__CHECK_POINTER(pRetVal);

	try
	{
		if(m_coll.find(Key) != m_coll.end())
			CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Expiry with the same key is already exists."));


		if(!Value)
			*pRetVal = AddNew(Key).Detach();
		else
		{
			__CHECK_HRESULT(IMmRvExpCollImpl::Add(Key, Value), _T("Fail to add expiry."));
			Value->AddRef();
			*pRetVal = Value;
		}
	}
	catch(const _com_error& e)
	{
		return Error((PTCHAR)CComErrorWrapper::ErrorDescription(e), IID_IMmRvExpColl, e.Error());
	}

	return S_OK;
}
Beispiel #7
0
// 添加新数据
void CArcossCache::Push( int id, char color, char *vechile )
{
	if ( AddNew(id, color, vechile) ) {
		// 序列化数据
		serialize( id ) ;
	}
}
STDMETHODIMP CEtsTraderGroupColl::Add(LONG Key, BSTR SortKey, IEtsTraderGroupAtom* Value, IEtsTraderGroupAtom** pRetVal)
{
	try
	{
		if(m_collRef.find(Key) != m_collRef.end())
		{
			EgLib::CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Trader group with the same key is already exists."));
		}

		_bstr_t bsSortKey(SortKey);

		if(!Value)
			*pRetVal = AddNew(Key, bsSortKey).Detach();
		else
		{
			_CHK(IEtsTraderGroupCollImpl::Add(Key, CComBSTR(SortKey), Value), _T("Fail to add trader group."));
			Value->AddRef();
			*pRetVal = Value;
		}
	}
	catch(const _com_error& e)
	{
		return Error((PTCHAR)EgLib::CComErrorWrapper::ErrorDescription(e), IID_IEtsTraderGroupColl, e.Error());
	}

	return S_OK;
}
int UserPrivateSpace::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: UserSignalDeconnect((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: UserIdModified((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: AddNew(); break;
        case 3: ModifyNew((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4])),(*reinterpret_cast< QWidget*(*)>(_a[5]))); break;
        case 4: AddNewCat(); break;
        case 5: ModifyCat(); break;
        case 6: RemoveCat(); break;
        case 7: ViewUsers(); break;
        case 8: UserDeconnectAttempt(); break;
        case 9: ServerDeconnectAnswer((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 10: CreateAddNewsDialog(); break;
        case 11: CreateModNewsDialog((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4])),(*reinterpret_cast< QWidget*(*)>(_a[5]))); break;
        case 12: CreateAddCatDialog(); break;
        case 13: CreateModCatDialog(); break;
        case 14: CreateDelCatDialog(); break;
        case 15: CreateUsersManageDialog(); break;
        case 16: DeleteDialogs(); break;
        default: ;
        }
        _id -= 17;
    }
    return _id;
}
Beispiel #10
0
bool RefCellContainer::Add( const RefObject &obj, AddRet *ret )
{
    if( AddExist( obj, ret ) )
    {
        return true;
    }
    return AddNew( obj, ret );
}
Beispiel #11
0
BOOL CSetVorlagen::UpdateVorlage()
{
	BOOL		result = FALSE;
	BOOL		found = FALSE;
	CString		key, name, pfad;
	long		typ;

	key  = m_Kode;
	name = m_Name;
	pfad = m_Pfad;
	typ  = m_Typ;
	try {
		Open();
		while ( !IsEOF())
		{
			if ( found = ( key == m_Kode ))
				break;

			MoveNext();
		}
		if ( found )	Edit();
		else			AddNew();

		m_Kode = key;
		m_Name = name;
		m_Pfad = pfad;
		m_Typ  = typ;

		Update();
		Close();

		result = TRUE;

	} catch ( CDBException *e ) {

		AfxMessageBox( e -> m_strError );

	} catch ( CMemoryException *e) {

		AfxMessageBox( g_cbMemoryException );
		e -> Delete();

	} catch (...) {

		AfxMessageBox( g_cbUnhandeledException );
	}

	if ( result )	InitListen();

	return result;
}
/* ------------------------------------------------------------------------------------ */
int CPersistentAttributes::Add(const char *szTag)
{
	PersistAttribute *pAttr = Locate(szTag);

	if(pAttr != NULL)
	{
		pAttr->Count++;						// Another one of these...
		return RGF_SUCCESS;					// Already there, ignore call
	}

	AddNew(szTag, 0);						// Add new attribute

	return RGF_SUCCESS;
}
Beispiel #13
0
//-----------------------------------------------------
//存储内容到数据库(INV_HEAD和INV_DET表)
//-----------------------------------------------------
INT32 CInvHead::Save()
{
	DBG_PRINT(("进入Save函数"));
	DBG_ENTER("CInvHead::Save");
	INT32 errcode;
	
	//添加INV_HEAD记录
	errcode = AddNew();
	//printf("512errcode= %d \n",errcode);
	if (errcode != SQLITE_OK)
	{
		DBG_PRINT(("INV_HEAD AddNew() wrong"));
		DBG_RETURN(FAILURE);
	}
    //printf("pHead= %x \n",pHead);
	//添加INV_DET记录
    CInvDet *p = pHead;
	if (p==NULL)
	{
		//printf("523 INV_DET here \n");
		DBG_PRINT(("INV_DET here"));
		DBG_ASSERT_WARNING(false,("List pointer: pHead = NULL!"));
	}
	while (p)
	{
		p->m_fpdm = m_fpdm;
		p->m_fphm = m_fphm;
		p->m_kplx = m_kplx;
		p->m_kprq = m_kprq;
		p->m_kpsj = m_kpsj;
		p->m_sky = m_sky;
		
		//printf("529INV_DET here \n");
		DBG_PRINT(("INV_DET here"));
		DBG_PRINT(("p->m_fphm = %u", p->m_fphm));
		DBG_PRINT(("p->m_spdj = %f", p->m_spdj));
		errcode = p->AddNew();
		//printf("534errcode= %d \n",errcode);
		if (errcode != SQLITE_OK)
		{
			DBG_PRINT(("INV_DET AddNew() wrong"));
			DBG_RETURN(FAILURE);
		}
		p = p->pNext;
		DBG_PRINT(("INV_DET AddNew()"));
	}	
	//printf("退出Save函数 \n");
	DBG_PRINT(("退出Save函数"));
	DBG_RETURN(SUCCESS);
}
Beispiel #14
0
int main(void)
{
    List list;
    InitializeList(&list); // test Initialize

    if(ListIsEmpty(&list)) //test ListIsEmpty
        printf("the list is empty\n");
    else
        printf("the list is not empty\n");
    
//    unsigned int counter=0;
//    counter=ListItemCount(&list);

    Node* pnode;

    pnode=(Node*)malloc(sizeof(Node));
    
    Item *pitem;

    pitem=(Item*)malloc(sizeof(Item));

    pitem->ID=001;
    strcpy(pitem->content, "hello list");
    pitem->value=1;
    
    pnode->item=*pitem;

    list=pnode;

    list=AddNew(list);    //test AddNew

    unsigned int counter=0;
    counter=ListItemCount(&list);
    printf("there are %u items in the list\n", counter);
    
//    void (*pfun)(Item item)=showitem;

    Traverse(&list,showitem);    //test Traverse
    
//    EmptyTheList(&list);d
    if(ListIsEmpty(&list))
        printf("list is empty!\n");
    else 
        printf("list is not empty!\n");

    EmptyTheList(&list);

    return 0;
}
int CSessions::addRecord()
{
	if (!IsBOF() || !IsEOF())
	{
		MoveLast();
		m_prevID = m_ID;
	}
	else
		m_prevID = -1;
	AddNew();
	m_ID = ++m_prevID;
	m_NAME.Format(_T("Session%d"), m_ID);
	Update();
	return m_prevID;
}
/* ------------------------------------------------------------------------------------ */
int CPersistentAttributes::AddAndSet(const char *szTag, int nValue)
{
	PersistAttribute *pAttr = Locate(szTag);

	if(pAttr != NULL)
	{
		pAttr->Value = nValue;
		pAttr->Count++;						// Another one of these...
		return RGF_SUCCESS;					// Already there, ignore call
	}

	AddNew(szTag, nValue);					// Add new attribute with value

	return RGF_SUCCESS;
}
Beispiel #17
0
void CWindowListDlg::Activate(CWnd* pWnd)
{
	if (!IsWindow(m_ctlWindowList.m_hWnd))
	{
		ASSERT(0);
		return;
	}

	int nIndex = MyFind(pWnd);

	if (nIndex == -1)
	{
		nIndex = AddNew(pWnd);
	}
	m_ctlWindowList.SetCurSel(nIndex);
}
int CFigures::addRecord(int sessionID)
{
	if (!IsBOF() || !IsEOF())
	{
		MoveLast();
		m_prevID = m_ID;
	}
	else
		m_prevID = -1;
	AddNew();
	m_ID = ++m_prevID;
	m_SESSION_ID = sessionID;
	m_NAME.Format(_T("%dFigure%d"), sessionID, m_ID);
	Update();
	return m_prevID;
}
int CFaces::addRecord(int figureID)
{
	if (!IsBOF() || !IsEOF())
	{
		MoveLast();
		m_prevID = m_ID;
	}
	else
		m_prevID = -1;
	AddNew();
	m_ID = ++m_prevID;
	m_FIGURE_ID = figureID;
	m_NAME.Format(_T("%dFace%d"), figureID, m_ID);
	Update();
	return m_prevID;
}
/* ------------------------------------------------------------------------------------ */
int CPersistentAttributes::RestoreFrom(FILE *RestoreFD, bool type)
{
	char szTempTag[256];
	int nValue, nCount, nLen, nUserDataSize, Low, High, PowerUpLevel;
	int nInFile;
	unsigned char *theUserData;
	PersistAttribute *pTemp = NULL;

	Clear();														// Zap everything first

	fread(&nInFile, sizeof(int), 1, RestoreFD);

	for(int nTemp = 0; nTemp < nInFile; nTemp++)
	{
		READDATA(type, &nLen,			sizeof(int), 1, RestoreFD);		// Tag size
		READDATA(type, &szTempTag,		1,		  nLen, RestoreFD);
		READDATA(type, &nCount,			sizeof(int), 1, RestoreFD);
		READDATA(type, &nValue,			sizeof(int), 1, RestoreFD);
		READDATA(type, &Low,			sizeof(int), 1, RestoreFD);
		READDATA(type, &High,			sizeof(int), 1, RestoreFD);
// changed QD 12/15/05
		READDATA(type, &PowerUpLevel,	sizeof(int), 1, RestoreFD);
// end change
		READDATA(type, &nUserDataSize,	sizeof(int), 1, RestoreFD);

		if(nUserDataSize != 0)
		{
			theUserData = new unsigned char[nUserDataSize];
			READDATA(type, &theUserData, 1, nUserDataSize, RestoreFD);
		}
		else
			theUserData = NULL;

		pTemp = AddNew(szTempTag, nValue);
		pTemp->ValueLowLimit = Low;
		pTemp->ValueHighLimit = High;
// changed QD 12/15/05
		pTemp->PowerUpLevel = PowerUpLevel;
// end change
		pTemp->Count = nCount;										// Adjust count
		pTemp->UserDataSize = nUserDataSize;
		pTemp->UserData = theUserData;
	}

	return RGF_SUCCESS;
}
Beispiel #21
0
STDMETHODIMP CBRecordset::put_Value(VARIANT VarKey, VARIANT pvar)
{
	if(VarKey.vt & VT_ARRAY)
		return E_INVALIDARG;

	if(VarKey.vt == VT_UNKNOWN || VarKey.vt == VT_DISPATCH)
		return DISP_E_BADVARTYPE;

	int i;
	HRESULT hr;

	CBLock l(&m_cs);

	if(m_pFields == NULL || m_pDatabase == NULL)return E_NOTIMPL;

	if(m_arrayVariant.IsEmpty())
		AddNew();

	if(VarKey.vt == VT_I4 || VarKey.vt == VT_I2)
	{
		i = varGetNumber(VarKey);
		
		if(i < 0 || i >= GetFieldCount())
			return DISP_E_BADINDEX;
	}else
	{
		CBString strKey;

		hr = varGetString(VarKey, strKey);
		if(FAILED(hr))return hr;

		for(i = 0; i < GetFieldCount() && strKey.CompareNoCase(m_arrayFields[i]); i ++);

		if(i == GetFieldCount())return E_INVALIDARG;
	}

	i += m_nPos;

	if(i >=0 && i < (int)m_arrayVariant.GetCount())
	{
		VariantCopy(&m_arrayVariant[i], &pvar);
		return S_OK;
	}else return DISP_E_BADINDEX;

	return S_OK;
}
Beispiel #22
0
Groupsock*
GroupsockLookupTable::Fetch(UsageEnvironment& env,
			    netAddressBits groupAddress,
			    Port port, u_int8_t ttl,
			    Boolean& isNew) {
  isNew = False;
  Groupsock* groupsock;
  do {
    groupsock = (Groupsock*) fTable.Lookup(groupAddress, (~0), port);
    if (groupsock == NULL) { // we need to create one:
      groupsock = AddNew(env, groupAddress, (~0), port, ttl);
      if (groupsock == NULL) break;
      isNew = True;
    }
  } while (0);

  return groupsock;
}
/* ------------------------------------------------------------------------------------ */
int CPersistentAttributes::AddIf(const char *szTag, int nHow, int nCompareValue, const char *szWhat)
{
	PersistAttribute *pAttr = Locate(szWhat);

	if(pAttr == NULL)
		return RGF_NOT_FOUND;				// Attribute not found

	if(LocalCompare(pAttr, nHow, nCompareValue))
	{
		pAttr = Locate(szTag);				// Is it there?

		if(pAttr != NULL)
			return RGF_SUCCESS;				// Already exists

		AddNew(szTag, 0);					// Add a new attribute
	}

	return RGF_SUCCESS;
}
void OBSBasicSourceSelect::on_buttonBox_accepted()
{
	bool useExisting = ui->selectExisting->isChecked();

	if (useExisting) {
		QListWidgetItem *item = ui->sourceList->currentItem();
		if (!item)
			return;

		AddExisting(QT_TO_UTF8(item->text()));
	} else {
		if (ui->sourceName->text().isEmpty()) {
			QMessageBox::information(this,
					QTStr("NoNameEntered"),
					QTStr("NoNameEntered"));
			return;
		}

		if (!AddNew(this, id, QT_TO_UTF8(ui->sourceName->text())))
			return;
	}

	done(DialogCode::Accepted);
}