예제 #1
0
void SCNetworkEventPublisher::configure() {
  for (const auto& sub : subscriptions_) {
    auto sc = getSubscriptionContext(sub->context);
    if (sc->type == ADDRESS_TARGET) {
      auto existing_address = std::find(
          target_addresses_.begin(), target_addresses_.end(), sc->target);
      if (existing_address != target_addresses_.end()) {
        // Add the address target.
        addAddress(sc);
      }
    } else {
      auto existing_hostname =
          std::find(target_names_.begin(), target_names_.end(), sc->target);
      if (existing_hostname != target_names_.end()) {
        // Add the hostname target.
        addHostname(sc);
      }
    }
  }

  // Make sure at least one target exists.
  if (targets_.empty()) {
    auto sc = createSubscriptionContext();
    sc->type = NAME_TARGET;
    sc->target = "localhost";
    addHostname(sc);
  }

  restart();
}
예제 #2
0
ChooserDlg::ChooserDlg()
	: inherited()
{
	completeMenu( LOGIN_REMOTE_ONLY, ex_greet, i18n("&Local Login"), ALT+Key_L );

	QBoxLayout *vbox = new QVBoxLayout( this, 10, 10 );

	QLabel *title = new QLabel( i18n("XDMCP Host Menu"), this );
	title->setAlignment( AlignCenter );
	vbox->addWidget( title );

	host_view = new QListView( this, "hosts" );
	host_view->addColumn( i18n("Hostname") );
	host_view->setColumnWidth( 0, fontMetrics().width( "login.crap.net" ) );
	host_view->addColumn( i18n("Status") );
	host_view->setMinimumWidth( fontMetrics().width( "login.crap.com Display not authorized to connect this server" ) );
	host_view->setResizeMode( QListView::LastColumn );
	host_view->setAllColumnsShowFocus( true );
	vbox->addWidget( host_view );

	iline = new QLineEdit( this );
	iline->setEnabled( TRUE );
	QLabel *itxt = new QLabel( iline, i18n("Hos&t:"), this );
	QPushButton *addButton = new QPushButton( i18n("A&dd"), this );
	connect( addButton, SIGNAL(clicked()), SLOT(addHostname()) );
	QBoxLayout *hibox = new QHBoxLayout( vbox, 10 );
	hibox->addWidget( itxt );
	hibox->addWidget( iline );
	hibox->addWidget( addButton );

	// Buttons
	QPushButton *acceptButton = new QPushButton( i18n("&Accept"), this );
	acceptButton->setDefault( true );
	QPushButton *pingButton = new QPushButton( i18n("&Refresh"), this );

	QBoxLayout *hbox = new QHBoxLayout( vbox, 20 );
	hbox->addWidget( acceptButton );
	hbox->addWidget( pingButton );
	hbox->addStretch( 1 );

	if (optMenu) {
		QPushButton *menuButton = new QPushButton( i18n("&Menu"), this );
		menuButton->setPopup( optMenu );
		hbox->addWidget( menuButton );
		hbox->addStretch( 1 );
	}

//	QPushButton *helpButton = new QPushButton( i18n("&Help"), this );
//	hbox->addWidget( helpButton );

#ifdef WITH_KDM_XCONSOLE
	if (consoleView)
		vbox->addWidget( consoleView );
#endif

	sn = new QSocketNotifier( rfd, QSocketNotifier::Read, this );
	connect( sn, SIGNAL(activated( int )), SLOT(slotReadPipe()) );

	connect( pingButton, SIGNAL(clicked()), SLOT(pingHosts()) );
	connect( acceptButton, SIGNAL(clicked()), SLOT(accept()) );
//	connect( helpButton, SIGNAL(clicked()), SLOT(slotHelp()) );
	connect( host_view, SIGNAL(doubleClicked(QListViewItem *)), SLOT(accept()) );

	adjustGeometry();
}