Source Code (Use browser search to find items of interest.)

Class Index

kab'KABEditLook (./kdeutils/kab/look_edit.h:40)

class KABEditLook : public KABBasicLook
{
  Q_OBJECT
public:
  /** The constructor. */
  KABEditLook(KabAPI*, QWidget* parent=0, const char* name=0);
  /** Overload basic set entry method. */
  void setEntry(const AddressBook::Entry&);
  /** Overload method to get the entry. */
  void getEntry(AddressBook::Entry& entry); 
protected:
  /** The tabulator widget. */
  QTabWidget *tabs;
  // WORK_TO_DO: check if pointers are really needed
  /** The person tab. */
  TabPerson *tabperson;
  /** The birthday tab. */
  TabBirthday *tabbirthday;
  /** The comment tab. */
  TabComment *tabcomment;
  /** The user fields tab. */
  TabUser *tabuser;
  /** The tab to enter contact information. */
  TabContact *tabcontact;
  /** The tab to edit the addresses. */
  TabAddresses *tabaddresses;
  /** A list of all tabs. */
  QList<TabBasic*> allTabs;
  /** The resize event. */
  void resizeEvent(QResizeEvent*);
public slots:
  /** Emitted by the different tabs to notify changes. */
  void changed();
};

kab'KABEditLook::KABEditLook() (./kdeutils/kab/look_edit.cc:40)

KABEditLook::KABEditLook(KabAPI* api, QWidget* parent, const char* name)
  : KABBasicLook(api, parent, name)
{
  Section *configsection;
  KeyValueMap *keys;
  QString headline=i18n("User Fields");
  // -----
  tabs=new QTabWidget(this);
  if(tabs==0)
    {
      KMessageBox::sorry
	(this, i18n("Out of memory."),
	 i18n("General failure."));
      ::exit(-1);
    }
  tabbirthday=new TabBirthday(tabs);
  tabperson=new TabPerson(tabs);
  tabcomment=new TabComment(tabs);
  tabuser=new TabUser(tabs);
  tabcontact=new TabContact(tabs);
  tabaddresses=new TabAddresses(tabs);
  if(tabbirthday==0 || tabperson==0 || tabcomment==0 || tabuser==0
     || tabcontact==0 || tabaddresses==0)
    {
      KMessageBox::sorry
	(this, i18n("Out of memory."),
	 i18n("General failure."));
      ::exit(-1);
    }
  // ----- find out the caption of the user fields tab:
  if(db!=0) // be careful to avoid segfaults in the ctor
    {
      configsection=db->addressbook()->configurationSection();
      if(configsection!=0)
	{
	  keys=configsection->getKeys();
	  keys->get("user_headline", headline);
	}
      tabuser->configure(db);
    }
  tabs->addTab(tabperson, i18n("&Person"));
  tabs->addTab(tabaddresses, i18n("&Addresses"));
  tabs->addTab(tabcontact, i18n("&Contact"));
  tabs->addTab(tabbirthday, i18n("&Birthday"));
  tabs->addTab(tabcomment, i18n("Comment"));
  tabs->addTab(tabuser, headline);
  allTabs.append((TabBasic**)&tabperson);
  allTabs.append((TabBasic**)&tabaddresses);
  allTabs.append((TabBasic**)&tabcontact);
  allTabs.append((TabBasic**)&tabbirthday);
  allTabs.append((TabBasic**)&tabcomment);
  allTabs.append((TabBasic**)&tabuser);
  // -----
  connect(tabbirthday, SIGNAL(changed()), SLOT(changed()));
  connect(tabaddresses, SIGNAL(changed()), SLOT(changed()));
  connect(tabcontact, SIGNAL(changed()), SLOT(changed()));
  connect(tabperson, SIGNAL(changed()), SLOT(changed()));
  connect(tabcomment, SIGNAL(changed()), SLOT(changed()));
  connect(tabuser, SIGNAL(changed()), SLOT(changed()));
}


kab'KABEditLook::resizeEvent() (./kdeutils/kab/look_edit.cc:101)

void KABEditLook::resizeEvent(QResizeEvent*)
{
  tabs->setGeometry(0, 0, width(), height());
}


kab'KABEditLook::changed() (./kdeutils/kab/look_edit.cc:106)

void KABEditLook::changed()
{
  register bool GUARD; GUARD=false;
  kDebugInfo(GUARD, 0, "KABEditLook::changed: entry changed.");
  emit(entryChanged()); // signal from basic look
}


kab'KABEditLook::setEntry() (./kdeutils/kab/look_edit.cc:113)

void KABEditLook::setEntry(const AddressBook::Entry& entry)
{
  unsigned int count;
  // ----- set the contents in all tabs:
  for(count=0; count<allTabs.count(); ++count)
    {
      (*allTabs.at(count))->setContents(entry);
    }
  // ----- call the setEntry method of the base class:
  KABBasicLook::setEntry(entry);
}


kab'KABEditLook::getEntry() (./kdeutils/kab/look_edit.cc:125)

void KABEditLook::getEntry(AddressBook::Entry& entry)
{
  unsigned int count;
  // ----- set the contents in all tabs:
  for(count=0; count<allTabs.count(); ++count)
    { // store the changes in our own entry object:
      (*allTabs.at(count))->storeContents(current);
    }
  // ----- call the setEntry method of the base class:
  KABBasicLook::getEntry(entry);
}