// virtual void CScanWidgetRandom::load(const CCopasiParameterGroup * pItem) { if (pItem == NULL) return; *mpData = *pItem; if (mpData->getValue< unsigned C_INT32 >("Type") != CScanProblem::SCAN_RANDOM) return; const std::string String = mpData->getValue< std::string >("Object"); if (String == "") mpObject = NULL; else { CDataModel* pDataModel = ListViews::dataModel(this); assert(pDataModel != NULL); mpObject = CObjectInterface::DataObject(pDataModel->getObjectFromCN(String)); } if (mpObject) lineEditObject->setText(FROM_UTF8(mpObject->getObjectDisplayName())); else lineEditObject->setText(""); comboBoxType->setCurrentIndex(mpData->getValue< unsigned C_INT32 >("Distribution type")); changeType(); lineEditMin->setText(getParameterValue(mpData, "Minimum").toString()); lineEditMax->setText(getParameterValue(mpData, "Maximum").toString()); checkBoxLog->setChecked(mpData->getValue< bool >("log")); return; }
/* Property::setValue * Sets the property to [val], and changes its type to unsigned int * if necessary *******************************************************************/ void Property::setValue(unsigned val) { // Change type if necessary if (type != PROP_UINT) changeType(PROP_UINT); // Set value value.Unsigned = val; has_value = true; }
/* Property::setValue * Sets the property to [val], and changes its type to string * if necessary *******************************************************************/ void Property::setValue(string val) { // Change type if necessary if (type != PROP_STRING) changeType(PROP_STRING); // Set value val_string = val; has_value = true; }
/* Property::setValue * Sets the property to [val], and changes its type to floating * point if necessary *******************************************************************/ void Property::setValue(double val) { // Change type if necessary if (type != PROP_FLOAT) changeType(PROP_FLOAT); // Set value value.Floating = val; has_value = true; }
/* Property::setValue * Sets the property to [val], and changes its type to integer * if necessary *******************************************************************/ void Property::setValue(int val) { // Change type if necessary if (type != PROP_INT) changeType(PROP_INT); // Set value value.Integer = val; has_value = true; }
/* Property::setValue * Sets the property to [val], and changes its type to boolean * if necessary *******************************************************************/ void Property::setValue(bool val) { // Change type if necessary if (type != PROP_BOOL) changeType(PROP_BOOL); // Set value value.Boolean = val; has_value = true; }
Projectile::Projectile(Jeu* jeu, int type, Direction dir, int a, int b, int vit) : Listable(), gpJeu(jeu), id(type), direction(dir), x(a), y(b), anim(0), max(0), vanim(120), vie(1), hauteur(0), vitesse(vit), image(NULL), etape(1), chemin(0), chmax(0) { changeType(id); lastAnimTime = SDL_GetTicks(); }
// ----------------------------------------------------------------------------- // Sets the property to [val], and changes its type to integer if necessary // ----------------------------------------------------------------------------- void Property::setValue(int val) { // Change type if necessary if (type_ != Type::Int) changeType(Type::Int); // Set value value_.Integer = val; has_value_ = true; }
// ----------------------------------------------------------------------------- // Sets the property to [val], and changes its type to boolean if necessary // ----------------------------------------------------------------------------- void Property::setValue(bool val) { // Change type if necessary if (type_ != Type::Boolean) changeType(Type::Boolean); // Set value value_.Boolean = val; has_value_ = true; }
// ----------------------------------------------------------------------------- // Sets the property to [val], and changes its type to string if necessary // ----------------------------------------------------------------------------- void Property::setValue(std::string_view val) { // Change type if necessary if (type_ != Type::String) changeType(Type::String); // Set value val_string_ = val; has_value_ = true; }
// ----------------------------------------------------------------------------- // Sets the property to [val], and changes its type to unsigned int if necessary // ----------------------------------------------------------------------------- void Property::setValue(unsigned val) { // Change type if necessary if (type_ != Type::UInt) changeType(Type::UInt); // Set value value_.Unsigned = val; has_value_ = true; }
void SCgView::showTypeDialog() { if (!mContextObject) return; SCgTypeSelectionDialog typeDialog(mContextObject->type()); if (typeDialog.exec() == QDialog::Accepted) changeType(typeDialog.getChosenType()); }
// ----------------------------------------------------------------------------- // Sets the property to [val], and changes its type to floating point if // necessary // ----------------------------------------------------------------------------- void Property::setValue(double val) { // Change type if necessary if (type_ != Type::Float) changeType(Type::Float); // Set value value_.Floating = val; has_value_ = true; }
Block::Block() { changeType(BLOCK_GROUND); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { neighbor[i][j] = nullptr; } } neighbor[1][1] = this; }
void VNSocket::createContextMenu() { contextMenu = new QMenu; QAction *changeNameAction = contextMenu->addAction("Rename Socket"); QAction *changeTypeAction = contextMenu->addAction("change Type"); // QAction *changeArrayAction = contextMenu->addAction("Array"); // changeArrayAction->setCheckable(true); // changeArrayAction->setChecked(data->isArray()); connect(changeNameAction, SIGNAL(triggered()), this, SLOT(changeName())); connect(changeTypeAction, SIGNAL(triggered()), this, SLOT(changeType())); // connect(changeArrayAction, SIGNAL(triggered()), this, SLOT(setArray())); }
bool CScanWidgetRandom::initFromScanItem(CCopasiParameterGroup * pg, const CModel* model) { if (!model) return false; mpModel = model; unsigned C_INT32 * tmp; if (!(tmp = pg->getValue("Type").pUINT)) return false; if (*(CScanProblem::Type *) tmp != CScanProblem::SCAN_RANDOM) return false; std::string *pString; if (!(pString = pg->getValue("Object").pSTRING)) return false; if (*pString == "") mpObject = NULL; else { assert(CCopasiRootContainer::getDatamodelList()->size() > 0); CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0]; assert(pDataModel != NULL); mpObject = pDataModel->getObject(*pString); } if (mpObject) lineEditObject->setText(FROM_UTF8(mpObject->getObjectDisplayName())); else lineEditObject->setText(""); if (!(tmp = pg->getValue("Distribution type").pUINT)) return false; comboBoxType->setCurrentItem(*tmp); changeType(); lineEditMin->setText(getParameterValue(pg, "Minimum")); lineEditMax->setText(getParameterValue(pg, "Maximum")); bool * pBool; if (!(pBool = pg->getValue("log").pBOOL)) return false; checkBoxLog->setChecked(* pBool); return true; }
GraphicalUriArray::GraphicalUriArray(const QString& sep, QWidget * parent) : GraphicalValue(parent) { m_groupBox = new QGroupBox(parent); m_editAdd = new QLineEdit(m_groupBox); m_model = new QStringListModel(m_groupBox); m_listView = new QListView(m_groupBox); m_btAdd = new QPushButton("+", m_groupBox); m_btRemove = new QPushButton("-", m_groupBox); m_btUp = new QPushButton("Up", m_groupBox); m_btDown = new QPushButton("Down", m_groupBox); m_comboType = new QComboBox(m_groupBox); m_separator = sep; m_buttonsLayout = new QVBoxLayout(); m_boxLayout = new QGridLayout(m_groupBox); m_listView->setModel(m_model); m_listView->setSelectionMode(QAbstractItemView::ExtendedSelection); // m_listView->setDragDropMode(QAbstractItemView::InternalMove); // m_listView->setDragEnabled(true); // m_listView->setAcceptDrops(true); setProtocols(std::vector<std::string>()); m_buttonsLayout->addWidget(m_btUp); m_buttonsLayout->addWidget(m_btDown); m_boxLayout->addWidget(m_comboType, 0, 0); m_boxLayout->addWidget(m_editAdd, 0, 1); m_boxLayout->addWidget(m_btAdd, 0, 2); m_boxLayout->addWidget(m_btRemove, 0, 3); m_boxLayout->addWidget(m_listView, 1, 0, 1, 4); m_boxLayout->addLayout(m_buttonsLayout, 1, 4); m_layout->addWidget(m_groupBox); selectionChanged(QItemSelection(), QItemSelection()); connect(m_btAdd, SIGNAL(clicked()), this, SLOT(btAddClicked())); connect(m_btRemove, SIGNAL(clicked()), this, SLOT(btRemoveClicked())); connect(m_comboType, SIGNAL(activated(QString)), this, SLOT(changeType(QString))); connect(m_btUp, SIGNAL(clicked()), this, SLOT(moveUp())); connect(m_btDown, SIGNAL(clicked()), this, SLOT(moveDown())); connect(m_listView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged(QItemSelection,QItemSelection))); }
void MainWindow::openOctave(QString opcion){ QTextStream(stdout) <<"entra a openoctave"<<endl; QString cmd="menuOctave "+path+" "+opcion+"\n"; if (octave->state()!=QProcess::Running) QTextStream(stdout) << "Make failed:" << octave->errorString()<<endl; else{ octave->write(cmd.toUtf8()); } // connect(octave,SIGNAL(readyRead()),this,SLOT()); //QStringList salida; /*if(octave->waitForReadyRead()){ octave->waitForFinished(60000); QString str=octave->readAll(); salida=str.split(" "); QTextStream(stdout) << "salida " <<str; }*/ QStringList salida; while(octave->waitForReadyRead()){ salida.append(QString(octave->readAll()).split(" ")); if(salida.last()=="fin"){ QTextStream(stdout) << "salio del while "; break; } } int size=salida.size(); QVector<double> signal(size), x(size); for (int var = 0; var < size; var++) { x[var]=var; QTextStream(stdout) <<salida.at(var)<<" "; } changeType(salida,signal,size); grafica(x,signal); }
void GraphicalUriArray::setProtocols(const std::vector<std::string> & protocols) { m_comboType->clear(); if(protocols.empty()) { m_comboType->addItem("cpath"); m_comboType->addItem("file"); m_comboType->addItem("http"); } else { std::vector<std::string>::const_iterator it; for(it = protocols.begin() ; it != protocols.end() ; it++) m_comboType->addItem(it->c_str()); } changeType(m_comboType->currentText()); }
void Projectile::fin() { if (id == 1 || id == 2) {anim=1; max = 5;} else if (id == 3) etape=2; else if (id == 5) {changeType(7); vitesse=0; gpJeu->getAudio()->playSound(29);} else if (id >= 21 && id <= 26) { if (gpJeu->isWater(x, y, w, h) && chemin>=chmax) { vie = 0; gpJeu->ajouteProjectile(8, direction, x, y, 0); } else if (gpJeu->isVide(x, y, w, h) && chemin>=chmax) { vie = 0; gpJeu->getAudio()->playSound(6); } else { vitesse=0;anim=1;max=4;gpJeu->getAudio()->playSound(36); lastAnimTime = SDL_GetTicks(); } } else vie=0; }
/*------------------------------------------------------------------------------------------------------------------ -- FUNCTION: menuAction -- -- DATE: January 14, 2016 -- -- REVISIONS: Feb 5, 2016 - change menu value and connect others -- -- DESIGNER: Eunwon Moon -- -- PROGRAMMER: Eunwon Moon -- -- INTERFACE: BOOL menuAction(HWND hwnd, WPARAM wParam) -- HWND hwnd : a handle to the window procedure which received the message. -- WPARAM wParam : tha additional message information -- -- RETURNS: bool -- -- -- NOTES: -- This function is used to read command message and perform the menu action in dialog item -- ----------------------------------------------------------------------------------------------------------------------*/ void menuAction(HWND hwnd, WPARAM wParam) { TCHAR str_port[STRSIZE], str[STRSIZE], str2[STRSIZE], str_addr[STRSIZE], str_file[STRSIZE]; char temp[STRSIZE] = ""; int check = 0; int packet_size, trial_num, port_num = DEFAULTPORT; WCHAR szFileName[STRSIZE]; switch (LOWORD(wParam)) { case IDC_RADIO_SERVER: op_type = SERVER; ListOut("SERVER"); changeType(hwnd, op_type % 2); break; case IDC_RADIO_CLIENT: op_type = CLIENT; ListOut("CLIENT"); changeType(hwnd, op_type % 2); break; case IDC_RADIO_TCP: op_protocol = TCP; ListOut("TCP"); return ; case IDC_RADIO_UDP: op_protocol = UDP; ListOut("UDP"); return ; case IDC_BTN_FILE: GetDlgItemText(hwnd, IDC_EDIT_FILE, str_file, STRSIZE); if (strcmp(str_file, "") == 0) { ListOut("Input File Name!!"); return; } op_msg = FILESEND; case IDC_BTN_CONN: EnableWindow(GetDlgItem(hwnd, IDC_RADIO_SERVER), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_RADIO_CLIENT), FALSE); GetDlgItemText(hwnd, IDC_EDIT_PORT, str_port, STRSIZE); if (!isdigit(*str_port) && strcmp(str_port, "") != 0) { MessageBox(NULL, TEXT("Please Input valid port number"), NULL, MB_OK); break; } else if (strcmp(str_port, "") != 0) port_num = atoi(str_port); else port_num = DEFAULTPORT; if (op_type == CLIENT) { GetDlgItemText(hwnd, IDC_EDIT_ADDR, str_addr, STRSIZE); GetDlgItemText(hwnd, IDC_EDIT_SIZE, str, STRSIZE); GetDlgItemText(hwnd, IDC_EDIT_NUM, str2, STRSIZE); if (strcmp(str, "") == 0 || (op_msg !=FILESEND && strcmp(str2, "") == 0)) { SendMessage(hList, LB_RESETCONTENT, 0, 0); ListOut("Please input the value"); break; } else if (!isdigit(*str) && !isdigit(*str2)) { SendMessage(hList, LB_RESETCONTENT, 0, 0); ListOut("Please input the valid address"); break; } else { wsprintf(temp, "START CLIENT IP : %s, PORT: %d", str_addr, port_num); ListOut(temp); packet_size = atoi(str); trial_num = atoi(str2); } cl_winsock(hwnd, &client_sock, op_protocol, str_addr, port_num, op_msg); } else if (op_type == SERVER) { wsprintf(temp, "START SERVER PORT: %d", port_num); ListOut(temp); sv_winsock(hwnd, &server_sock, op_protocol, port_num); } else { ListOut("Sth wrong"); ListOut(" "); } break; case IDCLEAR: SendMessage(hList, LB_RESETCONTENT, 0, 0); break; case IDDISCONNECT: ListOut(" disconnected!"); shutdown(op_type == SERVER ? server_sock : client_sock, SD_BOTH); closesocket(op_type == CLIENT ? server_sock : client_sock); WSACleanup(); EnableWindow(GetDlgItem(hwnd, IDC_RADIO_SERVER), TRUE); EnableWindow(GetDlgItem(hwnd, IDC_RADIO_CLIENT), TRUE); break; case IDCLOSE: PostQuitMessage(0); return; } }
void Projectile::attaque() { switch (id) { case 1 : case 2 : //if (gpJeu->testEpee(x+zx, y+zy, zw, zh, FLECHE, 2+3*(id-1), direction)) vie=0; switch (direction) { case N: if (gpJeu->testEpee(x+zx+(zw/2), y+zy+4, 1, 1, FLECHE, 2+3*(id-1), direction)) vie=0; break; case S: if (gpJeu->testEpee(x+zx+(zw/2), y+zy+zh-1-4, 1, 1, FLECHE, 2+3*(id-1), direction)) vie=0; break; case O: if (gpJeu->testEpee(x+zx+4, y+zy+(zh/2), 1, 1, FLECHE, 2+3*(id-1), direction)) vie=0; break; case E: if (gpJeu->testEpee(x+zx+zw-1-4, y+zy+(zh/2), 1, 1, FLECHE, 2+3*(id-1), direction)) vie=0; break; } break; case 3 : if (etape == 1) switch (direction) { case N: if (gpJeu->testEpee(x+zx+(zw/2), y+zy+4, 1, 1, COUP_GRAPPIN, 1, direction)) etape=2; break; case S: if (gpJeu->testEpee(x+zx+(zw/2), y+zy+zh-1-4, 1, 1, COUP_GRAPPIN, 1, direction)) etape=2; break; case O: if (gpJeu->testEpee(x+zx+4, y+zy+(zh/2), 1, 1, COUP_GRAPPIN, 1, direction)) etape=2; break; case E: if (gpJeu->testEpee(x+zx+zw-1-4, y+zy+(zh/2), 1, 1, COUP_GRAPPIN, 1, direction)) etape=2; break; } break; case 4 : if (anim == 30) { gpJeu->testEpee(x+zx, y+zy, zw, zh, EXPLOSION, 5, direction); gpJeu->testDegat(x+zx, y+zy, zw, zh, EXPLOSION, 5, direction); } break; case 5 : if (gpJeu->testEpee(x+zx, y+zy, zw, zh, FEU, 3, direction)) { changeType(7); vitesse=0; gpJeu->getAudio()->playSound(29); } break; case 6 : if (gpJeu->testEpee(x+zx, y+zy, zw, zh, COUP_GLACE, 3, direction)) vie=0; break; case 7 : gpJeu->testEpee(x+zx, y+zy, zw, zh, FEU, 1, direction); break; case 21 : case 22 : case 23 : case 24 : case 25 : if (gpJeu->testEpee(x+zx, y+zy, zw, zh, POT, 2, direction) && vitesse) { vitesse=0;anim=1;max=4;gpJeu->getAudio()->playSound(36); lastAnimTime = SDL_GetTicks(); } break; case 26 : if (gpJeu->testEpee(x+zx, y+zy, zw, zh, POT, 4, direction) && vitesse) { vitesse=0;anim=1;max=4;gpJeu->getAudio()->playSound(36); lastAnimTime = SDL_GetTicks(); } break; } }
void Projectile::attaque() { int force = 0; int type = 0; switch (id) { case 1 : case 2 : case 30 : case 31 : case 32 : case 33 : if (id ==1 || id == 2) {force = 2+3*(id-1); type=FLECHE;} if (id == 30) {force = 10; type=FEU;} if (id == 31) {force = 7; type=COUP_GLACE;} if (id == 32) {force = 20; type=MAGIE;} if (id == 33) {force = 1; type=MORTEL;} if (id == 33 && gpJeu->getZone()==60) {force = 1; type=ENNEMI;} switch (direction) { case N: if (gpJeu->testEpee(x+zx+(zw/2), y+zy+4, 1, 1, type, force, direction)) vie=0; break; case S: if (gpJeu->testEpee(x+zx+(zw/2), y+zy+zh-1-4, 1, 1, type, force, direction)) vie=0; break; case O: if (gpJeu->testEpee(x+zx+4, y+zy+(zh/2), 1, 1, type, force, direction)) vie=0; break; case E: if (gpJeu->testEpee(x+zx+zw-1-4, y+zy+(zh/2), 1, 1, type, force, direction)) vie=0; break; } break; case 3 : if (etape == 1) switch (direction) { case N: if (gpJeu->testEpee(x+zx+(zw/2), y+zy+4, 1, 1, COUP_GRAPPIN, 1, direction)) etape=2; break; case S: if (gpJeu->testEpee(x+zx+(zw/2), y+zy+zh-1-4, 1, 1, COUP_GRAPPIN, 1, direction)) etape=2; break; case O: if (gpJeu->testEpee(x+zx+4, y+zy+(zh/2), 1, 1, COUP_GRAPPIN, 1, direction)) etape=2; break; case E: if (gpJeu->testEpee(x+zx+zw-1-4, y+zy+(zh/2), 1, 1, COUP_GRAPPIN, 1, direction)) etape=2; break; } break; case 4 : case 140 : if (anim == 30 || id == 140) { gpJeu->testEpee(x+zx, y+zy, zw, zh, EXPLOSION, 5, direction); gpJeu->testDegat(x+zx, y+zy, zw, zh, EXPLOSION, 5, direction); } break; case 5 : if (gpJeu->testEpee(x+zx, y+zy, zw, zh, FEU, 3, direction)) { changeType(7); vitesse=0; gpJeu->getAudio()->playSound(29); } break; case 6 : if (gpJeu->testEpee(x+zx, y+zy, zw, zh, COUP_GLACE, 3, direction)) vie=0; break; case 7 : gpJeu->testEpee(x+zx, y+zy, zw, zh, FEU, 1, direction); break; case 21 : case 22 : case 24 : if (gpJeu->testEpee(x+zx, y+zy, zw, zh, POT, 1, direction) && vitesse) { vitesse=0;anim=1;max=4;gpJeu->getAudio()->playSound(36); lastAnimTime = SDL_GetTicks(); } break; case 23 : case 25 : case 28 : if (gpJeu->testEpee(x+zx, y+zy, zw, zh, POT, 2, direction) && vitesse) { vitesse=0;anim=1;max=4;gpJeu->getAudio()->playSound(36); lastAnimTime = SDL_GetTicks(); } break; case 26 : case 27 : if (gpJeu->testEpee(x+zx, y+zy, zw, zh, POT, 4, direction) && vitesse) { vitesse=0;anim=1;max=4;gpJeu->getAudio()->playSound(36); lastAnimTime = SDL_GetTicks(); } break; case 29 : if (gpJeu->testDegat(x+zx, y+zy, zw, zh, POT, 2, direction) && vitesse) { vitesse=0;anim=1;max=4;gpJeu->getAudio()->playSound(36); lastAnimTime = SDL_GetTicks(); } break; case 130 : if (gpJeu->testEpee(x+zx, y+zy, zw, zh, POT, 4, direction) && vitesse) { vitesse=0;anim=1;max=4;gpJeu->getAudio()->playSound(36); lastAnimTime = SDL_GetTicks(); } break; } }
void SearchWidget::initConnect(){ connect(searchButton, SIGNAL(clicked()), this, SLOT(onSearchClicked())); connect(colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog())); connect(changeButton, SIGNAL(clicked()), this, SLOT(changeType())); }
AddressEditDialog::AddressEditDialog( const KABC::Address::List &list, int selected, QWidget *parent, const char *name ) : KDialogBase( Plain, i18n( "street/postal", "Edit Address" ), Ok | Cancel, Ok, parent, name, true, true ), mPreviousAddress( 0 ) { mAddressList = list; QWidget *page = plainPage(); QGridLayout *topLayout = new QGridLayout( page, 8, 2 ); topLayout->setSpacing( spacingHint() ); mTypeCombo = new AddressTypeCombo( mAddressList, page ); topLayout->addMultiCellWidget( mTypeCombo, 0, 0, 0, 1 ); QLabel *label = new QLabel( i18n( "<streetLabel>:", "%1:" ).arg( KABC::Address::streetLabel() ), page ); label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); topLayout->addWidget( label, 1, 0 ); mStreetTextEdit = new QTextEdit( page ); mStreetTextEdit->setTextFormat( Qt::PlainText ); label->setBuddy( mStreetTextEdit ); topLayout->addWidget( mStreetTextEdit, 1, 1 ); TabPressEater *eater = new TabPressEater( this ); mStreetTextEdit->installEventFilter( eater ); label = new QLabel( i18n( "<postOfficeBoxLabel>:", "%1:" ).arg( KABC::Address::postOfficeBoxLabel() ), page ); topLayout->addWidget( label, 2 , 0 ); mPOBoxEdit = new KLineEdit( page ); label->setBuddy( mPOBoxEdit ); topLayout->addWidget( mPOBoxEdit, 2, 1 ); label = new QLabel( i18n( "<localityLabel>:", "%1:" ).arg( KABC::Address::localityLabel() ), page ); topLayout->addWidget( label, 3, 0 ); mLocalityEdit = new KLineEdit( page ); label->setBuddy( mLocalityEdit ); topLayout->addWidget( mLocalityEdit, 3, 1 ); label = new QLabel( i18n( "<regionLabel>:", "%1:" ).arg( KABC::Address::regionLabel() ), page ); topLayout->addWidget( label, 4, 0 ); mRegionEdit = new KLineEdit( page ); label->setBuddy( mRegionEdit ); topLayout->addWidget( mRegionEdit, 4, 1 ); label = new QLabel( i18n( "<postalCodeLabel>:", "%1:" ).arg( KABC::Address::postalCodeLabel() ), page ); topLayout->addWidget( label, 5, 0 ); mPostalCodeEdit = new KLineEdit( page ); label->setBuddy( mPostalCodeEdit ); topLayout->addWidget( mPostalCodeEdit, 5, 1 ); label = new QLabel( i18n( "<countryLabel>:", "%1:" ).arg( KABC::Address::countryLabel() ), page ); topLayout->addWidget( label, 6, 0 ); mCountryCombo = new KComboBox( page ); mCountryCombo->setEditable( true ); mCountryCombo->setDuplicatesEnabled( false ); #if KDE_IS_VERSION(3,3,0) QPushButton *labelButton = new QPushButton( i18n( "Edit Label..." ), page ); topLayout->addMultiCellWidget( labelButton, 7, 7, 0, 1 ); connect( labelButton, SIGNAL( clicked() ), SLOT( editLabel() ) ); #endif fillCountryCombo(); label->setBuddy( mCountryCombo ); topLayout->addWidget( mCountryCombo, 6, 1 ); mPreferredCheckBox = new QCheckBox( i18n( "street/postal", "This is the preferred address" ), page ); topLayout->addMultiCellWidget( mPreferredCheckBox, 8, 8, 0, 1 ); KSeparator *sep = new KSeparator( KSeparator::HLine, page ); topLayout->addMultiCellWidget( sep, 9, 9, 0, 1 ); QHBox *buttonBox = new QHBox( page ); buttonBox->setSpacing( spacingHint() ); topLayout->addMultiCellWidget( buttonBox, 10, 10, 0, 1 ); QPushButton *addButton = new QPushButton( i18n( "New..." ), buttonBox ); connect( addButton, SIGNAL( clicked() ), SLOT( addAddress() ) ); mRemoveButton = new QPushButton( i18n( "Remove" ), buttonBox ); connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeAddress() ) ); mChangeTypeButton = new QPushButton( i18n( "Change Type..." ), buttonBox ); connect( mChangeTypeButton, SIGNAL( clicked() ), SLOT( changeType() ) ); mTypeCombo->updateTypes(); mTypeCombo->setCurrentItem( selected ); updateAddressEdits(); connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( updateAddressEdits() ) ); connect( mStreetTextEdit, SIGNAL( textChanged() ), SLOT( modified() ) ); connect( mPOBoxEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mLocalityEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mRegionEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mPostalCodeEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mCountryCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mPreferredCheckBox, SIGNAL( toggled( bool ) ), SLOT( modified() ) ); KAcceleratorManager::manage( this ); mChanged = false; bool state = (mAddressList.count() > 0); mRemoveButton->setEnabled( state ); mChangeTypeButton->setEnabled( state ); }