コード例 #1
0
void SensorsConfig::invertSelect()
{
  for (QListViewItemIterator it(m_sensorView); it.current(); ++it) {
    QCheckListItem *item = static_cast<QCheckListItem *>(it.current());
    if (item->isOn())
      item->setOn(false);
    else
      item->setOn(true);
  }
}
コード例 #2
0
void ResourceKABCConfig::loadSettings(KRES::Resource *resource)
{
    ResourceKABC *res = static_cast<ResourceKABC *>(resource);
    if(res)
    {
        mAlarm->setChecked(res->alarm());
        QString days;
        mAlarmTimeEdit->setText(days.setNum(res->alarmDays()));

        mAlarmTimeEdit->setEnabled(res->alarm());
        mALabel->setEnabled(res->alarm());

        const QStringList categories = res->categories();
        QListViewItemIterator it(mCategoryView);
        while(it.current())
        {
            if(categories.contains(it.current()->text(0)))
            {
                QCheckListItem *item = static_cast<QCheckListItem *>(it.current());
                item->setOn(true);
            }
            ++it;
        }

        mUseCategories->setChecked(res->useCategories());
    }
    else
    {
        kdDebug(5700) << "ERROR: ResourceKABCConfig::loadSettings(): no ResourceKABC, cast failed" << endl;
    }
}
コード例 #3
0
    void editDynamicPlaylist( QWidget* parent, DynamicMode* mode )
    {
        DEBUG_BLOCK
        KDialogBase* dialog = basicDialog( parent );
        NewDynamic*  nd     = static_cast<NewDynamic*>(dialog->mainWidget());

        nd->m_name->setText( mode->title() );
        nd->m_cycleTracks->setChecked( mode->cycleTracks() );
        nd->m_markHistory->setChecked( mode->markHistory() );
        nd->m_upcomingIntSpinBox->setValue( mode->upcomingCount() );
        nd->m_previousIntSpinBox->setValue( mode->previousCount() );
        nd->m_appendCountIntSpinBox->setValue( mode->appendCount() );

        if( mode->appendType() == DynamicMode::CUSTOM )
        {
            //check items in the custom playlist
            nd->m_mixLabel->setText( i18n("Edit Dynamic Playlist") );
            QStringList items = mode->items();
            foreach( items )
            {
                QCheckListItem* current = static_cast<QCheckListItem*>( nd->selectPlaylist->findItem((*it),0) );
                if( current )
                    current->setOn(true);
            }
        }
コード例 #4
0
 void EntryWidgetKeyword::slotKeywordRenamed( QListViewItem * item, const QString & text, int /*col*/ )
 {
     KeywordListViewItem *kwlvi = dynamic_cast<KeywordListViewItem*>( item );
     if ( text.isEmpty() )
     {
         item->setText( 0, m_beforeRenaming );
         kwlvi->setOn( FALSE );
     }
     else if ( text != m_beforeRenaming )
     {
         if ( m_availableKeywords.contains( text ) )
         {
             item->setText( 0, m_beforeRenaming );
             KMessageBox::error( this, QString( i18n( "The keyword '%1' does already exist in the list of keywords.\nThe old name has been restored." ) ).arg( text ), i18n( "Renaming keyword failed" ) );
         }
         else
         {
             m_availableKeywords.remove( m_beforeRenaming );
             m_availableKeywords.append( text );
             if ( kwlvi->isGlobal() )
             {
                 m_globalKeywords.remove( m_beforeRenaming );
                 m_globalKeywords.append( text );
             }
             else
             {
                 m_fileKeywords.remove( m_beforeRenaming );
                 m_fileKeywords.append( text );
             }
             QCheckListItem *checkedItem = dynamic_cast<QCheckListItem*>( item );
             if ( checkedItem != NULL )
                 checkedItem->setOn( TRUE );
         }
     }
 }
コード例 #5
0
//
// Initialize the channel list view for level & submaster modes
//
void VCDockSliderProperties::fillChannelList()
{
  QString s;
  t_channel ch;
  t_channel channels;
  QCheckListItem* item = NULL;

  //
  // Fill the list view with available channels. Put only
  // those channels that are occupied by existing devices.
  //
  for (t_device_id i = 0; i < KDeviceArraySize; i++)
    {
      Device* d = _app->doc()->device(i);
      if (!d)
	{
	  continue;
	}
      else
	{
	  channels = (t_channel) d->deviceClass()->channels()->count();

	  for (ch = 0; ch < channels; ch++)
	    {
	      // DMX Channel
	      s.sprintf("%.3d", d->address() + ch + 1);
	      item = new QCheckListItem(m_channelList, s, 
					QCheckListItem::CheckBox);
	      
	      // Device name
	      item->setText(KColumnDevice, d->name());

	      // Device channel
	      s.sprintf("%.3d:" + 
			d->deviceClass()->channels()->at(ch)->name(), ch + 1);
	      item->setText(KColumnDeviceChannel, s);
	    }
	}
    }

  //
  // Check those channels that are found from slider's channel list
  //
  QValueList <t_channel>::iterator it;
  for (it = m_slider->channels()->begin();
       it != m_slider->channels()->end(); ++it)
    {
      s.sprintf("%.3d", (*it) + 1);
      item = static_cast<QCheckListItem*> (m_channelList
					   ->findItem(s, KColumnDMXChannel));
      if (item)
	{
	  item->setOn(true);
	}
    }
}
コード例 #6
0
void KPrPgConfDia::deselectAllSlides()
{
    QListViewItem *item = slides->firstChild();
    while( item )
    {
        QCheckListItem *checkItem = dynamic_cast<QCheckListItem*>( item );
        if( checkItem ) checkItem->setOn( false );
        item = item->nextSibling();
    }
}
コード例 #7
0
ファイル: categories.cpp プロジェクト: opieproject/opie
void CheckedListView::setChecked( const QStringList &checked )
{
    // iterate over all items
    bool showingChecked = FALSE;
    for ( QCheckListItem *i = (QCheckListItem *) firstChild();
	  i; i = (QCheckListItem *)i->nextSibling() )
	// see if the item should be checked by searching the
	// checked list
	if ( checked.find( i->text( 0 ) ) != checked.end() ) {
	   i->setOn( TRUE );
	   // make sure it is showing at least one checked item
	   if ( !showingChecked ) {
	       ensureItemVisible( i );
	       showingChecked = TRUE;
	   }
	}
       else
	   i->setOn( FALSE );
}
コード例 #8
0
ファイル: vcsliderproperties.cpp プロジェクト: speakman/qlc
void VCSliderProperties::levelSelectChannelsByGroup(QString group)
{
	QCheckListItem* fxiNode = NULL;
	QCheckListItem* chNode = NULL;

	for (fxiNode = static_cast<QCheckListItem*> (m_levelList->firstChild());
	     fxiNode != NULL;
	     fxiNode = static_cast<QCheckListItem*> (fxiNode->nextSibling()))
	{
		for (chNode = static_cast<QCheckListItem*> (fxiNode->firstChild());
		     chNode != NULL;
		     chNode = static_cast<QCheckListItem*> (chNode->nextSibling()))
		{
			if (chNode->text(KColumnType) == group)
				chNode->setOn(true);
			else
				chNode->setOn(false);
		}
	}
}
コード例 #9
0
ファイル: customwidgets.cpp プロジェクト: NgoHuy/uim
void OListEditForm::addCheckItem( bool isActive, const QString &str )
{
    QCheckListItem *item = NULL;
    QListViewItem *lastItem = m_listView->lastItem();
    if( lastItem )
        item = new QCheckListItem( m_listView, lastItem, str, QCheckListItem::CheckBox );
    else
        item = new QCheckListItem( m_listView, str, QCheckListItem::CheckBox );

    if( item )
        item->setOn( isActive );
}
コード例 #10
0
ファイル: projectdlgs.cpp プロジェクト: zoltanp/ktechlab-0.3
//BEGIN class LinkerOptionsDlg
LinkerOptionsDlg::LinkerOptionsDlg( LinkerOptions * linkingOptions, QWidget *parent )
	: KDialogBase( parent, "Linker Options Dialog", true, "Linker Options", KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true )
{
	m_pLinkerOptions = linkingOptions;
	m_pWidget = new LinkerOptionsWidget(this);
	
	ProjectInfo * pi = ProjectManager::self()->currentProject();
	assert(pi);
	
	
	//BEGIN Update gplink options
	m_pWidget->m_pHexFormat->setCurrentItem( m_pLinkerOptions->hexFormat() );
	m_pWidget->m_pOutputMap->setChecked( m_pLinkerOptions->outputMapFile() );
	m_pWidget->m_pLibraryDir->setText( m_pLinkerOptions->libraryDir() );
	m_pWidget->m_pLinkerScript->setText( m_pLinkerOptions->linkerScript() );
	m_pWidget->m_pOther->setText( m_pLinkerOptions->linkerOther() );
	//END Update gplink options
	
	
	
	//BEGIN Update library widgets
	const KURL::List availableInternal = pi->childOutputURLs( ProjectItem::LibraryType );
	const QStringList linkedInternal = m_pLinkerOptions->linkedInternal();
	
	KURL::List::const_iterator end = availableInternal.end();
	for ( KURL::List::const_iterator it = availableInternal.begin(); it != end; ++it )
	{
		QString relativeURL = KURL::relativeURL( pi->url(), *it );
		QCheckListItem * item = new QCheckListItem( m_pWidget->m_pInternalLibraries, relativeURL, QCheckListItem::CheckBox );
		item->setOn( linkedInternal.contains(relativeURL) );
	}
	
	m_pExternalLibraryRequester = new KURLRequester( 0l );
	m_pExternalLibraryRequester->fileDialog()->setURL( "/usr/share/sdcc/lib" );
	
	delete m_pWidget->m_pExternalLibraries;
	m_pWidget->m_pExternalLibraries = new KEditListBox( i18n("Link libraries outside project"), m_pExternalLibraryRequester->customEditor(), m_pWidget );
	m_pWidget->m_pExternalLibraries->layout()->setMargin(11);
	(dynamic_cast<QGridLayout*>(m_pWidget->layout()))->addMultiCellWidget( m_pWidget->m_pExternalLibraries, 7, 7, 0, 1 );
	
#if defined(KDE_MAKE_VERSION)
# if KDE_VERSION >= KDE_MAKE_VERSION(3,4,0)
	m_pWidget->m_pExternalLibraries->setButtons( KEditListBox::Add | KEditListBox::Remove );
# endif
#endif
	m_pWidget->m_pExternalLibraries->insertStringList( m_pLinkerOptions->linkedExternal() );
	//END Update library widgets
	
	
	setMainWidget( m_pWidget );
	setInitialSize( m_pWidget->rect().size() );
}
コード例 #11
0
void EvaQunMemberPicker::slotClicked(QListViewItem *item)
{
	if(!item) return;
	QCheckListItem *chkItem = dynamic_cast<QCheckListItem *>(item);
	if(!chkItem) return;
	unsigned int id;
	QString txt;
	QString strID;
	bool ok;
	QString nick;
	QPixmap face;
	
	QCheckListItem *child = dynamic_cast<QCheckListItem *>(chkItem->firstChild());
	if(!child){
		txt = chkItem->text(0);
		int index = txt.findRev("(");
		nick = txt.left( index );
		strID = txt.mid(index+1, txt.length() - index - 1 - 1);
		id = strID.toUInt(&ok);
		if(!ok) return;
		
		face = *(chkItem->pixmap(0));
		
		emit memberClicked(id, chkItem->isOn());
	}
	while(child){
		child->setOn(chkItem->isOn());
		
		txt = child->text(0);
		int index = txt.findRev("(");
		nick = txt.left( index );
		strID = txt.mid(index+1, txt.length() - index - 1 - 1);
		id = strID.toUInt(&ok);
		if(!ok) return;
		
		face = *(child->pixmap(0));
		
		emit memberClicked(id, child->isOn());
		child = dynamic_cast<QCheckListItem *>(child->nextSibling());
	}
}
コード例 #12
0
void KPluginSelectionWidget::init(const QValueList< KPluginInfo * > &plugininfos, const QString &category)
{
    // setup Widgets
    (new QVBoxLayout(this, 0, KDialog::spacingHint()))->setAutoAdd(true);
    KListView *listview = new KListView(this);
    d->tooltip = new KPluginListViewToolTip(listview->viewport(), listview);
    connect(listview, SIGNAL(pressed(QListViewItem *)), this, SLOT(executed(QListViewItem *)));
    connect(listview, SIGNAL(spacePressed(QListViewItem *)), this, SLOT(executed(QListViewItem *)));
    connect(listview, SIGNAL(returnPressed(QListViewItem *)), this, SLOT(executed(QListViewItem *)));
    connect(listview, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(executed(QListViewItem *)));
    listview->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    listview->setAcceptDrops(false);
    listview->setFullWidth(true);
    listview->setSelectionModeExt(KListView::Single);
    listview->setAllColumnsShowFocus(true);
    listview->addColumn(i18n("Name"));
    for(QValueList< KPluginInfo * >::ConstIterator it = plugininfos.begin(); it != plugininfos.end(); ++it)
    {
        d->plugincheckedchanged[*it] = false;
        if(!(*it)->isHidden() && (category.isNull() || (*it)->category() == category))
        {
            QCheckListItem *item = new KPluginInfoLVI(*it, listview);
            if(!(*it)->icon().isEmpty())
                item->setPixmap(0, SmallIcon((*it)->icon(), IconSize(KIcon::Small)));
            item->setOn((*it)->isPluginEnabled());
            d->pluginInfoMap.insert(item, *it);
        }
    }

    // widgetstack
    d->widgetstack = d->kps->widgetStack();
    load();
    // select and highlight the first item in the plugin list
    if(listview->firstChild())
        listview->setSelected(listview->firstChild(), true);
}
コード例 #13
0
	Clean::Clean(QWidget *parent, const QString & filename, const QStringList & extlist) : 
		KDialogBase( KDialogBase::Plain, i18n("Delete Files"), Ok | Cancel, Ok, parent, 0, true, true),
		m_extlist(extlist)
	{
		// Layout
		QVBoxLayout *vbox = new QVBoxLayout(plainPage(), 6,6 );
		
		// label widgets
		QWidget *labelwidget = new QWidget(plainPage());
		QHBoxLayout *labellayout = new QHBoxLayout(labelwidget);
		
		// line 1: picture and label
		QLabel *picture =  new QLabel("", labelwidget);
		picture->setPixmap( KGlobal::instance()->iconLoader()->loadIcon("messagebox_warning", KIcon::NoGroup, KIcon::SizeMedium) );
		QLabel *label =  new QLabel(i18n( "Do you really want to delete these files?" ), labelwidget);
		labellayout->addWidget(picture);
		labellayout->addSpacing(20);
		labellayout->addWidget(label);
		
		// line 2: listview
		listview = new KListView(plainPage());
		listview->addColumn(i18n("Files"));
		listview->setSorting(-1);
		
		// insert items into listview
		QString base = QFileInfo(filename).baseName(true);
		for (uint i=0; i <  m_extlist.count(); ++i)
		{
			QCheckListItem *item = new QCheckListItem(listview, base + m_extlist[i], QCheckListItem::CheckBox);
			item->setOn(true);
			listview->insertItem(item);
		}

		vbox->addWidget(labelwidget,0,Qt::AlignHCenter);
		vbox->addWidget(listview);
	}
コード例 #14
0
void KPrPgConfDia::setupPageSlides()
{
    QFrame* slidesPage = addPage( i18n("&Slides") );
    QWhatsThis::add( slidesPage, i18n("<p>This dialog allows you to configure which slides "
				      "are used in the presentation. Slides that are not "
				      "selected will not be displayed during the slide "
				      "show.</p>") );
    QGridLayout *slidesLayout = new QGridLayout( slidesPage,7 , 2, 0, KDialog::spacingHint());


    QButtonGroup *group=new QVButtonGroup( slidesPage );
    group->setRadioButtonExclusive( true );

    m_customSlide = new QRadioButton( i18n( "Custom slide show" ), group, "customslide" );

    connect( m_customSlide, SIGNAL( clicked () ), this, SLOT( radioButtonClicked() ) );

    QHBox *box = new QHBox( group );

    m_labelCustomSlide = new QLabel( i18n( "Custom slide:" ),box );

    m_customSlideCombobox = new QComboBox( box );
    m_customSlideCombobox->insertStringList( m_doc->presentationList() );

    m_selectedSlide = new QRadioButton( i18n( "Selected pages:" ), group, "selectedslide" );
    slidesLayout->addMultiCellWidget( group, 0,2,0,1 );
    connect( m_selectedSlide, SIGNAL( clicked () ), this, SLOT( radioButtonClicked() ) );

    slides = new QListView( slidesPage );
    slidesLayout->addMultiCellWidget( slides, 3, 3, 0, 1 );
    slidesLayout->setRowStretch( 3, 10 );
    slides->addColumn( i18n("Slide") );
    slides->setSorting( -1 );
    slides->header()->hide();

    for ( int i = m_doc->getPageNums() - 1; i >= 0; --i )
    {
        KPrPage *page=m_doc->pageList().at( i );
        QCheckListItem* item = new QCheckListItem( slides,
                                                   page->pageTitle(),
                                                   QCheckListItem::CheckBox );
        item->setOn( page->isSlideSelected() );
    }

    QHBox* buttonGroup = new QHBox( slidesPage );
    buttonGroup->setSpacing( KDialog::spacingHint() );

    QPushButton* selectAllButton = new QPushButton( i18n( "Select &All" ), buttonGroup );
    connect( selectAllButton, SIGNAL( clicked() ), this, SLOT( selectAllSlides() ) );

    QPushButton* deselectAllButton = new QPushButton( i18n( "&Deselect All" ), buttonGroup );
    connect( deselectAllButton, SIGNAL( clicked() ), this, SLOT( deselectAllSlides() ) );

    QWidget* spacer = new QWidget( buttonGroup );

    spacer->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
    slidesLayout->addMultiCellWidget( buttonGroup, 4, 4, 0, 1 );

    if ( !m_doc->presentationName().isEmpty() )
    {
        m_customSlide->setChecked( true );
        m_customSlideCombobox->setCurrentText( m_doc->presentationName() );
    }
    else
        m_selectedSlide->setChecked( true );

    if ( m_customSlideCombobox->count()==0 )
    {
        m_customSlide->setEnabled( false );
        m_labelCustomSlide->setEnabled( false );
        m_customSlideCombobox->setEnabled( false );
    }
    radioButtonClicked();
}
コード例 #15
0
ファイル: qt_ui.C プロジェクト: BackupTheBerlios/thefish-svn
extern "C" int
create_qt_ui(RC_CONF *my_rc,
             int argc, char **argv)
{
    int i;
    char *homedir;
    char temp[FILENAME_MAX];
    int fd;
    FILE *fp;
    QListViewItem *element;
    QCheckListItem *foo;

    MyDialogs my_dialogs;
    TableCallbacks my_tablecallbacks;

    thefish = new QApplication( argc, argv);

    // It's more convenient to have these
    // as global.
    my_rc_knobs = my_rc->knobs_ptr;
    my_rc_strings = my_rc->string_ptr;

    my_num_knobs = my_rc->knobs_size;
    my_num_strings = my_rc->string_size;

    mw = new QMainWindow;

    QVBox *vbox = new QVBox(mw, 0, 0);

    QTabWidget main_tab(vbox, 0, 0);

    knobs_table = new QListView;
    strings_table = new QListView;

    strings_table->setAllColumnsShowFocus(TRUE);

    knobs_table->addColumn("Variable Name", -1);

    strings_table->addColumn("Name", -1);
    strings_table->addColumn("Value",-1);

    QObject::connect(strings_table, SIGNAL(itemRenamed(QListViewItem*, int, const QString &)),
                     &my_tablecallbacks, SLOT(StringChanged(QListViewItem*, int, const QString &)));


    QObject::connect(knobs_table, SIGNAL(clicked(QListViewItem *)),
                     &my_tablecallbacks, SLOT(KnobChanged(QListViewItem*)));


    QObject::connect(strings_table, SIGNAL(clicked(QListViewItem *)),
                     &my_tablecallbacks, SLOT(StringClicked(QListViewItem*)));

    main_tab.addTab(knobs_table, "Knobs");
    main_tab.addTab(strings_table, "Strings");

    QHBox *hbuttons = new QHBox(vbox, 0, 0);

    SaveButton = new QPushButton("&Save", hbuttons, 0);
    QPushButton AddButton("&Add", hbuttons, 0);
    QPushButton AboutButton("A&bout", hbuttons, 0);
    QPushButton QuitButton("&Quit",  hbuttons, 0);

    // No save for now...
    SaveButton->setEnabled(false);

    QObject::connect(&QuitButton, SIGNAL(clicked()), &my_dialogs, SLOT(CheckSaved()));
    QObject::connect(&AboutButton, SIGNAL(clicked()), &my_dialogs, SLOT(ShowAbout()));
    QObject::connect(&AddButton, SIGNAL(clicked()), &my_dialogs, SLOT(DoAdd()));
    QObject::connect(SaveButton, SIGNAL(clicked()), &my_dialogs, SLOT(DoSave()));

    // We're now using human readable data, handle the migration
    // transparently for the user.
    homedir = getenv("HOME");

    if (homedir != NULL) {

        snprintf(temp, FILENAME_MAX, "%s/%s", homedir, ".thefishrc");
        fd = open(temp, O_RDONLY, 0);

        if (fd != -1 ) {

            i = lseek(fd, 0, SEEK_END);
            lseek(fd, 0, SEEK_SET);

            if (i == sizeof(oldsize)) {

                read(fd, &oldsize[0], sizeof(oldsize));
                close(fd);

            } else {

                fp = fdopen(fd, "r");
                fscanf(fp, "geometry=%i,%i", &oldsize[0], &oldsize[1]);
                fclose(fp);

            }

        } else  {
            // Set some default values
            oldsize[0] = 400;
            oldsize[1] = 480;

        }

    }

    // Build the table

    knobs_table->setColumnWidthMode (1, QListView::Maximum);
    knobs_table->setRootIsDecorated(false);

    for (i = my_rc->knobs_size - 1; i >= 0; i--) {

        // No user comments yet
        (my_rc->knobs_ptr+i)->user_comment = 0;

        foo = new QCheckListItem( knobs_table, (my_rc->knobs_ptr+i)->name, QCheckListItem::CheckBox);

        if ((my_rc->knobs_ptr+i)->knob_val == KNOB_IS_NO) {

            foo->setOn(FALSE);

        } else {

            foo->setOn(TRUE);

        }

    }

    for (i = my_rc->string_size - 1; i >= 0; i--) {

        // No user comments yet
        (my_rc->string_ptr+i)->user_comment = 0;

        element = new QListViewItem(strings_table,
                                    (my_rc->string_ptr+i)->name,
                                    (my_rc->string_ptr+i)->value);
        element->setRenameEnabled(0, FALSE);
        element->setRenameEnabled(1, TRUE);

    }

    // Set the app icon
    QPixmap my_icon((const char **) fish64_xpm);

    mw->setIcon((const QPixmap ) my_icon);

    mw->setCaption("The Fish " THE_FISH_VERSION);
    mw->setCentralWidget( vbox );
    thefish->setMainWidget(mw);
    mw->show();
    mw->resize(oldsize[0], oldsize[1]);

    dirty = 0;

    my_status_bar = mw->statusBar();
    my_status_bar->message("Ready");

    return thefish->exec();

}
コード例 #16
0
ファイル: qt_ui.C プロジェクト: BackupTheBerlios/thefish-svn
void
MyDialogs::DoAdd()
{
    int i;
    int dupe,invalid;
    char c, d;
    QString my_name, my_value, my_comment;
    QCheckListItem *foo;
    QListViewItem *element;
    char *new_name, *new_value, *new_comment;

    QDialog *my_add_dialog = new QDialog(mw, "my_add_dialog", 0);
    QBoxLayout *add_vbox = new QVBoxLayout(my_add_dialog);

    QTable *table = new QTable(3, 2, my_add_dialog);

    add_vbox->addWidget(table);

    table->setText(0, 0, "Name");

    table->setText(1, 0, "Value");
    table->setText(1, 1, "\"\"");

    table->setText(2, 0, "Optional comment");

    table->setColumnReadOnly(0, true);

    table->adjustColumn(0);
    table->setColumnWidth(1, 180);

    table->setLeftMargin(0);
    table->setTopMargin(0);

    QHBox *add_hbuttons = new QHBox(my_add_dialog, 0, 0);

    add_vbox->addWidget(add_hbuttons);

    QPushButton *AddYesButton = new QPushButton("&OK", add_hbuttons, 0);
    QPushButton *AddNoButton = new QPushButton("&Cancel", add_hbuttons, 0);

    QObject::connect(AddYesButton, SIGNAL(clicked()), my_add_dialog, SLOT(accept()));
    QObject::connect(AddNoButton, SIGNAL(clicked()), my_add_dialog, SLOT(reject()));

    add_vbox->setResizeMode(QLayout::Auto);
    add_vbox->activate();

    my_add_dialog->setCaption("Add a new entry");

    if (my_add_dialog->exec() == QDialog::Accepted) {

        dupe = 0;
        invalid = 0;
        my_name = table->text( 0, 1);
        my_value = table->text(1, 1);
        my_comment = table->text(2, 1);

        new_name = (char *) my_name.ascii();
        new_value = (char *) my_value.ascii();
        new_comment = (char *) my_comment.ascii();

        if (new_name == NULL || new_value == NULL) {

            QMessageBox::critical(0, "The Fish",
                                  "Name and Value cannot be null.");

            delete(my_add_dialog);
            return;

        }

        for (i = 0; i < my_num_knobs; i++) {

            if (strncmp(my_name.ascii(), (my_rc_knobs+i)->name, 255) == 0) {

                dupe = 1;
                break;

            }

        }

        for (i = 0; i < my_num_strings; i++) {

            if (strncmp(my_name.ascii(), (my_rc_strings+i)->name, 255) == 0) {

                dupe = 1;
                break;

            }

        }

        if (dupe == 1) {

            QMessageBox::critical(0, "The Fish",
                                  "An entry with that name already exists.");


        } else {

            c = new_value[0];
            d = new_value[strlen(new_value)-1];

            if (c != '"' || d != '"') {

                QMessageBox::critical(0, "The Fish",
                                      "Value must begin and end with \".");

                delete(my_add_dialog);
                return;

            }

            // It's a knob set to YES
            if (strncasecmp(new_value, KNOB_YES, 255) == 0) {

                (my_rc_knobs+my_num_knobs)->user_comment = 0;
                (my_rc_knobs+my_num_knobs)->user_added = USER_ADDED_YES;
                (my_rc_knobs+my_num_knobs)->knob_val = KNOB_IS_YES;
                (my_rc_knobs+my_num_knobs)->knob_orig = KNOB_IS_YES;
                (my_rc_knobs+my_num_knobs)->modified = MODIFIED_YES;

                strncpy((my_rc_knobs+my_num_knobs)->name, new_name, 255);


                if (new_comment != NULL) {

                    if (strlen(new_comment) > 1) {

                        strncpy((my_rc_knobs+my_num_knobs)->comment, new_comment, 255);
                        (my_rc_knobs+my_num_knobs)->user_comment = 1;

                    }

                }

                foo = new QCheckListItem(knobs_table, (my_rc_knobs+my_num_knobs)->name,
                                         QCheckListItem::CheckBox);
                foo->setOn(TRUE);

                my_num_knobs++;
                dirty++;
                SaveButton->setEnabled(TRUE);

                // It's a knob set to NO
            } else if (strncasecmp(new_value, KNOB_NO, 255) == 0) {

                (my_rc_knobs+my_num_knobs)->user_comment = 0;
                (my_rc_knobs+my_num_knobs)->user_added = USER_ADDED_YES;
                (my_rc_knobs+my_num_knobs)->knob_val = KNOB_IS_NO;
                (my_rc_knobs+my_num_knobs)->knob_orig = KNOB_IS_NO;
                (my_rc_knobs+my_num_knobs)->modified = MODIFIED_YES;

                strncpy((my_rc_knobs+my_num_knobs)->name, new_name, 255);


                if (new_comment != NULL) {

                    if (strlen(new_comment) > 1) {

                        strncpy((my_rc_knobs+my_num_knobs)->comment, new_comment, 255);
                        (my_rc_knobs+my_num_knobs)->user_comment = 1;

                    }

                }

                foo = new QCheckListItem(knobs_table, (my_rc_knobs+my_num_knobs)->name,
                                         QCheckListItem::CheckBox);
                foo->setOn(FALSE);

                my_num_knobs++;
                dirty++;
                SaveButton->setEnabled(TRUE);

                // It's a string
            } else {

                (my_rc_strings+my_num_strings)->user_comment = 0;
                (my_rc_strings+my_num_strings)->user_added = USER_ADDED_YES;
                (my_rc_strings+my_num_strings)->modified = MODIFIED_YES;

                strncpy((my_rc_strings+my_num_strings)->name, new_name, 255);
                strncpy((my_rc_strings+my_num_strings)->value, new_value, 255);
                strncpy((my_rc_strings+my_num_strings)->orig, new_value, 255);

                if (new_comment != NULL) {

                    if (strlen(new_comment) > 1) {

                        strncpy((my_rc_strings+my_num_strings)->comment, new_comment, 255);
                        (my_rc_strings+my_num_strings)->user_comment = 1;

                    }

                }

                element = new QListViewItem(strings_table,
                                            (my_rc_strings+my_num_strings)->name,
                                            (my_rc_strings+my_num_strings)->value);

                element->setRenameEnabled(0, FALSE);
                element->setRenameEnabled(1, TRUE);

                my_num_strings++;
                dirty++;
                SaveButton->setEnabled(TRUE);

            }

        }

    }

    delete(my_add_dialog);

}