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

kopete/libkopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • libkopete
kopeteglobal.cpp
Go to the documentation of this file.
1 /*
2  kopeteglobal.cpp - Kopete Globals
3 
4  Copyright (c) 2004 by Richard Smith <kde@metafoo.co.uk>
5 
6  Kopete (c) 2004 by the Kopete developers <kopete-devel@kde.org>
7 
8  *************************************************************************
9  * *
10  * This library is free software; you can redistribute it and/or *
11  * modify it under the terms of the GNU Lesser General Public *
12  * License as published by the Free Software Foundation; either *
13  * version 2 of the License, or (at your option) any later version. *
14  * *
15  *************************************************************************
16 */
17 
18 #include "kopeteglobal.h"
19 #include "kopeteuiglobal.h"
20 
21 #include <QtCore/QLatin1String>
22 #include <QtGui/QApplication>
23 
24 #include <kdebug.h>
25 #include <klocale.h>
26 #include <kio/netaccess.h>
27 #include <kmimetype.h>
28 #include <kmessagebox.h>
29 #include <kprogressdialog.h>
30 
31 #include <kstandarddirs.h>
32 #include <ktar.h>
33 #include <kzip.h>
34 
35 namespace Kopete
36 {
37 
38 namespace Global
39 {
40 
41 class PropertiesPrivate
42 {
43  public:
44  PropertyTmpl::Map mTemplates;
45 };
46 
47 Properties *Properties::mSelf = 0L;
48 
49 Properties *Properties::self()
50 {
51  if(!mSelf)
52  {
53  //kDebug(14000) ;
54  mSelf = new Properties();
55  // create the templates
56  mSelf->fullName();
57  mSelf->idleTime();
58  mSelf->onlineSince();
59  mSelf->lastSeen();
60  mSelf->statusMessage();
61  mSelf->firstName();
62  mSelf->lastName();
63  mSelf->emailAddress();
64  mSelf->privatePhone();
65  mSelf->privateMobilePhone();
66  mSelf->workPhone();
67  mSelf->workMobilePhone();
68  mSelf->nickName();
69  mSelf->customName();
70  mSelf->photo();
71 
72  }
73  return mSelf;
74 }
75 
76 Properties::Properties()
77 {
78  kDebug(14000) ;
79  d = new PropertiesPrivate();
80 }
81 
82 Properties::~Properties()
83 {
84  kDebug(14000) ;
85  mSelf = 0L;
86  delete d;
87 }
88 
89 const PropertyTmpl &Properties::tmpl(const QString &key) const
90 {
91  if(d->mTemplates.contains(key))
92  {
93  /*kDebug(14000) <<
94  "Found template for key = '" << key << "'" << endl;*/
95  return d->mTemplates[key];
96  }
97  else
98  return PropertyTmpl::null;
99 }
100 
101 bool Properties::registerTemplate(const QString &key,
102  const PropertyTmpl &tmpl)
103 {
104  if(d->mTemplates.contains(key))
105  {
106  kDebug(14000) <<
107  "Called for EXISTING key = '" << key << "'" << endl;
108  return false;
109  }
110  else
111  {
112  d->mTemplates.insert(key, tmpl);
113  return true;
114  }
115 }
116 
117 void Properties::unregisterTemplate(const QString &key)
118 {
119  kDebug(14000) << "called for key: '" << key << "'";
120  d->mTemplates.remove(key);
121 }
122 
123 bool Properties::isRegistered(const QString &key)
124 {
125  return d->mTemplates.contains(key);
126 }
127 
128 const PropertyTmpl &Properties::fullName() const
129 {
130  return createProp(QLatin1String("FormattedName"),
131  i18n("Full Name"));
132 }
133 
134 const PropertyTmpl &Properties::idleTime() const
135 {
136  return createProp(QLatin1String("idleTime"),
137  i18n("Idle Time"));
138 }
139 
140 const PropertyTmpl &Properties::onlineSince() const
141 {
142  return createProp(QLatin1String("onlineSince"),
143  i18n("Online Since"));
144 }
145 
146 const PropertyTmpl &Properties::lastSeen() const
147 {
148  return createProp(QLatin1String("lastSeen"),
149  i18n("Last Seen"), QString(), true);
150 }
151 
152 const PropertyTmpl &Properties::statusTitle() const
153 {
154  return createProp(QLatin1String("statusTitle"),
155  i18n("Status Title"));
156 }
157 
158 const PropertyTmpl &Properties::statusMessage() const
159 {
160  return createProp(QLatin1String("statusMessage"),
161  i18n("Status Message"));
162 }
163 
164 const PropertyTmpl &Properties::firstName() const
165 {
166  return createProp(QLatin1String("firstName"),
167  i18n("First Name"), QString(), true);
168 }
169 
170 const PropertyTmpl &Properties::lastName() const
171 {
172  return createProp(QLatin1String("lastName"),
173  i18n("Last Name"), QString(), true);
174 }
175 
176 const PropertyTmpl &Properties::privatePhone() const
177 {
178  return createProp(QLatin1String("privatePhoneNumber"),
179  i18n("Private Phone"), QString(), true);
180 }
181 
182 const PropertyTmpl &Properties::privateMobilePhone() const
183 {
184  return createProp(QLatin1String("privateMobilePhoneNumber"),
185  i18n("Private Mobile Phone"), QString(), true);
186 }
187 
188 const PropertyTmpl &Properties::workPhone() const
189 {
190  return createProp(QLatin1String("workPhoneNumber"),
191  i18n("Work Phone"), QString(), true);
192 }
193 
194 const PropertyTmpl &Properties::workMobilePhone() const
195 {
196  return createProp(QLatin1String("workMobilePhoneNumber"),
197  i18n("Work Mobile Phone"), QString(), true);
198 }
199 
200 const PropertyTmpl &Properties::emailAddress() const
201 {
202  return createProp(QLatin1String("emailAddress"),
203  i18n("Email Address"), QLatin1String("mail"), true);
204 }
205 
206 const PropertyTmpl &Properties::nickName() const
207 {
208  return createProp(QLatin1String("nickName"),
209  i18n("Nick Name"), QString(), true);
210 }
211 
212 const PropertyTmpl &Properties::customName() const
213 {
214  return createProp(QLatin1String("customName"),
215  i18n("Custom Name"), QString(), true);
216 }
217 
218 const PropertyTmpl &Properties::isAlwaysVisible() const
219 {
220  return createProp(QLatin1String("isAlwaysVisible"),
221  i18n("Shown even if offline"), QString(), true);
222 }
223 
224 const PropertyTmpl &Properties::photo() const
225 {
226  return createProp(QLatin1String("photo"),
227  i18n("Photo"), QString(), true);
228 }
229 
230 
231 const PropertyTmpl &Properties::createProp(const QString &key,
232  const QString &label, const QString &icon, bool persistent) const
233 {
234  /*kDebug(14000) <<
235  "key = " << key << ", label = " << label << endl;*/
236 
237  if(!d->mTemplates.contains(key))
238  {
239 /* kDebug(14000) <<
240  "CREATING NEW PropertyTmpl WITH key = " << key <<
241  ", label = " << label << ", persisten = " << persistent << endl;*/
242  d->mTemplates.insert(key, PropertyTmpl(key, label, icon, persistent ? PropertyTmpl::PersistentProperty : PropertyTmpl::NoProperty));
243  }
244  return tmpl(key);
245 }
246 
247 const PropertyTmpl::Map &Properties::templateMap() const
248 {
249  return d->mTemplates;
250 }
251 
252 } // END namespace Global
253 
254 } // END namespace Kopete
255 
256 // vim: set noet ts=4 sts=4 sw=4:
Kopete::Global::Properties::privatePhone
const PropertyTmpl & privatePhone() const
Definition: kopeteglobal.cpp:176
Kopete::Global::Properties::self
static Properties * self()
Singleton accessor for this class.
Definition: kopeteglobal.cpp:49
Kopete::Global::Properties::nickName
const PropertyTmpl & nickName() const
Definition: kopeteglobal.cpp:206
QMap< QString, PropertyTmpl >
Kopete::Global::Properties::firstName
const PropertyTmpl & firstName() const
Definition: kopeteglobal.cpp:164
Kopete::Global::Properties
Global facility to query/store templates that are needed by KopeteProperty.
Definition: kopeteglobal.h:45
Kopete::Global::Properties::privateMobilePhone
const PropertyTmpl & privateMobilePhone() const
Definition: kopeteglobal.cpp:182
Kopete::Global::Properties::workPhone
const PropertyTmpl & workPhone() const
Definition: kopeteglobal.cpp:188
kopeteuiglobal.h
Kopete::Global::Properties::isRegistered
bool isRegistered(const QString &key)
return true if a template with key key is already registered, false otherwise
Definition: kopeteglobal.cpp:123
Kopete::Global::Properties::templateMap
const PropertyTmpl::Map & templateMap() const
Definition: kopeteglobal.cpp:247
Kopete::Global::Properties::fullName
const PropertyTmpl & fullName() const
Definition: kopeteglobal.cpp:128
Kopete::Global::Properties::tmpl
const PropertyTmpl & tmpl(const QString &key) const
Return a template with defined by key, if no such template has been registered PropertyTmpl::null wil...
Definition: kopeteglobal.cpp:89
Kopete::Global::Properties::isAlwaysVisible
const PropertyTmpl & isAlwaysVisible() const
Definition: kopeteglobal.cpp:218
Kopete::PropertyTmpl
Definition: kopeteproperty.h:41
Kopete::PropertyTmpl::PersistentProperty
Definition: kopeteproperty.h:47
Kopete::Global::Properties::emailAddress
const PropertyTmpl & emailAddress() const
Definition: kopeteglobal.cpp:200
QString
Kopete::Global::Properties::lastSeen
const PropertyTmpl & lastSeen() const
Definition: kopeteglobal.cpp:146
Kopete::Global::Properties::statusMessage
const PropertyTmpl & statusMessage() const
Definition: kopeteglobal.cpp:158
Kopete::Global::Properties::photo
const PropertyTmpl & photo() const
default template for a contact's photo.
Definition: kopeteglobal.cpp:224
Kopete::Global::Properties::workMobilePhone
const PropertyTmpl & workMobilePhone() const
Definition: kopeteglobal.cpp:194
QLatin1String
Kopete::Global::Properties::onlineSince
const PropertyTmpl & onlineSince() const
Return default template for a contact's online-since time (i.e.
Definition: kopeteglobal.cpp:140
Kopete::Global::Properties::idleTime
const PropertyTmpl & idleTime() const
Return default template for a contact's idle-time.
Definition: kopeteglobal.cpp:134
Kopete::Global::Properties::lastName
const PropertyTmpl & lastName() const
Definition: kopeteglobal.cpp:170
Kopete::PropertyTmpl::null
static PropertyTmpl null
An empty template, check for it using isNull()
Definition: kopeteproperty.h:125
Kopete::PropertyTmpl::NoProperty
Definition: kopeteproperty.h:46
kopeteglobal.h
Kopete::Global::Properties::customName
const PropertyTmpl & customName() const
Definition: kopeteglobal.cpp:212
Kopete::Global::Properties::statusTitle
const PropertyTmpl & statusTitle() const
Definition: kopeteglobal.cpp:152
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

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