2 kopeteglobal.cpp - Kopete Globals
4 Copyright (c) 2004 by Richard Smith <kde@metafoo.co.uk>
6 Kopete (c) 2004 by the Kopete developers <kopete-devel@kde.org>
8 *************************************************************************
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. *
15 *************************************************************************
18 #include "kopeteglobal.h"
19 #include "kopeteuiglobal.h"
21 #include <QtCore/QLatin1String>
22 #include <QtGui/QApplication>
26 #include <kio/netaccess.h>
27 #include <kmimetype.h>
28 #include <kmessagebox.h>
29 #include <kprogressdialog.h>
31 #include <kstandarddirs.h>
41 class PropertiesPrivate
44 PropertyTmpl::Map mTemplates
;
47 Properties
*Properties::mSelf
= 0L;
49 Properties
*Properties::self()
54 mSelf
= new Properties();
55 // create the templates
60 mSelf
->statusMessage();
63 mSelf
->emailAddress();
64 mSelf
->privatePhone();
65 mSelf
->privateMobilePhone();
67 mSelf
->workMobilePhone();
75 Properties::Properties()
78 d
= new PropertiesPrivate();
81 Properties::~Properties()
87 const PropertyTmpl
&Properties::tmpl(const QString
&key
) const
89 if(d
->mTemplates
.contains(key
))
92 "Found template for key = '" << key << "'" << endl;*/
93 return d
->mTemplates
[key
];
96 return PropertyTmpl::null
;
99 bool Properties::registerTemplate(const QString
&key
,
100 const PropertyTmpl
&tmpl
)
102 if(d
->mTemplates
.contains(key
))
105 "Called for EXISTING key = '" << key
<< "'" << endl
;
110 d
->mTemplates
.insert(key
, tmpl
);
115 void Properties::unregisterTemplate(const QString
&key
)
117 kDebug(14000) << "called for key: '" << key
<< "'";
118 d
->mTemplates
.remove(key
);
121 bool Properties::isRegistered(const QString
&key
)
123 return d
->mTemplates
.contains(key
);
126 const PropertyTmpl
&Properties::fullName() const
128 return createProp(QLatin1String("FormattedName"),
132 const PropertyTmpl
&Properties::idleTime() const
134 return createProp(QLatin1String("idleTime"),
138 const PropertyTmpl
&Properties::onlineSince() const
140 return createProp(QLatin1String("onlineSince"),
141 i18n("Online Since"));
144 const PropertyTmpl
&Properties::lastSeen() const
146 return createProp(QLatin1String("lastSeen"),
147 i18n("Last Seen"), QString(), true);
150 const PropertyTmpl
&Properties::statusTitle() const
152 return createProp(QLatin1String("statusTitle"),
153 i18n("Status Title"));
156 const PropertyTmpl
&Properties::statusMessage() const
158 return createProp(QLatin1String("statusMessage"),
159 i18n("Status Message"));
162 const PropertyTmpl
&Properties::firstName() const
164 return createProp(QLatin1String("firstName"),
165 i18n("First Name"), QString(), true);
168 const PropertyTmpl
&Properties::lastName() const
170 return createProp(QLatin1String("lastName"),
171 i18n("Last Name"), QString(), true);
174 const PropertyTmpl
&Properties::privatePhone() const
176 return createProp(QLatin1String("privatePhoneNumber"),
177 i18n("Private Phone"), QString(), true);
180 const PropertyTmpl
&Properties::privateMobilePhone() const
182 return createProp(QLatin1String("privateMobilePhoneNumber"),
183 i18n("Private Mobile Phone"), QString(), true);
186 const PropertyTmpl
&Properties::workPhone() const
188 return createProp(QLatin1String("workPhoneNumber"),
189 i18n("Work Phone"), QString(), true);
192 const PropertyTmpl
&Properties::workMobilePhone() const
194 return createProp(QLatin1String("workMobilePhoneNumber"),
195 i18n("Work Mobile Phone"), QString(), true);
198 const PropertyTmpl
&Properties::emailAddress() const
200 return createProp(QLatin1String("emailAddress"),
201 i18n("Email Address"), QLatin1String("mail"), true);
204 const PropertyTmpl
&Properties::nickName() const
206 return createProp(QLatin1String("nickName"),
207 i18n("Nick Name"), QString(), true);
210 const PropertyTmpl
&Properties::photo() const
212 return createProp(QLatin1String("photo"),
213 i18n("Photo"), QString(), true);
217 const PropertyTmpl
&Properties::createProp(const QString
&key
,
218 const QString
&label
, const QString
&icon
, bool persistent
) const
221 "key = " << key << ", label = " << label << endl;*/
223 if(!d
->mTemplates
.contains(key
))
226 "CREATING NEW PropertyTmpl WITH key = " << key <<
227 ", label = " << label << ", persisten = " << persistent << endl;*/
228 d
->mTemplates
.insert(key
, PropertyTmpl(key
, label
, icon
, persistent
? PropertyTmpl::PersistentProperty
: PropertyTmpl::NoProperty
));
233 const PropertyTmpl::Map
&Properties::templateMap() const
235 return d
->mTemplates
;
238 } // END namespace Global
240 } // END namespace Kopete
242 // vim: set noet ts=4 sts=4 sw=4: