Beispiel #1
0
// Das in der Listenansicht ausgew�lte Verb wird gel�cht.
void KVerbEdit::slotDelete()
{
	QListViewItem* pi = ListView1->selectedItem();
	if (0 != pi)
	{
		// Das Listenelement hersuchen
		bool found = false;
		spanishVerbList::Iterator it = list.begin();
		while ((it != list.end()) && (!found))
		{
			if (((*it).getSpanish() == pi->text(0)) && ((*it).getForeign() == pi->text(1)))
			{
				found = true;
			}
			else
				it++;
		};
		if (found)
		{
			list.remove(it);
			// Das Verb auch aus der Listenansicht streichen
			ListView1->takeItem(pi);
			changed = true;
		};
	};
}
void servercontroller::new_channel()
{
  QString server;
  QListViewItem *citem = ConnectionTree->currentItem(); // get item
  if(citem){ // if it exist, ie something is highlighted, continue
    if(proc_list[citem->text(0)]){ // If it's a match with a server, ok
      server = citem->text(0);
    }
    // Otherwise, check the parent to see it's perhaps a server.
    else if ( citem->parent() ) {
      if(proc_list[citem->parent()->text(0)]){
        server = citem->parent()->text(0);
      }
    }
  }

  if(server.isEmpty())
    return;

  KSircChannel ci(server, QString::null);
  NewWindowDialog w(ci);
  connect(&w, SIGNAL(openTopLevel(const KSircChannel &)),
	  this, SLOT(new_toplevel(const KSircChannel &)));
  w.exec();
}
QString FavoriteFolderView::prettyName(KMFolderTreeItem *fti)
{
    assert(fti);
    assert(fti->folder());
    QString name = fti->folder()->label();
    QListViewItem *accountFti = fti;
    while(accountFti->parent())
        accountFti = accountFti->parent();
    if(fti->type() == KFolderTreeItem::Inbox)
    {
        if(fti->protocol() == KFolderTreeItem::Local || fti->protocol() == KFolderTreeItem::NONE)
        {
            name = i18n("Local Inbox");
        }
        else
        {
            name = i18n("Inbox of %1").arg(accountFti->text(0));
        }
    }
    else
    {
        if(fti->protocol() != KFolderTreeItem::Local && fti->protocol() != KFolderTreeItem::NONE)
        {
            name = i18n("%1 on %2").arg(fti->text(0)).arg(accountFti->text(0));
        }
        else
        {
            name = i18n("%1 (local)").arg(fti->text(0));
        }
    }
    return name;
}
Beispiel #4
0
void ChaserEditor::slotLowerClicked()
{
  QListViewItem* item = m_stepList->currentItem();
  t_function_id fid = 0;
  int index = 0;
  int newIndex = 0;

  if (item != NULL)
    {
      index = item->text(COL_NUM).toInt() - 1;
      fid = item->text(COL_FID).toInt();

      if (m_chaser->lowerStep(index))
	{
	  updateStepList();
	  
	  // Select the item again, now it's one step below
	  QListViewItemIterator it(m_stepList);
	  while (it.current() != NULL)
	    {
	      if (newIndex == index + 1)
		{
		  m_stepList->setSelected(it.current(), true);
		  break;
		}
	      
	      newIndex++;
	      ++it;
	    }
	}
    }
}
Beispiel #5
0
//
// Remove a device
//
void DeviceManagerView::slotRemove()
{
  QListViewItem* item = m_listView->currentItem();
  
  // Get the device id
  t_device_id id = item->text(KColumnID).toInt();
  
  // Display a warning
  QString msg;
  msg = ("Do you want to remove device \"");
  msg += item->text(KColumnName) + QString("\"?");
  if (QMessageBox::warning(this, KApplicationNameShort, msg,
			   QMessageBox::Yes, QMessageBox::No) 
      == QMessageBox::No)
    {
      return;
    }
  else
    {
      Device* device = _app->doc()->device(id);
      
      ASSERT(device);
      
      _app->doc()->deleteDevice(id);
    }

  if (m_listView->currentItem())
    {
      m_listView->setSelected(m_listView->currentItem(), true);
    }
  else
    {
      slotSelectionChanged(NULL);
    }
}
Beispiel #6
0
void KstDataManagerI::edit_I() {
  QListViewItem *qi;

  if (DataView->selectedItems().count() > 0) {
    qi = DataView->selectedItems().at(0);
  } else {
    KMessageBox::sorry(this, i18n("A data item must be selected to edit."));
    return;
  }

  if (qi->rtti() == RTTI_OBJ_DATA_VECTOR) {
    emit editDataVector(qi->text(0));
  }

  if (qi->rtti() == RTTI_OBJ_STATIC_VECTOR) {
    emit editStaticVector(qi->text(0));
  }

  if (qi->rtti() == RTTI_OBJ_OBJECT) {
    static_cast<KstObjectItem*>(qi)->dataObject()->showDialog();
  }
  
  if (qi->rtti() == RTTI_OBJ_DATA_MATRIX) {
    emit editDataMatrix(qi->text(0));  
  }
  
  if (qi->rtti() == RTTI_OBJ_STATIC_MATRIX) {
    emit editStaticMatrix(qi->text(0));  
  }
}
Beispiel #7
0
void MainInfo::phoneSelectionChanged()
{
    QListViewItem *item = lstPhones->currentItem();
    bool bEnable = ((item != NULL) && (item->text(PHONE_PROTO).isEmpty() || (item->text(PHONE_PROTO) == "-")));
    btnPhoneEdit->setEnabled(bEnable);
    btnPhoneDelete->setEnabled(bEnable);
}
void TeamMembersDlg::slotSetToYourself()
{
  QListViewItem *item =membersListView->currentItem();
  if (!item) return; 
  yourselfLabel->setText(item->text(NAME_COL) + " <" + item->text(EMAIL_COL) + ">");
  m_yourself = item->text(NICKNAME_COL);
}
Beispiel #9
0
/***
 * Get a list of all of the files to backup.
 */
