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())); }
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 ); } }
void MainInfo::editPhone() { QListViewItem *item = lstPhones->currentItem(); editPhone(item); }
void *MainInfo::processEvent(Event *e) { if (e->type() == EventContactChanged){ Contact *contact = (Contact*)(e->param()); if (contact == m_contact) fill(); } if (e->type() == EventCheckState){ CommandDef *cmd = (CommandDef*)(e->param()); if (cmd->menu_id == MenuMailList){ if ((cmd->id != CmdEditList) && (cmd->id != CmdRemoveList)) return NULL; QListViewItem *item = (QListViewItem*)(cmd->param); if (item->listView() != lstMails) return NULL; cmd->flags &= ~(COMMAND_CHECKED | COMMAND_DISABLED); bool bEnable = ((item != NULL) && (item->text(MAIL_PROTO).isEmpty() || (item->text(MAIL_PROTO) == "-"))); if (!bEnable) cmd->flags |= COMMAND_DISABLED; return e->param(); } if (cmd->menu_id == MenuPhoneList){ if ((cmd->id != CmdEditList) && (cmd->id != CmdRemoveList)) return NULL; QListViewItem *item = (QListViewItem*)(cmd->param); if (item->listView() != lstPhones) return NULL; cmd->flags &= ~(COMMAND_CHECKED | COMMAND_DISABLED); bool bEnable = ((item != NULL) && (item->text(PHONE_PROTO).isEmpty() || (item->text(PHONE_PROTO) == "-"))); if (!bEnable) cmd->flags |= COMMAND_DISABLED; return e->param(); } } if (e->type() == EventCommandExec){ CommandDef *cmd = (CommandDef*)(e->param()); if (cmd->menu_id == MenuMailList){ QListViewItem *item = (QListViewItem*)(cmd->param); if (item->listView() != lstMails) return NULL; bool bEnable = ((item != NULL) && (item->text(MAIL_PROTO).isEmpty() || (item->text(MAIL_PROTO) == "-"))); if (!bEnable) return NULL; if (cmd->id == CmdEditList){ editMail(item); return e->param(); } if (cmd->id == CmdRemoveList){ deleteMail(item); return e->param(); } } if (cmd->menu_id == MenuPhoneList){ QListViewItem *item = (QListViewItem*)(cmd->param); if (item->listView() != lstPhones) return NULL; bool bEnable = ((item != NULL) && (item->text(PHONE_PROTO).isEmpty() || (item->text(PHONE_PROTO) == "-"))); if (!bEnable) return NULL; if (cmd->id == CmdEditList){ editPhone(item); return e->param(); } if (cmd->id == CmdRemoveList){ deletePhone(item); return e->param(); } } } return NULL; }