~ubuntu-branches/ubuntu/vivid/ekiga/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/engine/addressbook/skel/contact-core.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kilian Krause
  • Date: 2011-07-17 00:24:50 UTC
  • mfrom: (5.1.5 upstream) (7.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110717002450-ytg3wsrc1ptd3153
Tags: 3.3.1-1
* New upstream release.
 - Required libpt-dev 2.10 and libopal-dev 3.10
* Fix debian/watch to catch new version
* Remove libnotify0.7.patch - included upstream
* Add libboost-dev and libboost-signals-dev to Build-Depends
* debian/rules: Don't install *.la files for new internal shared libs
* Fix Vcs URIs to point to correct desktop/experimental/ekiga tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/*
3
 
 * Ekiga -- A VoIP and Video-Conferencing application
4
 
 * Copyright (C) 2000-2007 Damien Sandras
5
 
 
6
 
 * This program is free software; you can  redistribute it and/or modify
7
 
 * it under the terms of the GNU General Public License as published by
8
 
 * the Free Software Foundation; either version 2 of the License, or (at
9
 
 * your option) any later version. This program is distributed in the hope
10
 
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
11
 
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
 
 * See the GNU General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU General Public License along
15
 
 * with this program; if not, write to the Free Software Foundation, Inc.,
16
 
 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17
 
 *
18
 
 * Ekiga is licensed under the GPL license and as a special exception, you
19
 
 * have permission to link or otherwise combine this program with the
20
 
 * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
21
 
 * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
22
 
 * programs, as long as you do follow the requirements of the GNU GPL for all
23
 
 * the rest of the software thus combined.
24
 
 */
25
 
 
26
 
 
27
 
/*
28
 
 *                         contact-core.cpp  -  description
29
 
 *                         ------------------------------------------
30
 
 *   begin                : written in 2007 by Julien Puydt
31
 
 *   copyright            : (c) 2007 by Julien Puydt
32
 
 *   description          : implementation of the main contact managing object
33
 
 *
34
 
 */
35
 
 
36
 
#include <iostream>
37
 
 
38
 
#include "config.h"
39
 
 
40
 
#include "contact-core.h"
41
 
 
42
 
static void
43
 
on_search ()
44
 
{
45
 
  std::cout << "Search not implemented yet" << std::endl;
46
 
}
47
 
 
48
 
Ekiga::ContactCore::~ContactCore ()
49
 
{
50
 
}
51
 
 
52
 
bool
53
 
Ekiga::ContactCore::populate_menu (MenuBuilder &builder)
54
 
{
55
 
  bool populated = false;
56
 
 
57
 
  builder.add_action ("search", _("_Find"), sigc::ptr_fun (on_search));
58
 
  populated = true;
59
 
 
60
 
  for (std::set<Source *>::const_iterator iter = sources.begin ();
61
 
       iter != sources.end ();
62
 
       iter++) {
63
 
 
64
 
    if (populated)
65
 
      builder.add_separator ();
66
 
    populated = (*iter)->populate_menu (builder);
67
 
  }
68
 
 
69
 
  return populated;
70
 
}
71
 
 
72
 
void
73
 
Ekiga::ContactCore::add_source (Source &source)
74
 
{
75
 
  sources.insert (&source);
76
 
  source_added.emit (source);
77
 
  source.book_added.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_book_added), &source));
78
 
  source.book_removed.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_book_removed), &source));
79
 
  source.book_updated.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_book_updated), &source));
80
 
  source.contact_added.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_contact_added), &source));
81
 
  source.contact_removed.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_contact_removed), &source));
82
 
  source.contact_updated.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_contact_updated), &source));
83
 
  source.questions.add_handler (questions.make_slot ());
84
 
}
85
 
 
86
 
void
87
 
Ekiga::ContactCore::visit_sources (sigc::slot<bool, Source &> visitor)
88
 
{
89
 
  bool go_on = true;
90
 
 
91
 
  for (std::set<Source *>::iterator iter = sources.begin ();
92
 
       iter != sources.end () && go_on;
93
 
       iter++)
94
 
    go_on = visitor (*(*iter));
95
 
}
96
 
 
97
 
 
98
 
void
99
 
Ekiga::ContactCore::on_book_added (Book &book,
100
 
                                   Source *source)
101
 
{
102
 
  book_added.emit (*source, book);
103
 
}
104
 
 
105
 
 
106
 
void
107
 
Ekiga::ContactCore::on_book_removed (Book &book,
108
 
                                     Source *source)
109
 
{
110
 
  book_removed.emit (*source, book);
111
 
}
112
 
 
113
 
 
114
 
void
115
 
Ekiga::ContactCore::on_book_updated (Book &book,
116
 
                                     Source *source)
117
 
{
118
 
  book_updated.emit (*source, book);
119
 
}
120
 
 
121
 
 
122
 
void
123
 
Ekiga::ContactCore::on_contact_added (Book &book,
124
 
                                      Contact &contact,
125
 
                                      Source *source)
126
 
{
127
 
  contact_added.emit (*source, book, contact);
128
 
}
129
 
 
130
 
 
131
 
void
132
 
Ekiga::ContactCore::on_contact_removed (Book &book,
133
 
                                        Contact &contact,
134
 
                                        Source *source)
135
 
{
136
 
  contact_removed.emit (*source, book, contact);
137
 
}
138
 
 
139
 
 
140
 
void
141
 
Ekiga::ContactCore::on_contact_updated (Book &book,
142
 
                                        Contact &contact,
143
 
                                        Source *source)
144
 
{
145
 
  contact_updated.emit (*source, book, contact);
146
 
}
147
 
 
148
 
 
149
 
void
150
 
Ekiga::ContactCore::add_contact_decorator (ContactDecorator &decorator)
151
 
{
152
 
  contact_decorators.push_back (&decorator);
153
 
}
154
 
 
155
 
 
156
 
bool
157
 
Ekiga::ContactCore::populate_contact_menu (Contact &contact,
158
 
                                           const std::string uri,
159
 
                                           MenuBuilder &builder)
160
 
{
161
 
  bool populated = false;
162
 
 
163
 
  for (std::list<ContactDecorator *>::const_iterator iter
164
 
         = contact_decorators.begin ();
165
 
       iter != contact_decorators.end ();
166
 
       iter++) {
167
 
 
168
 
    populated = (*iter)->populate_menu (contact, uri, builder) || populated;
169
 
  }
170
 
 
171
 
  return populated;
172
 
}