void Service::removeAddress(iostream::XdrInputStream& istream, iostream::XdrOutputStream& ostream) { ostream.write(net::MessageProtocol::REPLY); ostream.flush(); std::string name; istream.read(name); // istream.flush(); std::string address; istream.read(address); // istream.flush(); removeAddress(name, address); }
TPUARTLayer2Driver::~TPUARTLayer2Driver () { TRACEPRINTF (t, 2, this, "Close"); Stop (); pth_event_free (getwait, PTH_FREE_THIS); while (!inqueue.isempty ()) delete inqueue.get (); while (!outqueue.isempty ()) delete outqueue.get (); if (fd != -1) { removeAddress (addr); close (fd); } }
void PersonView::slotLinkClicked( const QUrl &url ) { qDebug() << "CLICKED" << url; if ( url.scheme() == "polka" ) { QStringList path = url.path().split("/"); QString action = path.first(); qDebug() << "ACTION" << action; if ( action == "editName" ) editName(); else if ( action == "addEmail" ) addEmail(); else if ( action == "editEmail" ) editEmail( path.value( 1 ) ); else if ( action == "removeEmail" ) removeEmail( path.value( 1 ) ); else if ( action == "commentEmail" ) commentEmail( path.value( 1 ) ); else if ( action == "addPhone" ) addPhone(); else if ( action == "editPhone" ) editPhone( path.value( 1 ) ); else if ( action == "removePhone" ) removePhone( path.value( 1 ) ); else if ( action == "commentPhone" ) commentPhone( path.value( 1 ) ); else if ( action == "addLink" ) addLink(); else if ( action == "editLink" ) editLink( path.value( 1 ) ); else if ( action == "removeLink" ) removeLink( path.value( 1 ) ); else if ( action == "commentLink" ) commentLink( path.value( 1 ) ); else if ( action == "addAddress" ) addAddress(); else if ( action == "editAddress" ) editAddress( path.value( 1 ) ); else if ( action == "removeAddress" ) removeAddress( path.value( 1 ) ); else if ( action == "commentAddress" ) commentAddress( path.value( 1 ) ); else if ( action == "addComment" ) addComment(); else if ( action == "editComment" ) editComment( path.value( 1 ) ); else if ( action == "removeComment" ) removeComment( path.value( 1 ) ); else if ( action == "close" ) requestClose(); else if ( action == "magic" ) debugHtml(); else qDebug() << "unknown action" << action; } else { new KRun( QUrl( url ), this ); } }
void Service::run() { _runFlag = true; _serviceSocket = new net::ServerSocket(_port); _serviceSocket->listen(); while(_runFlag) { net::Socket& socket = _serviceSocket->accept(); iostream::XdrInputStream& istream = socket.getXdrInputStream(); iostream::XdrOutputStream& ostream = socket.getXdrOutputStream(); int requestType = 0; ostream.flush(); ostream.write(net::MessageProtocol::REPLY); ostream.flush(); istream.read(requestType); // istream.flush(); if (requestType == net::MessageProtocol::ADDADDRESS) { addAddress(istream, ostream); } else if (requestType == net::MessageProtocol::REMOVEADDRESS) { removeAddress(istream, ostream); } else if (requestType == net::MessageProtocol::GETAVAILABLEADDRESS) { getNextAddress(istream, ostream); } else { handleError(istream, ostream); } socket.close(); } delete _serviceSocket; }
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 ); }