• 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.12
  • 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->photo();
70 
71  }
72  return mSelf;
73 }
74 
75 Properties::Properties()
76 {
77  kDebug(14000) ;
78  d = new PropertiesPrivate();
79 }
80 
81 Properties::~Properties()
82 {
83  kDebug(14000) ;
84  mSelf = 0L;
85  delete d;
86 }
87 
88 const PropertyTmpl &Properties::tmpl(const QString &key) const
89 {
90  if(d->mTemplates.contains(key))
91  {
92  /*kDebug(14000) <<
93  "Found template for key = '" << key << "'" << endl;*/
94  return d->mTemplates[key];
95  }
96  else
97  return PropertyTmpl::null;
98 }
99 
100 bool Properties::registerTemplate(const QString &key,
101  const PropertyTmpl &tmpl)
102 {
103  if(d->mTemplates.contains(key))
104  {
105  kDebug(14000) <<
106  "Called for EXISTING key = '" << key << "'" << endl;
107  return false;
108  }
109  else
110  {
111  d->mTemplates.insert(key, tmpl);
112  return true;
113  }
114 }
115 
116 void Properties::unregisterTemplate(const QString &key)
117 {
118  kDebug(14000) << "called for key: '" << key << "'";
119  d->mTemplates.remove(key);
120 }
121 
122 bool Properties::isRegistered(const QString &key)
123 {
124  return d->mTemplates.contains(key);
125 }
126 
127 const PropertyTmpl &Properties::fullName() const
128 {
129  return createProp(QLatin1String("FormattedName"),
130  i18n("Full Name"));
131 }
132 
133 const PropertyTmpl &Properties::idleTime() const
134 {
135  return createProp(QLatin1String("idleTime"),
136  i18n("Idle Time"));
137 }
138 
139 const PropertyTmpl &Properties::onlineSince() const
140 {
141  return createProp(QLatin1String("onlineSince"),
142  i18n("Online Since"));
143 }
144 
145 const PropertyTmpl &Properties::lastSeen() const
146 {
147  return createProp(QLatin1String("lastSeen"),
148  i18n("Last Seen"), QString(), true);
149 }
150 
151 const PropertyTmpl &Properties::statusTitle() const
152 {
153  return createProp(QLatin1String("statusTitle"),
154  i18n("Status Title"));
155 }
156 
157 const PropertyTmpl &Properties::statusMessage() const
158 {
159  return createProp(QLatin1String("statusMessage"),
160  i18n("Status Message"));
161 }
162 
163 const PropertyTmpl &Properties::firstName() const
164 {
165  return createProp(QLatin1String("firstName"),
166  i18n("First Name"), QString(), true);
167 }
168 
169 const PropertyTmpl &Properties::lastName() const
170 {
171  return createProp(QLatin1String("lastName"),
172  i18n("Last Name"), QString(), true);
173 }
174 
175 const PropertyTmpl &Properties::privatePhone() const
176 {
177  return createProp(QLatin1String("privatePhoneNumber"),
178  i18n("Private Phone"), QString(), true);
179 }
180 
181 const PropertyTmpl &Properties::privateMobilePhone() const
182 {
183  return createProp(QLatin1String("privateMobilePhoneNumber"),
184  i18n("Private Mobile Phone"), QString(), true);
185 }
186 
187 const PropertyTmpl &Properties::workPhone() const
188 {
189  return createProp(QLatin1String("workPhoneNumber"),
190  i18n("Work Phone"), QString(), true);
191 }
192 
193 const PropertyTmpl &Properties::workMobilePhone() const
194 {
195  return createProp(QLatin1String("workMobilePhoneNumber"),
196  i18n("Work Mobile Phone"), QString(), true);
197 }
198 
199 const PropertyTmpl &Properties::emailAddress() const
200 {
201  return createProp(QLatin1String("emailAddress"),
202  i18n("Email Address"), QLatin1String("mail"), true);
203 }
204 
205 const PropertyTmpl &Properties::nickName() const
206 {
207  return createProp(QLatin1String("nickName"),
208  i18n("Nick Name"), QString(), true);
209 }
210 
211 const PropertyTmpl &Properties::isAlwaysVisible() const
212 {
213  return createProp(QLatin1String("isAlwaysVisible"),
214  i18n("Shown even if offline"), QString(), true);
215 }
216 
217 const PropertyTmpl &Properties::photo() const
218 {
219  return createProp(QLatin1String("photo"),
220  i18n("Photo"), QString(), true);
221 }
222 
223 
224 const PropertyTmpl &Properties::createProp(const QString &key,
225  const QString &label, const QString &icon, bool persistent) const
226 {
227  /*kDebug(14000) <<
228  "key = " << key << ", label = " << label << endl;*/
229 
230  if(!d->mTemplates.contains(key))
231  {
232 /* kDebug(14000) <<
233  "CREATING NEW PropertyTmpl WITH key = " << key <<
234  ", label = " << label << ", persisten = " << persistent << endl;*/
235  d->mTemplates.insert(key, PropertyTmpl(key, label, icon, persistent ? PropertyTmpl::PersistentProperty : PropertyTmpl::NoProperty));
236  }
237  return tmpl(key);
238 }
239 
240 const PropertyTmpl::Map &Properties::templateMap() const
241 {
242  return d->mTemplates;
243 }
244 
245 } // END namespace Global
246 
247 } // END namespace Kopete
248 
249 // vim: set noet ts=4 sts=4 sw=4:
Kopete::Global::Properties::privatePhone
const PropertyTmpl & privatePhone() const
Definition: kopeteglobal.cpp:175
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:205
Kopete::PropertyTmpl::Map
QMap< QString, PropertyTmpl > Map
A Map of QString and PropertyTmpl objects, based on QMap.
Definition: kopeteproperty.h:135
Kopete::Global::Properties::firstName
const PropertyTmpl & firstName() const
Definition: kopeteglobal.cpp:163
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:181
Kopete::Global::Properties::workPhone
const PropertyTmpl & workPhone() const
Definition: kopeteglobal.cpp:187
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:122
Kopete::Global::Properties::templateMap
const PropertyTmpl::Map & templateMap() const
Definition: kopeteglobal.cpp:240
Kopete::Global::Properties::fullName
const PropertyTmpl & fullName() const
Definition: kopeteglobal.cpp:127
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:88
Kopete::Global::Properties::isAlwaysVisible
const PropertyTmpl & isAlwaysVisible() const
Definition: kopeteglobal.cpp:211
Kopete::PropertyTmpl
Definition: kopeteproperty.h:41
Kopete::PropertyTmpl::PersistentProperty
Definition: kopeteproperty.h:47
Kopete::Global::Properties::emailAddress
const PropertyTmpl & emailAddress() const
Definition: kopeteglobal.cpp:199
Kopete::Global::Properties::lastSeen
const PropertyTmpl & lastSeen() const
Definition: kopeteglobal.cpp:145
Kopete::Global::Properties::statusMessage
const PropertyTmpl & statusMessage() const
Definition: kopeteglobal.cpp:157
Kopete::Global::Properties::photo
const PropertyTmpl & photo() const
default template for a contact's photo.
Definition: kopeteglobal.cpp:217
Kopete::Global::Properties::workMobilePhone
const PropertyTmpl & workMobilePhone() const
Definition: kopeteglobal.cpp:193
Kopete::Global::Properties::onlineSince
const PropertyTmpl & onlineSince() const
Return default template for a contact's online-since time (i.e.
Definition: kopeteglobal.cpp:139
Kopete::Global::Properties::idleTime
const PropertyTmpl & idleTime() const
Return default template for a contact's idle-time.
Definition: kopeteglobal.cpp:133
Kopete::Global::Properties::lastName
const PropertyTmpl & lastName() const
Definition: kopeteglobal.cpp:169
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::statusTitle
const PropertyTmpl & statusTitle() const
Definition: kopeteglobal.cpp:151
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:51 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