• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

console/kabcclient

  • sources
  • kde-4.12
  • kdepim
  • console
  • kabcclient
  • src
outputformatimpls.cpp
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005 - 2011 Kevin Krammer <kevin.krammer@gmx.at>
3 // Copyright (C) 2011 Fernando Schapachnik <fernando@schapachnik.com.ar>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 //
19 
20 // local includes
21 #include "outputformatimpls.h"
22 #include "csvtemplate.h"
23 #include "csvtemplatefactory.h"
24 
25 // standard includes
26 #include <iostream>
27 
28 // Qt includes
29 #include <QtCore/QTextCodec>
30 
31 // KDE includes
32 #include <kdebug.h>
33 #include <klocale.h>
34 
35 // KABC includes
36 #include <kabc/addressee.h>
37 #include <kabc/addresseelist.h>
38 #include <kabc/vcardconverter.h>
39 
40 using namespace KABC;
41 
43 
44 QByteArray fromUnicode(QTextCodec* codec, const QString& text)
45 {
46  if (codec == 0) return QByteArray();
47 
48  return codec->fromUnicode(text);
49 }
50 
52 
53 QString UIDOutput::description() const
54 {
55  return i18n("Writes the unique KABC contact identifier");
56 }
57 
59 
60 bool UIDOutput::setOptions(const QByteArray& options)
61 {
62  Q_UNUSED(options)
63  return false;
64 }
65 
67 
68 bool UIDOutput::setCodec(QTextCodec* codec)
69 {
70  if (codec == 0) return false;
71 
72  m_codec = codec;
73 
74  return true;
75 }
76 
78 
79 bool UIDOutput::writeAddressee(const KABC::Addressee& addressee, std::ostream& stream)
80 {
81  if (stream.bad()) return false;
82 
83  stream << fromUnicode(m_codec, addressee.uid()).constData();
84 
85  return !stream.bad();
86 }
87 
89 
90 bool UIDOutput::writeAddresseeList(const KABC::AddresseeList& addresseeList,
91  std::ostream& stream)
92 {
93  if (stream.bad()) return false;
94 
95  AddresseeList::const_iterator it = addresseeList.constBegin();
96  AddresseeList::const_iterator endIt = addresseeList.constEnd();
97  for (; it != endIt; ++it)
98  {
99  if (!writeAddressee(*it, stream)) return false;
100 
101  stream << std::endl;
102  }
103 
104  return !stream.bad();
105 }
106 
109 
110 VCardOutput::VCardOutput() : m_converter(0), m_vCardVersion(VCardConverter::v3_0)
111 {
112  m_converter = new VCardConverter();
113 }
114 
116 
117 VCardOutput::~VCardOutput()
118 {
119  delete m_converter;
120 }
121 
123 
124 QString VCardOutput::description() const
125 {
126  return i18n("Exports to vCard format");
127 }
128 
130 
131 bool VCardOutput::setOptions(const QByteArray& options)
132 {
133  if (options == "v2.1")
134  m_vCardVersion = VCardConverter::v2_1;
135  else
136  return false;
137 
138  return true;
139 }
140 
142 
143 QString VCardOutput::optionUsage() const
144 {
145  QString usage =
146  i18n("Optionally use a different vCard version (default is %1)",
147  QString::fromLatin1("3.0"));
148 
149  usage += QLatin1Char('\n');
150 
151  usage += QLatin1String("v2.1\t");
152  usage += i18n("Uses the vCard version 2.1");
153 
154  return usage;
155 }
156 
158 
159 bool VCardOutput::setCodec(QTextCodec* codec)
160 {
161  if (codec == 0) return false;
162 
163  m_codec = codec;
164 
165  QString codecName = QString::fromLatin1(m_codec->name());
166 
167  if (codecName != QString::fromUtf8("UTF-8"))
168  {
169  QString warning = i18n("Warning: using codec '%1' with output format vcard, "
170  "but vCards are usually expected to be in UTF-8.",
171  codecName);
172 
173  std::cerr << warning.toLocal8Bit().data() << std::endl;
174  }
175 
176  return true;
177 }
178 
180 
181 bool VCardOutput::writeAddressee(const KABC::Addressee& addressee, std::ostream& stream)
182 {
183  if (stream.bad()) return false;
184 
185  VCardConverter::Version version = VCardConverter::v3_0;
186  switch (m_vCardVersion)
187  {
188  case VCardConverter::v2_1:
189  version = VCardConverter::v2_1;
190  break;
191 
192  case VCardConverter::v3_0:
193  // for completeness, in case the enum gets extended and different
194  // default value is used
195  version = VCardConverter::v3_0;
196  break;
197 
198  default:
199  kDebug() <<"Unknown vCard version" << m_vCardVersion;
200  break;
201  }
202 
203  QByteArray vcard = m_converter->createVCard(addressee, version);
204 
205  // vcard is in UTF-8, only need conversion if output codec is different
206  if (m_codec == QTextCodec::codecForName("UTF-8")) {
207  vcard = fromUnicode(m_codec, QString::fromUtf8(vcard));
208  }
209 
210  stream << vcard.constData();
211 
212  return !stream.bad();
213 }
214 
216 
217 bool VCardOutput::writeAddresseeList(const KABC::AddresseeList& addresseeList,
218  std::ostream& stream)
219 {
220  if (stream.bad()) return false;
221 
222  VCardConverter::Version version = VCardConverter::v3_0;
223  switch (m_vCardVersion)
224  {
225  case VCardConverter::v2_1:
226  version = VCardConverter::v2_1;
227  break;
228 
229  case VCardConverter::v3_0:
230  // for completeness, in case the enum gets extended and different
231  // default value is used
232  version = VCardConverter::v3_0;
233  break;
234 
235  default:
236  kDebug() <<"Unknown vCard version" << m_vCardVersion;
237  break;
238  }
239 
240  QByteArray vcards = m_converter->createVCards(addresseeList, version);
241 
242  // vcards is in UTF-8, only need conversion if output codec is different
243  if (m_codec == QTextCodec::codecForName("UTF-8")) {
244  vcards = fromUnicode(m_codec, QString::fromUtf8(vcards));
245  }
246 
247  stream << vcards.constData();
248 
249  return !stream.bad();
250 }
251 
254 
255 EmailOutput::EmailOutput() : m_allEmails(false), m_includeName(false)
256 {
257 }
258 
260 
261 QString EmailOutput::description() const
262 {
263  return i18n("Writes email address or formatted name &lt;email address&gt;");
264 }
265 
267 
268 bool EmailOutput::setOptions(const QByteArray& options)
269 {
270  QStringList optionList = QString::fromLocal8Bit(options).split(QLatin1Char(','), QString::SkipEmptyParts);
271 
272  QStringList::const_iterator it = optionList.constBegin();
273  QStringList::const_iterator endIt = optionList.constEnd();
274  for (; it != endIt; ++it)
275  {
276  if ((*it) == QString::fromUtf8("allemails"))
277  m_allEmails = true;
278  else if ((*it) == QString::fromUtf8("withname"))
279  m_includeName = true;
280  else
281  return false;
282  }
283 
284  return true;
285 }
286 
288 
289 QString EmailOutput::optionUsage() const
290 {
291  QString usage = i18n("Comma separated list of: allemails, withname");
292 
293  usage += QLatin1Char('\n');
294 
295  usage += QLatin1String("allemails\t");
296  usage += i18n("List all email addresses of each contact");
297 
298  usage += QLatin1Char('\n');
299 
300  usage += QLatin1String("withname\t");
301  usage += i18n("Prepend formatted name, e.g\n\t\tJohn Doe &lt;jdoe@foo.com&gt;");
302 
303  return usage;
304 }
305 
307 
308 bool EmailOutput::setCodec(QTextCodec* codec)
309 {
310  if (codec == 0) return false;
311 
312  m_codec = codec;
313 
314  return true;
315 }
316 
318 
319 bool EmailOutput::writeAddressee(const KABC::Addressee& addressee, std::ostream& stream)
320 {
321  if (stream.bad()) return false;
322 
323  if (m_allEmails)
324  {
325  QStringList emails = addressee.emails();
326 
327  QStringList::const_iterator it = emails.constBegin();
328  QStringList::const_iterator endIt = emails.constEnd();
329 
330  if (it != endIt)
331  {
332  if (!(*it).isEmpty())
333  {
334  stream << fromUnicode(m_codec, decorateEmail(addressee, *it)).constData();
335  if (stream.bad()) return false;
336  }
337 
338  for(++it; it != endIt; ++it)
339  {
340  if ((*it).isEmpty()) continue;
341 
342  stream << std::endl
343  << fromUnicode(m_codec, decorateEmail(addressee, *it)).constData();
344 
345  if (stream.bad()) return false;
346  }
347  }
348  }
349  else
350  {
351  if (!addressee.preferredEmail().isEmpty())
352  {
353  stream << fromUnicode(m_codec, decorateEmail(addressee, addressee.preferredEmail())).constData();
354  }
355  }
356 
357  return !stream.bad();
358 }
359 
361 
362 bool EmailOutput::writeAddresseeList(const KABC::AddresseeList& addresseeList,
363  std::ostream& stream)
364 {
365  if (stream.bad()) return false;
366 
367  AddresseeList::const_iterator it = addresseeList.constBegin();
368  AddresseeList::const_iterator endIt = addresseeList.constEnd();
369  for (; it != endIt; ++it)
370  {
371  if ((*it).emails().count() == 0) continue;
372 
373  if (!writeAddressee(*it, stream)) return false;
374 
375  stream << std::endl;
376  }
377 
378  return !stream.bad();
379 }
380 
382 
383 QString EmailOutput::decorateEmail(const KABC::Addressee& addressee, const QString& email) const
384 {
385  if (m_includeName)
386  return addressee.fullEmail(email);
387  else
388  return email;
389 }
390 
393 
394 MuttOutput::MuttOutput()
395  : m_allEmails(false), m_queryFormat(false), m_altKeyFormat(false),
396  m_preferNickNameKey(false), m_alsoNickNameKey(false)
397 {
398 }
399 
401 
402 QString MuttOutput::description() const
403 {
404  return i18n("Formats output as needed by the mail client mutt");
405 }
406 
408 
409 bool MuttOutput::setOptions(const QByteArray& options)
410 {
411  QStringList optionList = QString::fromLocal8Bit(options).split(QLatin1Char(','), QString::SkipEmptyParts);
412 
413  QStringList::const_iterator it = optionList.constBegin();
414  QStringList::const_iterator endIt = optionList.constEnd();
415  for (; it != endIt; ++it)
416  {
417  if ((*it) == QLatin1String("allemails"))
418  m_allEmails = true;
419  else if ((*it) == QLatin1String("query"))
420  m_queryFormat = true;
421  else if ((*it) == QLatin1String("alias"))
422  m_queryFormat = false;
423  else if ((*it) == QLatin1String("altkeys"))
424  m_altKeyFormat = true;
425  else if ((*it) == QLatin1String("prefernick"))
426  m_preferNickNameKey = true;
427  else if ((*it) == QLatin1String("alsonick"))
428  m_alsoNickNameKey = true;
429  else
430  return false;
431  }
432 
433  if (m_alsoNickNameKey && m_preferNickNameKey)
434  {
435  kDebug() << "Both 'prefernick' and 'alsonick' specified, using only 'alsonick'";
436  m_preferNickNameKey = false;
437  }
438 
439  return true;
440 }
441 
443 
444 QString MuttOutput::optionUsage() const
445 {
446  QString usage =
447  i18n("Comma separated list of: allemails, query, alias, altkeys, prefernick, alsonick. "
448  "Default is alias");
449 
450  usage += QLatin1Char('\n');
451 
452  usage += QLatin1String("allemails\t");
453  usage += i18n("List all email addresses of each contact");
454 
455  usage += QLatin1Char('\n');
456 
457  usage += QLatin1String("query\t\t");
458  usage += i18n("Use mutt's query format, e.g.\n\t\t"
459  "jdoe@foo.com [tab] John Doe\n\t\t"
460  "Conflicts with alias");
461 
462  usage += QLatin1Char('\n');
463 
464  usage += QLatin1String("alias\t\t");
465  usage += i18n("Use mutt's alias format, e.g.\n\t\t"
466  "alias JohDoe[tab]John Doe &lt;jdoe@foo.com&gt;\n\t\t"
467  "Conflicts with query");
468 
469  usage += QLatin1Char('\n');
470 
471  usage += QLatin1String("altkeys\t\t");
472  usage += i18n("Use alternative keys with alias format, e.g.\n\t\t"
473  "alias jdoe[tab]John Doe &lt;jdoe@foo.com&gt;");
474 
475  usage += QLatin1Char('\n');
476 
477  usage += QLatin1String("prefernick\t");
478  usage += i18n("If a nick name exists use it instead of the key, e.g.\n\t\t"
479  "alias johnny[tab]John Doe &lt;jdoe@foo.com&gt;");
480 
481  usage += QLatin1Char('\n');
482 
483  usage += QLatin1String("alsonick\t");
484  usage += i18n("Generate additional aliases with the nick name as the key, e.g.\n\t\t"
485  "alias johnny[tab]John Doe &lt;jdoe@foo.com&gt;\n\t\t"
486  "Deactivates 'prefernick' to avoid duplicates");
487 
488  return usage;
489 }
490 
492 
493 bool MuttOutput::setCodec(QTextCodec* codec)
494 {
495  if (codec == 0) return false;
496 
497  m_codec = codec;
498 
499  return true;
500 }
501 
503 
504 bool MuttOutput::writeAddressee(const KABC::Addressee& addressee, std::ostream& stream)
505 {
506  if (stream.bad()) return false;
507 
508  const QString nickKeyString = nickNameKey(addressee);
509 
510  // if we have a key based on nick name and we prefer it over normal key use it
511  // other wise use normal key
512  const QString keyString =
513  (m_preferNickNameKey && !nickKeyString.isEmpty()) ? nickKeyString : key(addressee);
514 
515  if (m_allEmails)
516  {
517  QStringList emails = addressee.emails();
518 
519  QStringList::const_iterator it = emails.constBegin();
520  QStringList::const_iterator endIt = emails.constEnd();
521 
522  if (it != endIt)
523  {
524  if (!(*it).isEmpty())
525  {
526  if (m_queryFormat)
527  {
528  stream << fromUnicode(m_codec, *it).constData() << "\t"
529  << fromUnicode(m_codec, addressee.givenName()).constData() << " "
530  << fromUnicode(m_codec, addressee.familyName()).constData();
531  }
532  else
533  {
534  stream << "alias " << fromUnicode(m_codec, keyString).constData() << "\t";
535  stream << fromUnicode(m_codec, addressee.givenName()).constData() << " "
536  << fromUnicode(m_codec, addressee.familyName()).constData()<< " <"
537  << fromUnicode(m_codec, *it).constData() << ">";
538 
539  if (m_alsoNickNameKey && !nickKeyString.isEmpty())
540  {
541  stream << std::endl;
542  stream << "alias "
543  << fromUnicode(m_codec, nickKeyString).constData() << "\t";
544  stream << fromUnicode(m_codec, addressee.givenName()).constData() << " "
545  << fromUnicode(m_codec, addressee.familyName()).constData()<< " <"
546  << fromUnicode(m_codec, *it).constData() << ">";
547  }
548  }
549 
550  if (stream.bad()) return false;
551  }
552 
553  uint count = 1;
554  for(++it; it != endIt; ++it, ++count)
555  {
556  if ((*it).isEmpty()) continue;
557 
558  if (m_queryFormat && count == 1)
559  {
560  stream << "\t" << fromUnicode(m_codec, i18n("preferred")).constData();
561  }
562 
563  stream << std::endl;
564  if (m_queryFormat)
565  {
566  stream << fromUnicode(m_codec, *it).constData() << "\t"
567  << fromUnicode(m_codec, addressee.givenName()).constData() << " "
568  << fromUnicode(m_codec, addressee.familyName()).constData() << "\t"
569  << "#" << count;
570  }
571  else
572  {
573  stream << "alias " << fromUnicode(m_codec, keyString).constData()
574  << count << "\t";
575  stream << fromUnicode(m_codec, addressee.givenName()).constData() << " "
576  << fromUnicode(m_codec, addressee.familyName()).constData() << " <"
577  << fromUnicode(m_codec, *it).constData() << ">";
578 
579  if (m_alsoNickNameKey && !nickKeyString.isEmpty())
580  {
581  stream << std::endl;
582  stream << "alias "
583  << fromUnicode(m_codec, nickKeyString).constData() << "\t";
584  stream << fromUnicode(m_codec, addressee.givenName()).constData() << " "
585  << fromUnicode(m_codec, addressee.familyName()).constData()<< " <"
586  << fromUnicode(m_codec, *it).constData() << ">";
587  }
588  }
589 
590  if (stream.bad()) return false;
591  }
592  }
593  }
594  else
595  {
596  const QString preferredEmail = addressee.preferredEmail();
597  if (!preferredEmail.isEmpty())
598  {
599  if (m_queryFormat)
600  {
601  stream << fromUnicode(m_codec, preferredEmail).constData() << "\t"
602  << fromUnicode(m_codec, addressee.givenName()).constData() << " "
603  << fromUnicode(m_codec, addressee.familyName()).constData();
604  }
605  else
606  {
607  stream << "alias " << fromUnicode(m_codec, keyString).constData() << "\t";
608  stream << fromUnicode(m_codec, addressee.givenName()).constData() << " "
609  << fromUnicode(m_codec, addressee.familyName()).constData() << " <"
610  << fromUnicode(m_codec, preferredEmail).constData() << ">";
611 
612  if (m_alsoNickNameKey && !nickKeyString.isEmpty())
613  {
614  stream << std::endl;
615  stream << "alias "
616  << fromUnicode(m_codec, nickKeyString).constData() << "\t";
617  stream << fromUnicode(m_codec, addressee.givenName()).constData() << " "
618  << fromUnicode(m_codec, addressee.familyName()).constData()<< " <"
619  << fromUnicode(m_codec, preferredEmail).constData() << ">";
620  }
621  }
622  }
623  }
624 
625  return !stream.bad();
626 }
627 
629 
630 bool MuttOutput::writeAddresseeList(const KABC::AddresseeList& addresseeList,
631  std::ostream& stream)
632 {
633  if (stream.bad()) return false;
634 
635  AddresseeList::const_iterator it = addresseeList.constBegin();
636  AddresseeList::const_iterator endIt = addresseeList.constEnd();
637  for (; it != endIt; ++it)
638  {
639  if ((*it).emails().count() == 0) continue;
640 
641  if (!writeAddressee(*it, stream)) return false;
642 
643  stream << std::endl;
644  }
645 
646  return !stream.bad();
647 }
648 
650 
651 QString MuttOutput::key(const KABC::Addressee& addressee) const
652 {
653  if (m_altKeyFormat)
654  {
655  const QChar space = QLatin1Char(' ');
656  const QChar underscore = QLatin1Char('_');
657 
658  if (addressee.familyName().isEmpty())
659  return addressee.givenName().toLower().replace(space, underscore);
660  else
661  return addressee.givenName().left(1).toLower() +
662  addressee.familyName().toLower().replace(space, underscore);
663  }
664  else
665  return addressee.givenName().left(3) + addressee.familyName().left(3);
666 }
667 
668 QString MuttOutput::nickNameKey(const KABC::Addressee& addressee) const
669 {
670  if (!addressee.nickName().isEmpty())
671  {
672  const QChar space = QLatin1Char(' ');
673  const QChar underscore = QLatin1Char('_');
674  return addressee.nickName().toLower().replace(space, underscore);
675  }
676  else
677  return QString();
678 }
679 
682 
683 CSVOutput::CSVOutput(CSVTemplateFactory* templateFactory)
684  : m_codec(0), m_template(0), m_templateFactory(templateFactory)
685 {
686 }
687 
689 
690 CSVOutput::~CSVOutput()
691 {
692 }
693 
695 
696 QString CSVOutput::description() const
697 {
698  return i18n("Writes the data as a delimiter separated list of values");
699 }
700 
702 
703 bool CSVOutput::setOptions(const QByteArray& options)
704 {
705  QString name = QString::fromLocal8Bit(options);
706  if (name.isEmpty()) return false;
707 
708  m_template = m_templateFactory->createCachedTemplate(name);
709 
710  return m_template != 0;
711 }
712 
714 
715 QString CSVOutput::optionUsage() const
716 {
717  QString usage =
718  i18n("Specify one of the following CSV templates:");
719 
720  usage += QLatin1Char('\n');
721 
722  const QMap<QString, QString> templateNames = m_templateFactory->templateNames();
723 
724  QMap<QString, QString>::const_iterator it = templateNames.constBegin();
725  QMap<QString, QString>::const_iterator endIt = templateNames.constEnd();
726  for (; it != endIt; ++it)
727  {
728  QString name = it.key();
729  QString templateName = it.value();
730 
731  usage += name;
732 
733  usage += name.length() < 8 ? QLatin1String("\t\t") : QLatin1String("\t");
734 
735  usage += templateName;
736 
737  usage += QLatin1Char('\n');
738  }
739 
740  return usage;
741 }
742 
744 
745 bool CSVOutput::setCodec(QTextCodec* codec)
746 {
747  if (codec == 0) return false;
748 
749  m_codec = codec;
750 
751  return true;
752 }
753 
755 
756 bool CSVOutput::writeAddressee(const KABC::Addressee& addressee, std::ostream& stream)
757 {
758  if (stream.bad()) return false;
759 
760  if (m_template == 0) m_template = CSVTemplate::defaultTemplate();
761 
762  QStringList columns;
763  for (int i = 0; i < m_template->columns(); ++i)
764  {
765  QString text = m_template->fieldText(i, addressee);
766  text.replace(QLatin1Char('\n'), QLatin1String("\\n"));
767 
768  columns.append(m_template->quote() + text + m_template->quote());
769  }
770 
771  stream << fromUnicode(m_codec, columns.join(m_template->delimiter())).constData();
772 
773  return !stream.bad();
774 }
775 
777 
778 bool CSVOutput::writeAddresseeList(const KABC::AddresseeList& addresseeList,
779  std::ostream& stream)
780 {
781  if (stream.bad()) return false;
782 
783  AddresseeList::const_iterator it = addresseeList.constBegin();
784  AddresseeList::const_iterator endIt = addresseeList.constEnd();
785  for (; it != endIt; ++it)
786  {
787  if (!writeAddressee(*it, stream)) return false;
788 
789  stream << std::endl;
790  }
791 
792  return !stream.bad();
793 }
794 
795 // End of file
EmailOutput::setCodec
virtual bool setCodec(QTextCodec *codec)
Sets the text codec to use.
Definition: outputformatimpls.cpp:308
CSVOutput::CSVOutput
CSVOutput(CSVTemplateFactory *templateFactory)
Definition: outputformatimpls.cpp:683
CSVOutput::optionUsage
virtual QString optionUsage() const
Returns a translate message about the available format options.
Definition: outputformatimpls.cpp:715
UIDOutput::setCodec
virtual bool setCodec(QTextCodec *codec)
Sets the text codec to use.
Definition: outputformatimpls.cpp:68
UIDOutput::writeAddresseeList
virtual bool writeAddresseeList(const KABC::AddresseeList &addresseeList, std::ostream &stream)
Writes the data from each addressee in the given list to the given output stream. ...
Definition: outputformatimpls.cpp:90
EmailOutput::description
virtual QString description() const
Returns a translate description of the output format.
Definition: outputformatimpls.cpp:261
MuttOutput::setCodec
virtual bool setCodec(QTextCodec *codec)
Sets the text codec to use.
Definition: outputformatimpls.cpp:493
CSVTemplateFactory::templateNames
QMap< QString, QString > templateNames()
Returns a set of available templates.
Definition: csvtemplatefactory.cpp:96
EmailOutput::optionUsage
virtual QString optionUsage() const
Returns a translate message about the available format options.
Definition: outputformatimpls.cpp:289
CSVOutput::description
virtual QString description() const
Returns a translate description of the output format.
Definition: outputformatimpls.cpp:696
CSVOutput::writeAddressee
virtual bool writeAddressee(const KABC::Addressee &addressee, std::ostream &stream)
Writes the data of a given addressee to the given output stream.
Definition: outputformatimpls.cpp:756
UIDOutput::writeAddressee
virtual bool writeAddressee(const KABC::Addressee &addressee, std::ostream &stream)
Writes the data of a given addressee to the given output stream.
Definition: outputformatimpls.cpp:79
VCardOutput::writeAddressee
virtual bool writeAddressee(const KABC::Addressee &addressee, std::ostream &stream)
Writes the data of a given addressee to the given output stream.
Definition: outputformatimpls.cpp:181
EmailOutput::setOptions
virtual bool setOptions(const QByteArray &options)
Configures the output format.
Definition: outputformatimpls.cpp:268
EmailOutput::writeAddresseeList
virtual bool writeAddresseeList(const KABC::AddresseeList &addresseeList, std::ostream &stream)
Writes the data from each addressee in the given list to the given output stream. ...
Definition: outputformatimpls.cpp:362
VCardOutput::setOptions
virtual bool setOptions(const QByteArray &options)
Configures the output format.
Definition: outputformatimpls.cpp:131
UIDOutput::setOptions
virtual bool setOptions(const QByteArray &options)
Configures the output format.
Definition: outputformatimpls.cpp:60
MuttOutput::description
virtual QString description() const
Returns a translate description of the output format.
Definition: outputformatimpls.cpp:402
MuttOutput::MuttOutput
MuttOutput()
Definition: outputformatimpls.cpp:394
VCardOutput::writeAddresseeList
virtual bool writeAddresseeList(const KABC::AddresseeList &addresseeList, std::ostream &stream)
Writes the data from each addressee in the given list to the given output stream. ...
Definition: outputformatimpls.cpp:217
CSVOutput::setCodec
virtual bool setCodec(QTextCodec *codec)
Sets the text codec to use.
Definition: outputformatimpls.cpp:745
MuttOutput::setOptions
virtual bool setOptions(const QByteArray &options)
Configures the output format.
Definition: outputformatimpls.cpp:409
csvtemplatefactory.h
MuttOutput::optionUsage
virtual QString optionUsage() const
Returns a translate message about the available format options.
Definition: outputformatimpls.cpp:444
fromUnicode
QByteArray fromUnicode(QTextCodec *codec, const QString &text)
Definition: outputformatimpls.cpp:44
CSVTemplate::delimiter
const QString & delimiter() const
Returns the CSV delimiter string.
Definition: csvtemplate.h:135
EmailOutput::EmailOutput
EmailOutput()
Definition: outputformatimpls.cpp:255
CSVTemplate::fieldText
QString fieldText(int column, const KABC::Addressee &addressee) const
Returns the specified field of the given addressee formatted as a string.
Definition: csvtemplate.cpp:113
CSVTemplate::quote
const QString & quote() const
Returns the CSV quoting string.
Definition: csvtemplate.h:160
CSVTemplateFactory::createCachedTemplate
CSVTemplate * createCachedTemplate(const QString &name)
Creates a template handler for a given name and caches the instance.
Definition: csvtemplatefactory.cpp:74
MuttOutput::writeAddresseeList
virtual bool writeAddresseeList(const KABC::AddresseeList &addresseeList, std::ostream &stream)
Writes the data from each addressee in the given list to the given output stream. ...
Definition: outputformatimpls.cpp:630
CSVTemplate::defaultTemplate
static CSVTemplate * defaultTemplate()
Returns the template with default setup.
Definition: csvtemplate.cpp:429
VCardOutput::VCardOutput
VCardOutput()
Definition: outputformatimpls.cpp:110
VCardOutput::description
virtual QString description() const
Returns a translate description of the output format.
Definition: outputformatimpls.cpp:124
VCardOutput::optionUsage
virtual QString optionUsage() const
Returns a translate message about the available format options.
Definition: outputformatimpls.cpp:143
csvtemplate.h
CSVOutput::setOptions
virtual bool setOptions(const QByteArray &options)
Configures the output format.
Definition: outputformatimpls.cpp:703
CSVTemplate::columns
int columns() const
Returns the number of CSV columns.
Definition: csvtemplate.h:113
MuttOutput::writeAddressee
virtual bool writeAddressee(const KABC::Addressee &addressee, std::ostream &stream)
Writes the data of a given addressee to the given output stream.
Definition: outputformatimpls.cpp:504
UIDOutput::description
virtual QString description() const
Returns a translate description of the output format.
Definition: outputformatimpls.cpp:53
VCardOutput::setCodec
virtual bool setCodec(QTextCodec *codec)
Sets the text codec to use.
Definition: outputformatimpls.cpp:159
CSVOutput::writeAddresseeList
virtual bool writeAddresseeList(const KABC::AddresseeList &addresseeList, std::ostream &stream)
Writes the data from each addressee in the given list to the given output stream. ...
Definition: outputformatimpls.cpp:778
CSVOutput::~CSVOutput
virtual ~CSVOutput()
Definition: outputformatimpls.cpp:690
outputformatimpls.h
CSVTemplateFactory
Factory for creation CSV template handlers.
Definition: csvtemplatefactory.h:44
VCardOutput::~VCardOutput
virtual ~VCardOutput()
Definition: outputformatimpls.cpp:117
EmailOutput::writeAddressee
virtual bool writeAddressee(const KABC::Addressee &addressee, std::ostream &stream)
Writes the data of a given addressee to the given output stream.
Definition: outputformatimpls.cpp:319
version
static const char version[]
Definition: main.cpp:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

console/kabcclient

Skip menu "console/kabcclient"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal