Show invite menu in wlm chat window immediately
[kdenetwork.git] / kopete / libkopete / kopeteglobal.cpp
blob2c2d841de456cb758ae0ba311a339ba3a677dbf6
1 /*
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 *************************************************************************
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 *************************************************************************
18 #include "kopeteglobal.h"
19 #include "kopeteuiglobal.h"
21 #include <QtCore/QLatin1String>
22 #include <QtGui/QApplication>
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>
31 #include <kstandarddirs.h>
32 #include <ktar.h>
33 #include <kzip.h>
35 namespace Kopete
38 namespace Global
41 class PropertiesPrivate
43 public:
44 PropertyTmpl::Map mTemplates;
47 Properties *Properties::mSelf = 0L;
49 Properties *Properties::self()
51 if(!mSelf)
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();
72 return mSelf;
75 Properties::Properties()
77 kDebug(14000) ;
78 d = new PropertiesPrivate();
81 Properties::~Properties()
83 kDebug(14000) ;
84 delete d;
87 const PropertyTmpl &Properties::tmpl(const QString &key) const
89 if(d->mTemplates.contains(key))
91 /*kDebug(14000) <<
92 "Found template for key = '" << key << "'" << endl;*/
93 return d->mTemplates[key];
95 else
96 return PropertyTmpl::null;
99 bool Properties::registerTemplate(const QString &key,
100 const PropertyTmpl &tmpl)
102 if(d->mTemplates.contains(key))
104 kDebug(14000) <<
105 "Called for EXISTING key = '" << key << "'" << endl;
106 return false;
108 else
110 d->mTemplates.insert(key, tmpl);
111 return true;
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"),
129 i18n("Full Name"));
132 const PropertyTmpl &Properties::idleTime() const
134 return createProp(QLatin1String("idleTime"),
135 i18n("Idle Time"));
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
220 /*kDebug(14000) <<
221 "key = " << key << ", label = " << label << endl;*/
223 if(!d->mTemplates.contains(key))
225 /* kDebug(14000) <<
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));
230 return tmpl(key);
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: