Exemple #1
0
MainInfo::MainInfo(QWidget *parent, Contact *contact)
    : MainInfoBase(parent)
{
    m_contact = contact;
    m_bInit   = false;
    cmbDisplay->setEditable(true);
    lstMails->addColumn(i18n("EMail"));
    lstPhones->addColumn(i18n("Type"));
    lstPhones->addColumn(i18n("Phone"));
    lstMails->setMenu(MenuMailList);
    lstPhones->setMenu(MenuPhoneList);
    if (m_contact == NULL) {
        lstMails->addColumn(i18n("Publish"));
        lstPhones->addColumn(i18n("Publish"));
        lblCurrent->setText(i18n("I'm currently available at:"));
        cmbStatus->insertItem(i18n("Don't show"));
        cmbStatus->insertItem(Pict("phone"), i18n("Available"));
        cmbStatus->insertItem(Pict("nophone"), i18n("Busy"));
        cmbStatus->setCurrentItem(getContacts()->owner()->getPhoneStatus());
    } else {
        lblCurrent->setText(i18n("User is crrently available at:"));
        disableWidget(cmbCurrent);
        lblStatus->hide();
        cmbStatus->hide();
    }
    bool bHide = true;
    for (unsigned i = 0; i < getContacts()->nClients(); i++) {
        if (getContacts()->getClient(i)->protocol()->description()->flags & PROTOCOL_FOLLOWME) {
            bHide = false;
            break;
        }
    }
    if (bHide) {
        lblCurrent->hide();
        cmbCurrent->hide();
        lblStatus->hide();
        cmbStatus->hide();
    }
    lstMails->setExpandingColumn(0);
    lstPhones->setExpandingColumn(PHONE_NUMBER);
    if (m_contact == NULL)
        tabMain->removePage(tabNotes);
    fill();
    connect(lstMails, SIGNAL(selectionChanged()), this, SLOT(mailSelectionChanged()));
    connect(lstPhones, SIGNAL(selectionChanged()), this, SLOT(phoneSelectionChanged()));
    connect(lstMails, SIGNAL(deleteItem(QListViewItem*)), this, SLOT(deleteMail(QListViewItem*)));
    connect(lstPhones, SIGNAL(deleteItem(QListViewItem*)), this, SLOT(deletePhone(QListViewItem*)));
    connect(btnMailAdd, SIGNAL(clicked()), this, SLOT(addMail()));
    connect(btnMailEdit, SIGNAL(clicked()), this, SLOT(editMail()));
    connect(btnMailDelete, SIGNAL(clicked()), this, SLOT(deleteMail()));
    connect(btnPhoneAdd, SIGNAL(clicked()), this, SLOT(addPhone()));
    connect(btnPhoneEdit, SIGNAL(clicked()), this, SLOT(editPhone()));
    connect(btnPhoneDelete, SIGNAL(clicked()), this, SLOT(deletePhone()));
}
Exemple #2
0
/**
 * Add data to the contact.
 * All fields must be empty.
 */
void PIMContact::addDataToContact()
{
    printf("\n==============Add data to contact==============\n");
    printf(sFieldSeparator);

    addContactName();
    waitForClick();

    addAddress();
    waitForClick();

    addBirthday();
    waitForClick();

    addEmail();
    waitForClick();

    addNickname();
    waitForClick();

    addNote();
    waitForClick();

    addOrg();
    waitForClick();

    // If you want to set a photo URL call addPhotoURL method instead of
    // addPhoto method.
    addPhoto();
    waitForClick();

    addPhone();
    waitForClick();

    addTitle();
    waitForClick();

    addURL();
    waitForClick();

    addIM();
    waitForClick();

    addRelation();
    waitForClick();

    addOrgInfo();
    waitForClick();
}
Exemple #3
0
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 );
  }
}
Exemple #4
0
PhoneLookup::PhoneLookup( const char *monophoneListFName , const char *silMonoStr ,
                          const char *pauseMonoStr , const char *tiedListFName , 
                          const char *sepChars_ )
{
   if ( monophoneListFName == NULL )
      error("PhoneLookup::PhoneLookup(2) - monophoneListFName is NULL");
   if ( tiedListFName == NULL )
      error("PhoneLookup::PhoneLookup(2) - cdPhoneTiedListFName is NULL") ;

   monoLookup = new MonophoneLookup( monophoneListFName , silMonoStr , pauseMonoStr ) ;
   ownMonoLookup = true ;
   nSepChars = 0 ;
   sepChars = NULL ;
   
   nPhones = 0 ;
   nModelInds = 0 ;
   nModelIndsAlloc = 0 ;
   modelInds = NULL ;
   modelStrs = NULL ;

   firstLevelNodes = new int[monoLookup->getNumMonophones()] ;
   for ( int i=0 ; i<monoLookup->getNumMonophones() ; i++ )
      firstLevelNodes[i] = -1 ;
   nNodes = 0 ;
   nNodesAlloc = 0 ;
   nodes = NULL ;

   monophoneMode = false ;
   extraMonoLookup = NULL ;
   nExtraMLIndsAlloc = 0 ;
   extraMLInds = NULL ;
   
   // Setup the sepChars
   if ( (sepChars_ == NULL) || (sepChars_[0] == '\0') )
   {
      nSepChars = 0 ;
      sepChars = NULL ;
      monophoneMode = true ;
      extraMonoLookup = new MonophoneLookup() ;
   }
   else
   {
      nSepChars = strlen(sepChars_) ;
      if ( (nSepChars % 2) != 0 )
         error("PhoneLookup::PhoneLookup(2) - there must be an even number of sep chars") ;
      sepChars = new char[nSepChars+1] ;
      strcpy( sepChars , sepChars_ ) ;
      monophoneMode = false ;
   }

   // Open the tied list file
   FILE *fd ;
   if ( (fd = fopen( tiedListFName , "rb" )) == NULL )
      error("PhoneLookup::PhoneLookup(2) - error opening tied list file") ;
   
   char line[1000] , *ptr1 , *ptr2 ;
   while ( fgets( line , 1000 , fd ) != NULL )
   {
      // There are 1 or 2 CD phones on each line.
      if ( (ptr1 = strtok( line , " \r\n\t" )) == NULL )
         continue ; // blank line
      ptr2 = strtok( NULL , " \r\n\t" ) ;

      if ( ptr2 == NULL )
      {
         // Only 1 phone on line - add it + it gets its own modelInd
         addPhone( ptr1 ) ;
      }
      else
      {
         // 2 phones on line.
         // 1) add/retrieve the second.
         // 2) add the first using the modelLookupInd of the second.
         int ind = addPhone( ptr2 ) ;
         addPhone( ptr1 , ind ) ;
      }
   }

   fclose( fd ) ;
}
void ContactDialog::setData(const ContactItem& c)
{
    setWindowTitle(tr("Edit contact"));
    // Names
    ui->leFullName->setText(c.fullName);
    for (int i=0; i<c.names.count(); i++)
            addName(c.names[i]);
    // Phones
    for (int i=0; i<c.phones.count(); i++)
        addPhone(c.phones[i]);
    // Emails
    for (int i=0; i<c.emails.count(); i++)
        addEmail(c.emails[i]);
    // Birthday and anniversaries
    ui->cbBirthday->setChecked(c.birthday.value.isValid());
    ui->dteBirthday->setEnabled(c.birthday.value.isValid());
    ui->btnBDayDetails->setEnabled(c.birthday.value.isValid());
    if (c.birthday.value.isValid())
        ui->dteBirthday->setDateTime(c.birthday.value);
    birthdayDetails = c.birthday;
    DateDetailsDialog::setDateFormat(ui->dteBirthday, birthdayDetails.hasTime);
    anniversaryDetails.clear();
    for (int i=0; i<c.anniversaries.count(); i++)
        addAnniversary(c.anniversaries[i]);
    // Photo
    if (c.photoType=="URL")
        ui->lbPhotoContent->setText(c.photoUrl);
    else if (c.photoType.toUpper()=="JPEG" || c.photoType.toUpper()=="PNG") {
        photo = c.photo;
        QPixmap pixPhoto;
        pixPhoto.loadFromData(photo);
        ui->lbPhotoContent->setPixmap(pixPhoto);
    }
    else if (!c.photo.isEmpty())
        ui->lbPhotoContent->setText(S_PH_UNKNOWN_FORMAT);
    updatePhotoMenu();
    // Addresses
    addAddress(ui->gbAddrHome, c.addrHome);
    addAddress(ui->gbAddrWork, c.addrWork);
    //Internet
    ui->leNickName->setText(c.nickName);
    ui->leURL->setText(c.url);
    ui->leJabber->setText(c.jabberName);
    ui->leICQ->setText(c.icqName);
    ui->leSkype->setText(c.skypeName);
    // Work
    ui->leOrganization->setText(c.organization);
    ui->leTitle->setText(c.title);
    // Other
    ui->leSortString->setText(c.sortString);
    ui->edDescription->setPlainText(c.description);
    ui->lbOriginalFormatValue->setText(c.originalFormat);
    ui->lbFormatVersionValue->setText(c.version);
    ui->lbIDValue->setText(c.id);
    ui->twOtherTags->setRowCount(c.otherTags.count());
    int index = 0;
    foreach (const TagValue& tag, c.otherTags) {
        ui->twOtherTags->setItem(index, 0, new QTableWidgetItem(tag.tag));
        ui->twOtherTags->setItem(index, 1, new QTableWidgetItem(tag.value));
        index++;
    }
    // Unknown tags
    ui->twUnknownTags->setRowCount(c.unknownTags.count());
    index = 0;
    foreach (const TagValue& tag, c.unknownTags) {
        ui->twUnknownTags->setItem(index, 0, new QTableWidgetItem(tag.tag));
        ui->twUnknownTags->setItem(index, 1, new QTableWidgetItem(tag.value));
        index++;
    }
}