kaddressbook Library API Documentation

ViewManager Class Reference

The view manager manages the views and everything related to them. More...

#include <viewmanager.h>

Inheritance diagram for ViewManager:

QWidget List of all members.

Public Slots

void readConfig ()
 Reads the config file.

void writeConfig ()
 Writes the config file.

virtual void sendMail ()
 Sends an email to all the selected addressees.

void sendMail (const QString &addressee)
 Open a composer with a message to this person.

void browse (const QString &url)
 Open a browser window displaying the URL given.

void deleteAddressee ()
 This slot will delete all the selected entries.

void paste ()
 Paste a contact into the addressbook from the clipboard.

void copy ()
 Copy a contact from the view into the clipboard.

void cut ()
 Cut a contact from the view into the clipboard.

void setSelected (QString uid=QString::null, bool selected=true)
 Selects the given addressee or all addressees if uid == QString::null.

void refresh (QString uid=QString::null)
 Refreshes the active view.

void modifyView ()
 Launches the ConfigureView dialog for the active view.

void deleteView ()
 Deletes the current view and makes another view active.

void addView ()
 Displays the add view dialog.

void filtersChanged (const Filter::List &list)
 Updates the filter list to list.

void filterActivated (int index)
 Called whenever a filter is activated.

void slotModified ()
 The resource has been modified and needs to be saved.

void showFeatures (int id)
 Show widget of the feature bar.


Signals

void selected (const QString &uid)
 Called whenever the user selects an entry in the view.

void executed (const QString &uid)
 called whenever the user activates an entry in the view.

void modified ()
 Emitted whenever the address book is modified in some way.

void viewConfigChanged (const QString &newActive)
 Emitted whenever the view configuration changes.

void setIncSearchFields (const QStringList &)
 Update the IncSearchWidget (in the toolbars) with a new list of fields.

void setFilterNames (const QStringList &)
 Update the select_filter action.

void setCurrentFilterName (const QString &)
 Set the current filter by its name.

void setCurrentFilter (int index)
 Set the current filter.

void importVCard (const QString &, bool)
 Import a VCard that has been dragged.


Public Member Functions

 ViewManager (KABC::AddressBook *doc, KConfig *config, QWidget *parent=0, const char *name=0)
void setActiveView (const QString &name)
 Sets the given view active.

void unloadViews ()
 Destroys all the currently loaded views.

const QStringListviewNames ()
 Returns a list of all the defined views.

QStringList selectedUids ()
void setJumpButtonBarVisible (bool visible)
 Used to enable or disable the jump button bar.

void setDetailsVisible (bool visible)
 Used to enable or disable the details widget.

bool isQuickEditVisible ()
 Return if the quick edit currently is shown or not.

const Filter::Listfilters () const

Protected Slots

void incSearch (const QString &text, int field)
 Handle events on the incremental search widget.

void jumpToLetter (const QChar &ch)
 Called whenever the user selects a button from the jump bar.

void dropped (QDropEvent *e)
 Called whenever the user drops something in the active view.

void startDrag ()
 Called whenever the user attempts to start a drag in the view.

void addresseeSelected (const QString &uid)
 Called whenever an addressee is selected in the view.

void addresseeModified ()
 Called whenever the currently displayed addressee in the details views is modified.


Detailed Description

The view manager manages the views and everything related to them.

The manager will load the views at startup and display a view when told to make one active.

The view manager will also create and manage all dialogs directly related to views (ie: AddView, ConfigureView, DeleteView, etc).

Definition at line 60 of file viewmanager.h.


Member Function Documentation

void ViewManager::setActiveView const QString name  ) 
 

Sets the given view active.

This usually means raising the view to the top of the widget stack and telling it to refresh.

Definition at line 260 of file viewmanager.cpp.

References addresseeSelected(), QWidgetStack::addWidget(), ViewWrapper::createView(), dropped(), executed(), QDict< ViewWrapper >::find(), QDict< KAddressBookView >::find(), QDict< KAddressBookView >::insert(), QString::latin1(), modified(), Filter::name(), QWidgetStack::raiseWidget(), KAddressBookView::readConfig(), KAddressBookView::refresh(), selected(), setCurrentFilter(), setCurrentFilterName(), and startDrag().

Referenced by ActionManager::selectViewAction().

void ViewManager::unloadViews  ) 
 

Destroys all the currently loaded views.

It is important that after calling this method you call setActiveView before the user has a chance to interact with the gui, since no views will be loaded.

Definition at line 254 of file viewmanager.cpp.

References QDict< KAddressBookView >::clear().

const QStringList& ViewManager::viewNames  )  [inline]
 

Returns a list of all the defined views.

This list is guaranteed to always contain at least one view. This list is the 'defined' views, not necessarily the loaded views. However the view will be loaded if it becomes active.

Definition at line 87 of file viewmanager.h.

Referenced by ActionManager::viewConfigChanged().

void ViewManager::setJumpButtonBarVisible bool  visible  ) 
 

Used to enable or disable the jump button bar.

Parameters:
visible True for the widget to be visible, false otherwise

Definition at line 580 of file viewmanager.cpp.

References JumpButtonBar::show().

Referenced by ActionManager::quickToolsAction().

void ViewManager::setDetailsVisible bool  visible  ) 
 

Used to enable or disable the details widget.

Definition at line 588 of file viewmanager.cpp.

Referenced by ActionManager::quickToolsAction().

bool ViewManager::isQuickEditVisible  ) 
 

Return if the quick edit currently is shown or not.

Definition at line 598 of file viewmanager.cpp.

Referenced by KAddressBook::addresseeExecuted(), and KAddressBook::editAddressee().

const Filter::List& ViewManager::filters  )  const [inline]
 

Returns:
The list of filters defined for the application.

Definition at line 110 of file viewmanager.h.

Referenced by KAddressBook::configureFilters().

void ViewManager::readConfig  )  [slot]
 

Reads the config file.

Definition at line 95 of file viewmanager.cpp.

References QValueList::append(), QValueList::count(), QDictIterator::current(), QDictIterator::currentKey(), filtersChanged(), QWidget::height(), Filter::restore(), setCurrentFilterName(), QSplitter::setSizes(), QDictIterator::toFirst(), and QWidget::width().

Referenced by KAddressBook::readConfig().

void ViewManager::writeConfig  )  [slot]
 

Writes the config file.

Definition at line 140 of file viewmanager.cpp.

References QDictIterator::current(), QDictIterator::currentKey(), Filter::name(), Filter::save(), QSplitter::sizes(), and QDictIterator::toFirst().

Referenced by KAddressBook::writeConfig().

void ViewManager::sendMail  )  [virtual, slot]
 

Sends an email to all the selected addressees.

This is done by asking the view for a string of "To:'s" and then asking KDE to open the mailer with the information.

Definition at line 167 of file viewmanager.cpp.

References KAddressBookView::selectedEmails().

void ViewManager::sendMail const QString addressee  )  [slot]
 

Open a composer with a message to this person.

Definition at line 173 of file viewmanager.cpp.

void ViewManager::browse const QString url  )  [slot]
 

Open a browser window displaying the URL given.

Definition at line 178 of file viewmanager.cpp.

void ViewManager::deleteAddressee  )  [slot]
 

This slot will delete all the selected entries.

This method should be called just 'delete' to be consistant with the other edit methods, but good 'ol C++ wouldn't like that -mpilone

Definition at line 183 of file viewmanager.cpp.

References addresseeSelected(), modified(), KAddressBookView::refresh(), selected(), and KAddressBookView::selectedUids().

void ViewManager::paste  )  [slot]
 

Paste a contact into the addressbook from the clipboard.

Definition at line 205 of file viewmanager.cpp.

References QApplication::clipboard(), modified(), KAddressBookView::refresh(), and QClipboard::text().

void ViewManager::copy  )  [slot]
 

Copy a contact from the view into the clipboard.

This method will copy all selected contacts into the clipboard at once.

Definition at line 216 of file viewmanager.cpp.

References AddresseeUtil::addresseesToClipboard(), QApplication::clipboard(), KAddressBookView::selectedUids(), and QClipboard::setText().

void ViewManager::cut  )  [slot]
 

Cut a contact from the view into the clipboard.

This method will cut all selected contacts into the clpboard at once.

Definition at line 234 of file viewmanager.cpp.

References modified(), KAddressBookView::refresh(), and KAddressBookView::selectedUids().

void ViewManager::setSelected QString  uid = QString::null,
bool  selected = true
[slot]
 

Selects the given addressee or all addressees if uid == QString::null.

Definition at line 249 of file viewmanager.cpp.

References KAddressBookView::setSelected().

void ViewManager::refresh QString  uid = QString::null  )  [slot]
 

Refreshes the active view.

Parameters:
uid Only refresh the selected uid. If it is QStrign::null, the entire view will be refreshed.

Definition at line 347 of file viewmanager.cpp.

References addresseeSelected(), and KAddressBookView::refresh().

Referenced by KAddressBook::addEmail(), KAddressBook::addresseeModified(), KAddressBook::importCSV(), KAddressBook::importKDE2(), KAddressBook::importVCard(), KAddressBook::redo(), and KAddressBook::undo().

void ViewManager::modifyView  )  [slot]
 

Launches the ConfigureView dialog for the active view.

Definition at line 356 of file viewmanager.cpp.

References ViewWrapper::createConfigureViewDialog(), KAddressBookView::defaultFilterName(), KAddressBookView::defaultFilterType(), QDict< ViewWrapper >::find(), Filter::name(), KAddressBookView::readConfig(), ConfigureViewDialog::readConfig(), KAddressBookView::refresh(), Filter::save(), setCurrentFilter(), setCurrentFilterName(), KAddressBookView::type(), and ConfigureViewDialog::writeConfig().

Referenced by addView().

void ViewManager::deleteView  )  [slot]
 

Deletes the current view and makes another view active.

Definition at line 417 of file viewmanager.cpp.

References QDict< KAddressBookView >::remove(), and viewConfigChanged().

void ViewManager::addView  )  [slot]
 

Displays the add view dialog.

If the user confirms, the view will be added.

Definition at line 441 of file viewmanager.cpp.

References QString::latin1(), QString::left(), QString::length(), modifyView(), QString::sprintf(), viewConfigChanged(), AddViewDialog::viewName(), and AddViewDialog::viewType().

void ViewManager::filtersChanged const Filter::List list  )  [slot]
 

Updates the filter list to list.

Definition at line 697 of file viewmanager.cpp.

References QValueList::begin(), QValueList::end(), and setFilterNames().

Referenced by KAddressBook::configureFilters(), and readConfig().

void ViewManager::filterActivated int  index  )  [slot]
 

Called whenever a filter is activated.

Definition at line 711 of file viewmanager.cpp.

References KAddressBookView::refresh(), and KAddressBookView::setFilter().

void ViewManager::slotModified  )  [slot]
 

The resource has been modified and needs to be saved.

Definition at line 727 of file viewmanager.cpp.

References modified().

void ViewManager::showFeatures int  id  )  [slot]
 

Show widget of the feature bar.

Parameters:
id 0: hide feature bar 1: show quick edit 2: show distribution list editor

Definition at line 732 of file viewmanager.cpp.

Referenced by ActionManager::quickToolsAction().

void ViewManager::incSearch const QString text,
int  field
[protected, slot]
 

Handle events on the incremental search widget.

Definition at line 566 of file viewmanager.cpp.

References KAddressBookView::incrementalSearch().

void ViewManager::jumpToLetter const QChar ch  )  [protected, slot]
 

Called whenever the user selects a button from the jump bar.

Definition at line 573 of file viewmanager.cpp.

References KAddressBookView::incrementalSearch().

void ViewManager::dropped QDropEvent e  )  [protected, slot]
 

Called whenever the user drops something in the active view.

This method will try to decode what was dropped, and if it was a valid addressee, add it to the addressbook.

Definition at line 603 of file viewmanager.cpp.

References QPtrListIterator::current(), QUriDrag::decode(), importVCard(), modified(), KAddressBookView::refresh(), and QStringList::split().

Referenced by setActiveView().

void ViewManager::startDrag  )  [protected, slot]
 

Called whenever the user attempts to start a drag in the view.

This method will convert all the selected addressees into text (vcard) and create a drag object.

Definition at line 645 of file viewmanager.cpp.

References QStringList::join().

Referenced by setActiveView().

void ViewManager::addresseeSelected const QString uid  )  [protected, slot]
 

Called whenever an addressee is selected in the view.

This method should update the quick edit. The selected() signal will already be emitted, so it does not have to be re-emitted from this method

Definition at line 672 of file viewmanager.cpp.

Referenced by deleteAddressee(), refresh(), and setActiveView().

void ViewManager::addresseeModified  )  [protected, slot]
 

Called whenever the currently displayed addressee in the details views is modified.

This method will emit the modified signal and then tell the view to refresh.

Definition at line 679 of file viewmanager.cpp.

References modified(), and KAddressBookView::refresh().

void ViewManager::selected const QString uid  )  [signal]
 

Called whenever the user selects an entry in the view.

Referenced by deleteAddressee(), and setActiveView().

void ViewManager::executed const QString uid  )  [signal]
 

called whenever the user activates an entry in the view.

Referenced by setActiveView().

void ViewManager::modified  )  [signal]
 

Emitted whenever the address book is modified in some way.

Referenced by addresseeModified(), cut(), deleteAddressee(), dropped(), paste(), setActiveView(), and slotModified().

void ViewManager::viewConfigChanged const QString newActive  )  [signal]
 

Emitted whenever the view configuration changes.

This can happen if a user adds a new view or removes a view.

Parameters:
newActive This is the view that should be made active. If this is QString::null, than the current active can remain that way.

Referenced by addView(), and deleteView().

void ViewManager::setIncSearchFields const QStringList  )  [signal]
 

Update the IncSearchWidget (in the toolbars) with a new list of fields.

void ViewManager::setFilterNames const QStringList  )  [signal]
 

Update the select_filter action.

Referenced by filtersChanged().

void ViewManager::setCurrentFilterName const QString  )  [signal]
 

Set the current filter by its name.

Ignored if the name does not exist.

Referenced by modifyView(), readConfig(), and setActiveView().

void ViewManager::setCurrentFilter int  index  )  [signal]
 

Set the current filter.

0 for none.

Referenced by modifyView(), and setActiveView().

void ViewManager::importVCard const QString ,
bool 
[signal]
 

Import a VCard that has been dragged.

Referenced by dropped().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:38 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001