Logo Search packages:      
Sourcecode: kbib version File versions  Download package

void KBibEditEntryDlg::slotCreateKey (  )  [slot]

No descriptions No descriptions

No descriptions

Definition at line 818 of file kbibeditentrydlg.cpp.

References BibEntry::createKey(), getBibEntry(), BibEntry::getField(), BibEntry::getIndex(), BibEntry::getKey(), and BibEntry::setKey().

{
      KBibApp* win = ( KBibApp* ) this->parent();
      getBibEntry();
      if ( ( QString ( m_entry->getField ( "author" ) ).isEmpty() )  && ( QString ( m_entry->getField ( "editor" ) ).isEmpty() ) )
      {
            KMessageBox::error ( this, i18n ( "Author is empty.\nPlease correct it first. " ) );
            return;
      }
      m_entry->createKey ( ( ( win->kbibConfigState ).keyConnecting ).ascii() );

      //KBibListView *listView = (KBibListView *) parent();
      //QSplitter* vbox = (QSplitter*) listView->parent();


      QString fkey;
      char dletter='a';
      int oopscount=0;
      int idx;
      int this_id;

      fkey= m_entry->getKey();
      keyField->setText ( fkey );

      idx = win->searchKey ( fkey );

      this_id = m_entry->getIndex();

      if ( idx < 0 )
            return;

      if ( idx == this_id && idx >=0 )
      {
            idx = win->searchKey ( fkey, this_id+1 );
            if ( idx < 0 )
                  return;

      }

      while ( 1 )
      {
            fkey= m_entry->getKey();
            for ( int j=0;j<oopscount;j++ )
                  fkey+='x';
            fkey+=dletter;
            idx = win->searchKey ( fkey,0 );
            if ( idx < 0 )
            {
                  m_entry->setKey ( fkey );
                  keyField->setText ( fkey );
                  break;
            }
            if ( idx == this_id && idx >= 0 )
            {
                  idx = win->searchKey ( fkey, this_id+1 );
                  if ( idx < 0 )
                  {
                        m_entry->setKey ( fkey );
                        keyField->setText ( fkey );
                        break;
                  }
            }


            dletter++;
            if ( dletter=='z' )
            {
                  oopscount++;
                  dletter='a';
            }

      }
}


Generated by  Doxygen 1.6.0   Back to index