int BackupAndRestore::getBackupFiles(QString &backupFiles, QListViewItem *parent)
{
    QListViewItem * currentItem;
    QString currentHome;
    if(!parent)
        currentItem = backupList->firstChild();
    else
    {
        currentItem = parent->firstChild();
        currentHome = parent->text(BACKUP_LOCATION);
    }

    uint count = 0;
    while( currentItem != 0 )
    {
        if(currentItem->text(HEADER_BACKUP) == "B" )
        {
            if(currentItem->childCount() == 0 )
            {
                if(parent == NULL)
                    backupFiles += currentItem->text(BACKUP_LOCATION);
                else
                    backupFiles += currentHome + currentItem->text(HEADER_NAME);
                backupFiles += " ";
                count++;
            }
            else
            {
                count += getBackupFiles(backupFiles, currentItem);
            }
        }
        currentItem = currentItem->nextSibling();
    }
    return count;
}
Beispiel #10
0
void UserAgentDlg::changePressed()
{
    UAProviderDlg pdlg(i18n("Modify Identification"), this, m_provider);

    QListViewItem *index = dlg->lvDomainPolicyList->currentItem();

    if(!index)
        return;

    QString old_site = index->text(0);
    pdlg.setSiteName(old_site);
    pdlg.setIdentity(index->text(1));

    if(pdlg.exec() == QDialog::Accepted)
    {
        QString new_site = pdlg.siteName();
        if(new_site == old_site || !handleDuplicate(new_site, pdlg.identity(), pdlg.alias()))
        {
            index->setText(0, new_site);
            index->setText(1, pdlg.identity());
            index->setText(2, pdlg.alias());
            configChanged();
        }
    }
}
void
EventView::excludeEvent(const QString& _domainName, const QString& _typeName)
{
  QListViewItem * item = list_->firstChild();
  QListViewItem * pre = NULL;
  while (item != NULL) {
    QListViewItem * next = item->nextSibling();
    if (item->text(1) == _domainName &&
	item->text(2) == _typeName) {
      // if the item to delete is selected
      if (list_->selectedItem() == item) {
	// we take the previous one if possible
	if (pre != NULL) {
	  list_->setSelected(pre, true);
	}
	// otherwise the next
	// if this is not possible, the list will
	// be empty afterwards
	else if (next != NULL) {
	  list_->setSelected(next, true);
	}
      }
      delete item;
    }
    else {
      pre = item;
    }
    item = next;
  }

  // set new last pointer 
  // if we deleted the last element, it is
  // corrected, otherwise it points to the last element
  last_ = pre;
}
Beispiel #12
0
void PhraseBookBox::enableDisable()
{
    QListViewItem *item = lv->currentItem();

    sourceLed->blockSignals( TRUE );
    targetLed->blockSignals( TRUE );
    definitionLed->blockSignals( TRUE );

    if ( item == 0 ) {
	sourceLed->setText( QString::null );
	targetLed->setText( QString::null );
	definitionLed->setText( QString::null );
    } else {
	sourceLed->setText( item->text(0) );
	targetLed->setText( item->text(1) );
	definitionLed->setText( item->text(2) );
    }
    sourceLed->setEnabled( item != 0 );
    targetLed->setEnabled( item != 0 );
    definitionLed->setEnabled( item != 0 );
    removeBut->setEnabled( item != 0 );

    sourceLed->blockSignals( FALSE );
    targetLed->blockSignals( FALSE );
    definitionLed->blockSignals( FALSE );

    QLineEdit *led = ( sourceLed->text() == NewPhrase ? sourceLed : targetLed );
    led->setFocus();
    led->selectAll();
}
Beispiel #13
0
void ChaserEditor::slotLowerClicked()
{
  QListViewItem* currentItem = m_functionList->currentItem();

  if (currentItem != NULL)
    {
      QString deviceString = currentItem->text(1);
      QString functionString = currentItem->text(2);

      QListViewItem* below = NULL;
      if (currentItem->itemBelow() != NULL)
	{
	  below = currentItem->itemBelow();
	}

      if (below != NULL)
	{
	  m_functionList->takeItem(currentItem);
	  delete currentItem;
	  QListViewItem* newItem;
	  newItem = new QListViewItem(m_functionList, below, "", deviceString, functionString);
	  m_functionList->setSelected(newItem, true);
	}
    }
  updateOrderNumbers();
}
Beispiel #14
0
void ChaserEditor::slotRaiseClicked()
{
  QListViewItem* currentItem = m_functionList->currentItem();

  if (currentItem != NULL)
    {
      QString deviceString = currentItem->text(1);
      QString functionString = currentItem->text(2);

      QListViewItem* above = NULL;
      if (currentItem->itemAbove() != NULL && currentItem->itemAbove()->itemAbove() != NULL)
	{
	  above = currentItem->itemAbove()->itemAbove();
	}

      m_functionList->takeItem(currentItem);
      delete currentItem;

      QListViewItem* newItem;
      if (above != NULL)
	{
	  newItem = new QListViewItem(m_functionList, above, "", deviceString, functionString);
	}
      else
	{
	  newItem = new QListViewItem(m_functionList, "", deviceString, functionString);
	}

      m_functionList->setSelected(newItem, true);
    }

  updateOrderNumbers();
}
Beispiel #15
0
void KstDataManagerI::edit_I() {
  QListViewItem *qi = 0;

  if (!DataView->selectedItems().isEmpty()) {
    qi = DataView->selectedItems().at(0);
  } else {
    // This error message is odd to say the least.
    //KMessageBox::sorry(this, i18n("A data item must be selected to edit."));
    return;
  }

  switch (qi->rtti()) {
    case RTTI_OBJ_DATA_VECTOR:
      emit editDataVector(qi->text(0));
      break;
    case RTTI_OBJ_STATIC_VECTOR:
      emit editStaticVector(qi->text(0));
      break;
    case RTTI_OBJ_OBJECT:
      static_cast<KstObjectItem*>(qi)->dataObject()->showDialog(true);
      break;
    case RTTI_OBJ_DATA_MATRIX:
      emit editDataMatrix(qi->text(0));  
      break;
    case RTTI_OBJ_STATIC_MATRIX:
      emit editStaticMatrix(qi->text(0));  
      break;
  default:
      break;
  }
}
Beispiel #16
0
void MainInfo::mailSelectionChanged()
{
    QListViewItem *item = lstMails->currentItem();
    bool bEnable = ((item != NULL) && (item->text(MAIL_PROTO).isEmpty() || (item->text(MAIL_PROTO) == "-")));
    btnMailEdit->setEnabled(bEnable);
    btnMailDelete->setEnabled(bEnable);
}
Beispiel #17
0
void LogConfig::apply()
{
    unsigned log_level = 0;
    /* test if file exist */
    QFile file(edtFile->text());
    if (!file.open(IO_Append | IO_ReadWrite)) {
        log(L_DEBUG,"Logfile %s isn't a valid file - discarded!",edtFile->text().latin1());
        edtFile->setText("");
    } else {
        file.close();
    }
    m_plugin->setFile(edtFile->text().latin1());

    /* check selected protocols */
    for (QListViewItem *item = lstLevel->firstChild(); item; item = item->nextSibling()){
        unsigned level = item->text(COL_LEVEL).toUInt();
        if (!item->text(COL_CHECKED).isEmpty()){
            if (level){
                log_level |= level;
            }else{
                m_plugin->setLogType(item->text(COL_PACKET).toUInt(), true);
            }
        }else{
            if (level == 0)
                m_plugin->setLogType(item->text(COL_PACKET).toUInt(), false);
        }
    }
    m_plugin->setLogLevel(log_level);
    m_plugin->openFile();
}
void PageAutoConnect::delete_pressed()
{
    for(QListViewItem *it = KLVAutoConnect->firstChild();
        it != 0;
        it = it->nextSibling()){

        if(it->text(NAME) == ServerLE->text()){
            if(ChannelLE->text().isEmpty() == FALSE){
                for(QListViewItem *ch = it->firstChild();
                    ch != 0;
                    ch = ch->nextSibling()){
                    if(ch->text(NAME) == ChannelLE->text()){
                        delete ch;
                        changed();
                        ChannelLE->clear();
                        ServerLE->clear();
                        return;
                    }
                }
            }
            else {
                delete it;
                changed();
                ServerLE->clear();
                return;
            }
        }
    }
    changed();
}
/**
 * Translate item selections into package[,version] selection signal.
 * @param item  The item that has been selected.
 */
void PakooPackageListView::emitSelectionChanged( QListViewItem* item )
{
	if( portageTree == NULL )
		return;

	QListViewItem* categoryItem;
	QString categoryName, subcategoryName;
	int pos;

	if( item->depth() == 0 ) { // we got a category item
		categoryItem = item;
	}
	else if( item->depth() == 1 ) { // we got a package item
		categoryItem = item->parent();
	}
	else { // nothing of the previous ones, so it's a version item
		categoryItem = item->parent()->parent();
	}

	pos = categoryItem->text(0).find('-');
	categoryName = categoryItem->text(0).left(pos);
	subcategoryName = categoryItem->text(0).mid(pos+1);

	if( item->depth() == 0 )  // we got a category item
	{
		emit selectionChanged( categoryName, subcategoryName );
	}
	else if( item->depth() == 1 ) // we got a package item
	{
		QString packageName = item->text(0);
		Package* package = portageTree->package(
			categoryName, subcategoryName, packageName );

		// retrieve the package's detail info (description and hasUpdates)
		if( packageScanner->running() ) {
			packageScanner->wait();
		}
		this->currentPackage = package;
		packageScanner->startScanningPackage( this, package );

		return;
	}
	else // nothing of the previous ones, so it's a version item
	{
		const QString& packageName = item->parent()->text(0);
		Package* package = portageTree->package(
			categoryName, subcategoryName, packageName );
		const QString& versionString = item->text(0);
		if( package->hasVersion(versionString) )
		{
			PackageVersion* version = package->version( versionString );
			emit selectionChanged( package, version );
		}
		else {
			emit selectionChanged( package );
		}
		return;
	}
}
QString VariablesListViewItem::stringPath() {
  QListViewItem* item = this;
  QString str = item->text(VariablesListView::NameCol);
  while((item = item->parent()) != NULL) {
    str = item->text(VariablesListView::NameCol) + "/" + str;
  }
  return str;
}
Beispiel #21
0
void FITSViewer::imageReduction()
{
  FITSProcessCommand *cbc;
  FITSHistogramCommand *hbc;
  QStringList darkFiles, flatFiles, darkflatFiles;
  int darkCombineMode = 0 , flatCombineMode = 0, darkflatCombineMode =0;
  QListViewItem *file;
  
  image->saveTemplateImage();
  ImageReductionDlg irDialog(this);
     
  if (irDialog.exec() == QDialog::Accepted)
  {
    if (irDialog.darkListView->childCount() == 0 && 
        irDialog.flatListView->childCount() == 0)
	{
	 image->destroyTemplateImage();
	 return;
	}
     
    darkCombineMode    = irDialog.darkAverageB->isChecked() ? 0 : 1;
    flatCombineMode    = irDialog.flatAverageB->isChecked() ? 0 : 1;
    darkflatCombineMode= irDialog.darkflatAverageB->isChecked() ? 0 : 1;
     
    file = irDialog.darkListView->firstChild();
    while (file)
    {
      darkFiles << file->text(0);
      file = file->nextSibling();
    }
    
    file = irDialog.flatListView->firstChild();
    while (file)
    {
      flatFiles << file->text(0);
      file = file->nextSibling();
    }
    
    file = irDialog.darkflatListView->firstChild();
    while (file)
    {
      darkflatFiles << file->text(0);
      file = file->nextSibling();
    }
      
      cbc = new FITSProcessCommand(this);
      FITSProcess reduc(this, darkFiles, flatFiles, darkflatFiles, darkCombineMode, flatCombineMode, darkflatCombineMode);
      reduc.reduce();
      history->addCommand(cbc, false);
      calculateStats();
      hbc = new FITSHistogramCommand(this, NULL, FITSImage::FITSLinear, (int) stats.min, (int) stats.max);
      history->addCommand(hbc);
      fitsChange();
  }
  
  image->destroyTemplateImage();

}
Beispiel #22
0
void MenuConfig::apply(void *_data)
{
    ActionUserData *data = (ActionUserData*)_data;
    clear_list(&data->Menu);
    data->NMenu.value = 0;
    for (QListViewItem *item = lstMenu->firstChild(); item; item = item->nextSibling()) {
        set_str(&data->Menu, ++data->NMenu.value, (item->text(0) + ";" + item->text(1)).utf8());
    }
}
Beispiel #23
0
void ProjectDlg::changeVar()
{
	QListViewItem *item = environment->currentItem();
	project.removeEnvVar(config->currentText(), item->text(0)+"="+item->text(1));
	QString value = QInputDialog::getText("CUTE", "Enter new value:");
	if(value){
		project.addEnvVar(config->currentText(), item->text(0)+"="+value);
		item->setText(1, value);
	}
}
Beispiel #24
0
void MainWindow::addSelectedToBookmarks(void)
{
  QListViewItem *item = stationView->selectedItem();
  assert(item != 0);
  QStringList bookmarks = Settings::instance()->bookmarks();
  if (bookmarks.find(item->text(0)) == bookmarks.end())
  {
    bookmarks.append(item->text(0));
    Settings::instance()->setBookmarks(bookmarks);
  }
} /* MainWindow::addSelectedToBookmarks */
Beispiel #25
0
void PublishDialog::updateInput()
{
    QListViewItem *item;
    item = mWidget->mAddressListView->selectedItem();
    if(!item) return;
    mWidget->mNameLineEdit->setEnabled(true);
    mWidget->mEmailLineEdit->setEnabled(true);
    QString mail = item->text(1);
    mWidget->mNameLineEdit->setText(item->text(0));
    mWidget->mEmailLineEdit->setText(mail);
}
QMap<QString,QString> DirMappingWidget::mappings()
{
  QMap<QString, QString> mappings;

  QListViewItem* item = m_listView->firstChild();
  while(item)
  {
    mappings[item->text(LocalColumn)] = item->text(RemoteColumn);
    item = item->nextSibling();
  }
  return mappings;
}
Beispiel #27
0
void LayoutConfig::updateLayoutCommand()
{
    QString setxkbmap;
    QString layoutDisplayName;
    QListViewItem *sel = widget->listLayoutsDst->selectedItem();

    if(sel != NULL)
    {
        QString kbdLayout = sel->text(LAYOUT_COLUMN_MAP);
        QString variant = widget->comboVariant->currentText();
        if(variant == DEFAULT_VARIANT_NAME)
            variant = "";

        setxkbmap = "setxkbmap"; //-rules " + m_rule
        setxkbmap += " -model " + lookupLocalized(m_rules->models(), widget->comboModel->currentText()) + " -layout ";
        setxkbmap += kbdLayout;
        if(widget->chkLatin->isChecked())
            setxkbmap += ",us";

        /*	LayoutUnit layoutUnitKey = getLayoutUnitKey(sel);
            layoutDisplayName = m_kxkbConfig.getLayoutDisplayName( *m_kxkbConfig.m_layouts.find(layoutUnitKey) );*/
        layoutDisplayName = sel->text(LAYOUT_COLUMN_DISPLAY_NAME);
        if(layoutDisplayName.isEmpty())
        {
            int count = 0;
            QListViewItem *item = widget->listLayoutsDst->firstChild();
            while(item)
            {
                QString layout_ = item->text(LAYOUT_COLUMN_MAP);
                if(layout_ == kbdLayout)
                    ++count;
                item = item->nextSibling();
            }
            bool single = count < 2;
            layoutDisplayName = m_kxkbConfig.getDefaultDisplayName(LayoutUnit(kbdLayout, variant), single);
        }
        kdDebug() << "disp: '" << layoutDisplayName << "'" << endl;

        if(!variant.isEmpty())
        {
            setxkbmap += " -variant ";
            if(widget->chkLatin->isChecked())
                setxkbmap += ",";
            setxkbmap += variant;
        }
    }

    widget->editCmdLine->setText(setxkbmap);

    widget->editDisplayName->setEnabled(sel != NULL);
    widget->editDisplayName->setText(layoutDisplayName);
}
Beispiel #28
0
void MainWindow::acceptIncoming(void)
{
  QListViewItem *item = incoming_con_view->selectedItem();
  assert(item != 0);
  incoming_accept_button->setEnabled(FALSE);
  ComDialog *com_dialog = new ComDialog(audio_io, dir, item->text(0),
      item->text(1));
  com_dialog->show();
  com_dialog->acceptConnection();
  com_dialog->setRemoteParams(incoming_con_param[item->text(0)]);
  incoming_con_view->takeItem(item);
  delete item;
} /* MainWindow::acceptIncoming */
Beispiel #29
0
void JabberBrowser::dragStart()
{
    QListViewItem *item = m_list->currentItem();
    if (item == NULL)
        return;
    Contact *contact;
    JabberUserData *data = m_client->findContact(item->text(COL_JID).utf8(), NULL, false, contact);
    if (data == NULL) {
        m_client->findContact(item->text(COL_JID).utf8(), item->text(COL_NAME).utf8(), true, contact);
        contact->setTemporary(CONTACT_DRAG);
    }
    m_list->startDrag(new ContactDragObject(m_list, contact));
}
Beispiel #30
0
void MenuConfig::edit()
{
    QListViewItem *item = lstMenu->currentItem();
    if (item == NULL)
        return;
    AddItem add(topLevelWidget());
    add.edtItem->setText(item->text(0));
    add.edtPrg->setText(item->text(1));
    if (add.exec()) {
        item->setText(0, add.edtItem->text());
        item->setText(1, add.edtPrg->text());
        lstMenu->adjustColumn();
    }
}