1 /*
2 * This file is part of Licq, an instant messaging client for UNIX.
3 * Copyright (C) 2000-2013 Licq developers <licq-dev@googlegroups.com>
4 *
5 * Licq 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 * Licq 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 Licq; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #include "info.h"
21
22 #include "config.h"
23
24 #include <boost/foreach.hpp>
25 #include <cstring>
26
27 #include <QCheckBox>
28 #include <QComboBox>
29 #include <QDate>
30 #include <QGridLayout>
31 #include <QGroupBox>
32 #include <QHeaderView>
33 #include <QLabel>
34 #include <QMovie>
35 #include <QPixmap>
36 #include <QPushButton>
37 #include <QTreeWidget>
38 #include <QVBoxLayout>
39
40 #ifdef USE_KDE
41 #include <KDE/KFileDialog>
42 #include <kdeversion.h>
43 #else
44 #include <QFileDialog>
45 #endif
46
47 #include <licq/contactlist/owner.h>
48 #include <licq/contactlist/user.h>
49 #include <licq/icq/icq.h>
50 #include <licq/icq/icqdata.h>
51 #include <licq/icq/owner.h>
52 #include <licq/icq/user.h>
53 #include <licq/plugin/pluginmanager.h>
54 #include <licq/pluginsignal.h>
55 #include <licq/protocolmanager.h>
56 #include <licq/logging/log.h>
57
58 #include "config/iconmanager.h"
59 #include "core/messagebox.h"
60 #include "dialogs/editcategorydlg.h"
61 #include "dialogs/phonedlg.h"
62 #include "widgets/infofield.h"
63 #include "widgets/mledit.h"
64 #include "widgets/mlview.h"
65 #include "widgets/skinnablelabel.h"
66 #include "widgets/specialspinbox.h"
67 #include "widgets/timezoneedit.h"
68 #include "userdlg.h"
69
70 using Licq::gProtocolManager;
71 using namespace LicqQtGui;
72 /* TRANSLATOR LicqQtGui::UserPages::Info */
73
Info(bool isOwner,unsigned long protocolId,UserDlg * parent)74 UserPages::Info::Info(bool isOwner, unsigned long protocolId, UserDlg* parent)
75 : QObject(parent),
76 myPpid(protocolId),
77 m_bOwner(isOwner),
78 myAliasHasChanged(false)
79 {
80 parent->addPage(UserDlg::GeneralPage, createPageGeneral(parent),
81 tr("Info"));
82 if (myPpid == ICQ_PPID)
83 {
84 parent->addPage(UserDlg::MorePage, createPageMore(parent),
85 tr("More"), UserDlg::GeneralPage);
86 parent->addPage(UserDlg::More2Page, createPageMore2(parent),
87 tr("More II"), UserDlg::GeneralPage);
88 parent->addPage(UserDlg::WorkPage, createPageWork(parent),
89 tr("Work"), UserDlg::GeneralPage);
90 parent->addPage(UserDlg::AboutPage, createPageAbout(parent),
91 tr("About"), UserDlg::GeneralPage);
92 parent->addPage(UserDlg::PhonePage, createPagePhoneBook(parent),
93 tr("Phone Book"), UserDlg::GeneralPage);
94 }
95 parent->addPage(UserDlg::PicturePage, createPagePicture(parent),
96 tr("Picture"), UserDlg::GeneralPage);
97 parent->addPage(UserDlg::CountersPage, createPageCounters(parent),
98 tr("Last"));
99 }
100
load(const Licq::User * user)101 void UserPages::Info::load(const Licq::User* user)
102 {
103 myUserId = user->id();
104 myId = user->accountId().c_str();
105
106 loadPageGeneral(user);
107 if (myPpid == ICQ_PPID)
108 {
109 const Licq::IcqUser* icquser = dynamic_cast<const Licq::IcqUser*>(user);
110 loadPageMore(user);
111 loadPageMore2(icquser);
112 loadPageWork(user);
113 loadPageAbout(user);
114 loadPagePhoneBook(icquser);
115 }
116 loadPagePicture(user);
117 loadPageCounters(user);
118 }
119
apply(Licq::User * user)120 void UserPages::Info::apply(Licq::User* user)
121 {
122 savePageGeneral(user);
123 if (myPpid == ICQ_PPID)
124 {
125 Licq::IcqUser* icquser = dynamic_cast<Licq::IcqUser*>(user);
126 savePageMore(user);
127 savePageMore2(icquser);
128 savePageWork(user);
129 savePageAbout(user);
130 savePagePhoneBook(icquser);
131 }
132 savePagePicture(user);
133 }
134
apply2(const Licq::UserId &)135 void UserPages::Info::apply2(const Licq::UserId& /* userId */)
136 {
137 if (myAliasHasChanged)
138 gProtocolManager.updateUserAlias(myUserId);
139 myAliasHasChanged = false;
140 }
141
createPageGeneral(QWidget * parent)142 QWidget* UserPages::Info::createPageGeneral(QWidget* parent)
143 {
144 QWidget* w = new QWidget(parent);
145 myPageGeneralLayout = new QVBoxLayout(w);
146 myPageGeneralLayout->setContentsMargins(0, 0, 0, 0);
147
148 int CR = -1;
149
150 myGeneralBox = new QGroupBox(tr("General Information"));
151 QGridLayout* lay = new QGridLayout(myGeneralBox);
152 lay->setColumnMinimumWidth(2, 10);
153
154 if (!m_bOwner)
155 {
156 lay->addWidget(new QLabel(tr("Account:")), ++CR, 0);
157 nfoOwner = new InfoField(true);
158 lay->addWidget(nfoOwner, CR, 1);
159 myProtocolLabel = new SkinnableLabel();
160 lay->addWidget(myProtocolLabel, CR, 3);
161 }
162
163 lay->addWidget(new QLabel(tr("Alias:")), ++CR, 0);
164 nfoAlias = new InfoField(false);
165 lay->addWidget(nfoAlias, CR, 1);
166
167 if (!m_bOwner)
168 {
169 chkKeepAliasOnUpdate = new QCheckBox(tr("Keep alias on update"));
170 chkKeepAliasOnUpdate->setToolTip(tr(
171 "Normally Licq overwrites the Alias when updating user details.\n"
172 "Check this if you want to keep your changes to the Alias."));
173 lay->addWidget(chkKeepAliasOnUpdate, CR, 3, 1, 2);
174 connect(nfoAlias, SIGNAL(textEdited(const QString&)), SLOT(aliasChanged()));
175 }
176
177 lay->addWidget(new QLabel(tr("ID:")), ++CR, 0);
178 nfoUin = new InfoField(true);
179 lay->addWidget(nfoUin, CR, 1);
180 lay->addWidget(new QLabel(tr("IP:")), CR, 3);
181 nfoIp = new InfoField(true);
182 lay->addWidget(nfoIp, CR, 4);
183
184 lay->addWidget(new QLabel(tr("Status:")), ++CR, 0);
185 nfoStatus = new InfoField(true);
186 lay->addWidget(nfoStatus, CR, 1);
187 lay->addWidget(new QLabel(tr("Timezone:")), CR, 3);
188 tznZone = new TimeZoneEdit();
189 lay->addWidget(tznZone, CR, 4);
190
191 lay->addWidget(new QLabel(tr("Name:")), ++CR, 0);
192 nfoFirstName = new InfoField(false);
193 lay->addWidget(nfoFirstName, CR, 1);
194 nfoLastName = new InfoField(false);
195 lay->addWidget(nfoLastName, CR, 2, 1, 3);
196
197 lay->addWidget(new QLabel(tr("Email 1:")), ++CR, 0);
198 nfoEmailPrimary = new InfoField(false);
199 lay->addWidget(nfoEmailPrimary, CR, 1, 1, 4);
200
201 if (myPpid == ICQ_PPID)
202 {
203 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
204 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
205
206 lay->addWidget(new QLabel(tr("Email 2:")), ++CR, 0);
207 nfoEmailSecondary = new InfoField(false);
208 lay->addWidget(nfoEmailSecondary, CR, 1, 1, 4);
209
210 lay->addWidget(new QLabel(tr("Old email:")), ++CR, 0);
211 nfoEmailOld = new InfoField(false);
212 lay->addWidget(nfoEmailOld, CR, 1, 1, 4);
213
214 lay->addWidget(new QLabel(tr("Address:")), ++CR, 0);
215 nfoAddress = new InfoField(!m_bOwner);
216 lay->addWidget(nfoAddress, CR, 1);
217 lay->addWidget(new QLabel(tr("Phone:")), CR, 3);
218 nfoPhone = new InfoField(false);//!m_bOwner);
219 lay->addWidget(nfoPhone, CR, 4);
220
221 lay->addWidget(new QLabel(tr("State:")), ++CR, 0);
222 nfoState = new InfoField(!m_bOwner);
223 nfoState->setMaxLength(3);
224 lay->addWidget(nfoState, CR, 1);
225 w->setTabOrder(nfoAddress, nfoState);
226 lay->addWidget(new QLabel(tr("Fax:")), CR, 3);
227 nfoFax = new InfoField(false);//!m_bOwner);
228 lay->addWidget(nfoFax, CR, 4);
229 w->setTabOrder(nfoPhone, nfoFax);
230
231 lay->addWidget(new QLabel(tr("City:")), ++CR, 0);
232 nfoCity = new InfoField(!m_bOwner);
233 lay->addWidget(nfoCity, CR, 1);
234 w->setTabOrder(nfoState, nfoCity);
235 lay->addWidget(new QLabel(tr("Cellular:")), CR, 3);
236 nfoCellular = new InfoField(false);//!m_bOwner);
237 lay->addWidget(nfoCellular, CR, 4);
238 w->setTabOrder(nfoFax, nfoCellular);
239
240 lay->addWidget(new QLabel(tr("Zip:")), ++CR, 0);
241 nfoZipCode = new InfoField(!m_bOwner);
242 lay->addWidget(nfoZipCode, CR, 1);
243 w->setTabOrder(nfoCity, nfoZipCode);
244 lay->addWidget(new QLabel(tr("Country:")), CR, 3);
245 if (m_bOwner && icq != NULL)
246 {
247 cmbCountry = new QComboBox();
248 //cmbCountry->addItem(tr("Unspecified"));
249 cmbCountry->setMaximumWidth(cmbCountry->sizeHint().width()+20);
250 for (unsigned short i = 0; i < Licq::NUM_COUNTRIES; i++)
251 cmbCountry->addItem(icq->getCountryByIndex(i)->szName);
252 lay->addWidget(cmbCountry, CR, 4);
253 }
254 else
255 {
256 nfoCountry = new InfoField(!m_bOwner);
257 lay->addWidget(nfoCountry, CR, 4);
258 }
259 }
260
261 lay->setRowStretch(++CR, 5);
262
263 myPageGeneralLayout->addWidget(myGeneralBox);
264 myPageGeneralLayout->addStretch(1);
265
266 return w;
267 }
268
loadPageGeneral(const Licq::User * u)269 void UserPages::Info::loadPageGeneral(const Licq::User* u)
270 {
271 if (!m_bOwner)
272 {
273 chkKeepAliasOnUpdate->setChecked(u->KeepAliasOnUpdate());
274 nfoOwner->setText(myUserId.ownerId().accountId().c_str());
275
276 Licq::ProtocolPluginInstance::Ptr instance =
277 Licq::gPluginManager.getProtocolInstance(myUserId.ownerId());
278 if (instance)
279 {
280 myProtocolLabel->setText(
281 QString::fromLocal8Bit(instance->plugin()->name().c_str()));
282 myProtocolLabel->setPrependPixmap(
283 IconManager::instance()->iconForProtocol(myPpid));
284 }
285 }
286 nfoUin->setText(myId);
287 nfoAlias->setText(QString::fromUtf8(u->getAlias().c_str()));
288 nfoFirstName->setText(QString::fromUtf8(u->getFirstName().c_str()));
289 nfoLastName->setText(QString::fromUtf8(u->getLastName().c_str()));
290 QString ip(u->ipToString().c_str());
291 if (u->Ip() != u->IntIp() && u->IntIp() != 0)
292 {
293 ip.append(QString(" / %1").arg(u->internalIpToString().c_str()));
294 }
295 if (u->Port() != 0)
296 {
297 ip.append(QString(":%1").arg(u->portToString().c_str()));
298 }
299 nfoIp->setText(ip);
300 tznZone->setData(u->timezone());
301 // Owner timezone is not editable, it is taken from system timezone instead
302 if (m_bOwner)
303 tznZone->setEnabled(false);
304 nfoStatus->setText(u->statusString().c_str());
305 nfoEmailPrimary->setText(QString::fromUtf8(u->getUserInfoString("Email1").c_str()));
306
307 if (myPpid != ICQ_PPID)
308 return;
309
310 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
311 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
312 if (!icq)
313 return;
314
315 nfoEmailSecondary->setText(QString::fromUtf8(u->getUserInfoString("Email2").c_str()));
316 nfoEmailOld->setText(QString::fromUtf8(u->getUserInfoString("Email0").c_str()));
317 unsigned int countryCode = u->getUserInfoUint("Country");
318 const Licq::IcqCountry* c = icq->getCountryByCode(countryCode);
319 if (m_bOwner)
320 {
321 if (c == NULL)
322 cmbCountry->setCurrentIndex(0);
323 else
324 cmbCountry->setCurrentIndex(c->nIndex);
325 }
326 else
327 {
328 if (c == NULL)
329 nfoCountry->setText(tr("Unknown (%1)").arg(countryCode));
330 else // known
331 nfoCountry->setText(c->szName);
332 }
333 nfoAddress->setText(QString::fromUtf8(u->getUserInfoString("Address").c_str()));
334 nfoCity->setText(QString::fromUtf8(u->getUserInfoString("City").c_str()));
335 nfoState->setText(QString::fromUtf8(u->getUserInfoString("State").c_str()));
336 nfoPhone->setText(QString::fromUtf8(u->getUserInfoString("PhoneNumber").c_str()));
337 nfoFax->setText(QString::fromUtf8(u->getUserInfoString("FaxNumber").c_str()));
338 nfoCellular->setText(QString::fromUtf8(u->getCellularNumber().c_str()));
339 nfoZipCode->setText(QString::fromUtf8(u->getUserInfoString("Zipcode").c_str()));
340 }
341
savePageGeneral(Licq::User * u)342 void UserPages::Info::savePageGeneral(Licq::User* u)
343 {
344 myAliasHasChanged = (u->getAlias() != nfoAlias->text().toUtf8().constData());
345 u->setAlias(nfoAlias->text().toUtf8().constData());
346 if (!m_bOwner)
347 u->SetKeepAliasOnUpdate(chkKeepAliasOnUpdate->isChecked());
348 u->setTimezone(tznZone->data());
349 u->setUserInfoString("FirstName", nfoFirstName->text().toUtf8().constData());
350 u->setUserInfoString("LastName", nfoLastName->text().toUtf8().constData());
351 u->setUserInfoString("Email1", nfoEmailPrimary->text().toUtf8().constData());
352
353 if (myPpid != ICQ_PPID)
354 return;
355
356 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
357 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
358 if (!icq)
359 return;
360
361 u->setUserInfoString("Email2", nfoEmailSecondary->text().toUtf8().constData());
362 u->setUserInfoString("Email0", nfoEmailOld->text().toUtf8().constData());
363 u->setUserInfoString("City", nfoCity->text().toUtf8().constData());
364 u->setUserInfoString("State", nfoState->text().toUtf8().constData());
365 u->setUserInfoString("Address", nfoAddress->text().toUtf8().constData());
366 u->setUserInfoString("PhoneNumber", nfoPhone->text().toUtf8().constData());
367 u->setUserInfoString("FaxNumber", nfoFax->text().toUtf8().constData());
368 u->setUserInfoString("CellularNumber", nfoCellular->text().toUtf8().constData());
369 u->setUserInfoString("Zipcode", nfoZipCode->text().toUtf8().constData());
370 if (m_bOwner)
371 {
372 unsigned short i = cmbCountry->currentIndex();
373 u->setUserInfoUint("Country", icq->getCountryByIndex(i)->nCode);
374 }
375 }
376
createPageMore(QWidget * parent)377 QWidget* UserPages::Info::createPageMore(QWidget* parent)
378 {
379 QWidget* w = new QWidget(parent);
380 myPageMoreLayout = new QVBoxLayout(w);
381 myPageMoreLayout->setContentsMargins(0, 0, 0, 0);
382
383 unsigned short CR = 0;
384 myMoreBox = new QGroupBox(tr("More"));
385 QGridLayout* lay = new QGridLayout(myMoreBox);
386 lay->setRowMinimumHeight(6, 5);
387
388 lay->addWidget(new QLabel(tr("Age:")), CR, 0);
389 nfoAge = new InfoField(!m_bOwner);
390 lay->addWidget(nfoAge, CR, 1);
391 lay->addWidget(new QLabel(tr("Gender:")), CR, 3);
392 if (m_bOwner)
393 {
394 cmbGender = new QComboBox();
395 cmbGender->insertItem(Licq::User::GenderUnspecified, tr("Unspecified"));
396 cmbGender->insertItem(Licq::User::GenderFemale, tr("Female"));
397 cmbGender->insertItem(Licq::User::GenderMale, tr("Male"));
398 lay->addWidget(cmbGender, CR, 4);
399 }
400 else
401 {
402 nfoGender = new InfoField(true);
403 lay->addWidget(nfoGender, CR, 4);
404 }
405
406 lay->addWidget(new QLabel(tr("Homepage:")), ++CR, 0);
407 nfoHomepage = new InfoField(!m_bOwner);
408 lay->addWidget(nfoHomepage, CR, 1, 1, 4);
409
410 lay->addWidget(new QLabel(tr("Category:")), ++CR, 0);
411 lvHomepageCategory = new QTreeWidget();
412 lvHomepageCategory->setColumnCount(1);
413 lvHomepageCategory->header()->hide();
414 lvHomepageCategory->setRootIsDecorated(true);
415 lvHomepageCategory->setMaximumHeight(50);
416 lay->addWidget(lvHomepageCategory, CR, 1, 1, 4);
417
418 lay->addWidget(new QLabel(tr("Description:")), ++CR, 0);
419 mleHomepageDesc = new MLEdit(true);
420 mleHomepageDesc->setReadOnly(true);
421 lay->addWidget(mleHomepageDesc, CR, 1, 1, 4);
422
423 lay->addWidget(new QLabel(tr("Birthday:")), ++CR, 0);
424 if (m_bOwner)
425 {
426 QHBoxLayout* w = new QHBoxLayout();
427 w->setSpacing(8);
428 QLabel* lblYear = new QLabel(tr("Year:"));
429 lblYear->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
430 w->addWidget(lblYear);
431 spnBirthYear = new SpecialSpinBox(1900, 2100, tr("Not set"));
432 w->addWidget(spnBirthYear);
433 QLabel* lblMonth = new QLabel(tr("Month:"));
434 lblMonth->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
435 w->addWidget(lblMonth);
436 spnBirthMonth = new SpecialSpinBox(0, 12, tr("Not set"));
437 w->addWidget(spnBirthMonth);
438 QLabel* lblDay = new QLabel(tr("Day:"));
439 lblDay->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
440 w->addWidget(lblDay);
441 spnBirthDay = new SpecialSpinBox(0, 31, tr("Not set"));
442 w->addWidget(spnBirthDay);
443 lay->addLayout(w, CR, 1, 1, 4);
444 }
445 else
446 {
447 nfoBirthday = new InfoField(!m_bOwner);
448 lay->addWidget(nfoBirthday, CR, 1, 1, 4);
449 }
450
451 if (m_bOwner)
452 {
453 lay->addWidget(new QLabel(tr("Language 1:")), ++CR, 0);
454 cmbLanguage[0] = new QComboBox();
455 lay->addWidget(cmbLanguage[0], CR, 1);
456 lay->addWidget(new QLabel(tr("Language 2:")), CR, 3);
457 cmbLanguage[1] = new QComboBox();
458 lay->addWidget(cmbLanguage[1], CR, 4);
459
460 lay->addWidget(new QLabel(tr("Language 3:")), ++CR, 0);
461 cmbLanguage[2] = new QComboBox();
462 lay->addWidget(cmbLanguage[2], CR, 1);
463
464 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
465 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
466 if (icq)
467 {
468 for (unsigned short i = 0; i < 3; i++)
469 for (unsigned short j = 0; j < Licq::NUM_LANGUAGES; j++)
470 {
471 const struct Licq::IcqCategory* icqcat = icq->getLanguageByIndex(j);
472 if (icqcat != NULL)
473 cmbLanguage[i]->addItem(icqcat->szName);
474 }
475 }
476 }
477 else
478 {
479 lay->addWidget(new QLabel(tr("Language 1:")), ++CR, 0);
480 nfoLanguage[0] = new InfoField(!m_bOwner);
481 lay->addWidget(nfoLanguage[0], CR, 1);
482 lay->addWidget(new QLabel(tr("Language 2:")), CR, 3);
483 nfoLanguage[1] = new InfoField(!m_bOwner);
484 lay->addWidget(nfoLanguage[1], CR, 4);
485
486 lay->addWidget(new QLabel(tr("Language 3:")), ++CR, 0);
487 nfoLanguage[2] = new InfoField(!m_bOwner);
488 lay->addWidget(nfoLanguage[2], CR, 1);
489 }
490
491 lblAuth = new QLabel();
492 CR++;
493 lay->addWidget(lblAuth, CR, 0, 1, 5);
494
495 lblICQHomepage = new QLabel();
496 CR++;
497 lay->addWidget(lblICQHomepage, CR, 0, 1, 5);
498
499 myPageMoreLayout->addWidget(myMoreBox);
500 myPageMoreLayout->addStretch(1);
501
502 return w;
503 }
504
loadPageMore(const Licq::User * u)505 void UserPages::Info::loadPageMore(const Licq::User* u)
506 {
507 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
508 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
509 if (!icq)
510 return;
511
512 // Gender
513 unsigned int gender = u->getUserInfoUint("Gender");
514 if (m_bOwner)
515 {
516 cmbGender->setCurrentIndex(gender);
517 }
518 else
519 {
520 if (gender == Licq::User::GenderFemale)
521 nfoGender->setText(tr("Female"));
522 else if (gender == Licq::User::GenderMale)
523 nfoGender->setText(tr("Male"));
524 else
525 nfoGender->setText(tr("Unspecified"));
526 }
527
528 // Age
529 unsigned int age = u->getUserInfoUint("Age");
530 if (age == Licq::User::AgeUnspecified)
531 nfoAge->setText(tr("Unspecified"));
532 else
533 nfoAge->setText(age);
534
535 // Birthday
536 unsigned int birthDay = u->getUserInfoUint("BirthDay");
537 unsigned int birthMonth = u->getUserInfoUint("BirthMonth");
538 unsigned int birthYear = u->getUserInfoUint("BirthYear");
539 if (m_bOwner)
540 {
541 spnBirthDay->setValue(birthDay);
542 spnBirthMonth->setValue(birthMonth);
543 spnBirthYear->setValue(birthYear);
544 }
545 else
546 {
547 if (birthMonth == 0 || birthDay == 0)
548 {
549 nfoBirthday->setText(tr("Unspecified"));
550 }
551 else
552 {
553 QDate d(birthYear, birthMonth, birthDay);
554 nfoBirthday->setText(d.toString());
555 }
556 }
557
558 nfoHomepage->setText(QString::fromUtf8(u->getUserInfoString("Homepage").c_str()));
559
560 lvHomepageCategory->clear();
561 mleHomepageDesc->clear();
562 if (u->getUserInfoBool("HomepageCatPresent"))
563 {
564 if (m_bOwner)
565 mleHomepageDesc->setReadOnly(false);
566
567 const struct Licq::IcqCategory* c = icq->getHomepageCatByCode(u->getUserInfoUint("HomepageCatCode"));
568 if (c != NULL)
569 {
570 QTreeWidgetItem* lvi = new QTreeWidgetItem(lvHomepageCategory);
571 int rowCount = 1;
572 char* sTmp = strdup(c->szName);
573 char* front = sTmp;
574 char* last = NULL;
575 char* end;
576 while (true)
577 {
578 lvi->setExpanded(true);
579 end = strchr(front, '/');
580 if (end == NULL)
581 {
582 lvi->setText(0, front);
583 break;
584 }
585
586 *end = '\0';
587
588 if (last == NULL || strcmp(last, front))
589 {
590 lvi->setText(0, front);
591 last = front;
592 lvi = new QTreeWidgetItem(lvi);
593 rowCount++;
594 }
595
596 front = end + 1;
597 }
598 lvHomepageCategory->setMaximumHeight(lvHomepageCategory->sizeHintForRow(0) * rowCount + 5);
599 free(sTmp);
600 }
601 QString descstr = QString::fromUtf8(u->getUserInfoString("HomepageDesc").c_str());
602 descstr.replace(QRegExp("\r"), "");
603 mleHomepageDesc->setText(descstr);
604 }
605
606 for (unsigned short i = 0; i < 3; i++)
607 {
608 unsigned int language = u->getUserInfoUint(QString("Language%1").arg(i).toLatin1().constData());
609 const struct Licq::IcqCategory* l = icq->getLanguageByCode(language);
610 if (m_bOwner)
611 {
612 if (l == NULL)
613 cmbLanguage[i]->setCurrentIndex(0);
614 else
615 cmbLanguage[i]->setCurrentIndex(l->nIndex);
616 }
617 else
618 {
619 if (l == NULL)
620 nfoLanguage[i]->setText(tr("Unknown (%1)").arg(language));
621 else // known
622 nfoLanguage[i]->setText(l->szName);
623 }
624 }
625
626 if (u->GetAuthorization())
627 lblAuth->setText(tr("Authorization Required"));
628 else
629 lblAuth->setText(tr("Authorization Not Required"));
630
631 if (u->getUserInfoBool("ICQHomepagePresent"))
632 {
633 QString url;
634 url.sprintf("(http://%s.homepage.icq.com/)", myId.toLatin1().constData());
635 lblICQHomepage->setText(tr("User has an ICQ Homepage ") + url);
636 }
637 else
638 lblICQHomepage->setText(tr("User has no ICQ Homepage"));
639 }
640
savePageMore(Licq::User * u)641 void UserPages::Info::savePageMore(Licq::User* u)
642 {
643 u->setUserInfoUint("Age", nfoAge->text().toULong());
644 u->setUserInfoString("Homepage", nfoHomepage->text().toLocal8Bit().constData());
645 if (m_bOwner)
646 {
647 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
648 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
649 if (!icq)
650 return;
651
652 u->setUserInfoUint("Gender", cmbGender->currentIndex());
653 u->setUserInfoUint("BirthYear",
654 (spnBirthYear->value() == spnBirthYear->minimum() ? 0 : spnBirthYear->value()));
655 u->setUserInfoUint("BirthMonth", spnBirthMonth->value());
656 u->setUserInfoUint("BirthDay", spnBirthDay->value());
657 u->setUserInfoUint("Language0", icq->getLanguageByIndex(cmbLanguage[0]->currentIndex())->nCode);
658 u->setUserInfoUint("Language1", icq->getLanguageByIndex(cmbLanguage[1]->currentIndex())->nCode);
659 u->setUserInfoUint("Language2", icq->getLanguageByIndex(cmbLanguage[2]->currentIndex())->nCode);
660 }
661 }
662
createPageMore2(QWidget * parent)663 QWidget* UserPages::Info::createPageMore2(QWidget* parent)
664 {
665 QWidget* w = new QWidget(parent);
666 myPageMore2Layout = new QVBoxLayout(w);
667 myPageMore2Layout->setContentsMargins(0, 0, 0, 0);
668
669 myMore2Box = new QGroupBox(tr("More II"));
670 QVBoxLayout* lay = new QVBoxLayout(myMore2Box);
671
672 lsvMore2 = new QTreeWidget();
673 lsvMore2->setColumnCount(1);
674 lsvMore2->header()->hide();
675 lsvMore2->setEnabled(true);
676 lsvMore2->setAllColumnsShowFocus(true);
677 if (!m_bOwner)
678 lsvMore2->setSelectionMode(QTreeWidget::NoSelection);
679 lay->addWidget(lsvMore2);
680
681 lviMore2Top[Licq::CAT_BACKGROUND] = new QTreeWidgetItem(lsvMore2);
682 lviMore2Top[Licq::CAT_BACKGROUND]->setText(0, "Past Background");
683 lviMore2Top[Licq::CAT_BACKGROUND]->setExpanded(true);
684
685 lviMore2Top[Licq::CAT_ORGANIZATION] = new QTreeWidgetItem(lsvMore2);
686 lviMore2Top[Licq::CAT_ORGANIZATION]->setText(0, "Organization, Affiliation, Group");
687 lviMore2Top[Licq::CAT_ORGANIZATION]->setExpanded(true);
688
689 lviMore2Top[Licq::CAT_INTERESTS] = new QTreeWidgetItem(lsvMore2);
690 lviMore2Top[Licq::CAT_INTERESTS]->setText(0, "Personal Interests");
691 lviMore2Top[Licq::CAT_INTERESTS]->setExpanded(true);
692
693 if (m_bOwner)
694 connect(lsvMore2, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
695 SLOT(editCategory(QTreeWidgetItem*)));
696
697 myPageMore2Layout->addWidget(myMore2Box);
698 myPageMore2Layout->addStretch(1);
699
700 return w;
701 }
702
splitCategory(QTreeWidgetItem * parent,const char * descr)703 int UserPages::Info::splitCategory(QTreeWidgetItem* parent, const char* descr)
704 {
705 char* p;
706 char* q;
707 char* s;
708 QTreeWidgetItem* lvi = NULL;
709
710 if (descr == NULL || !*descr)
711 return -1;
712
713 s = p = strdup(descr);
714 if (p == NULL)
715 return -1;
716
717 while ((q = strchr(s,',')))
718 {
719 if (q)
720 {
721 *q = '\0';
722
723 if (*s)
724 {
725 QString qs = QString::fromUtf8(s);
726 if (lvi == NULL)
727 {
728 lvi = new QTreeWidgetItem(parent);
729 lvi->setText(0, qs);
730 }
731 else
732 {
733 lvi = new QTreeWidgetItem(parent, lvi);
734 lvi->setText(0, qs);
735 }
736 }
737 s = q + 1;
738 }
739 }
740 if (*s)
741 {
742 QString qs = QString::fromUtf8(s);
743 if (lvi == NULL)
744 {
745 lvi = new QTreeWidgetItem(parent);
746 lvi->setText(0, qs);
747 }
748 else
749 {
750 lvi = new QTreeWidgetItem(parent, lvi);
751 lvi->setText(0, qs);
752 }
753 }
754
755 parent->setExpanded(true);
756
757 free(p);
758 return 0;
759 }
760
loadPageMore2(const Licq::IcqUser * u)761 void UserPages::Info::loadPageMore2(const Licq::IcqUser* u)
762 {
763 myInterests = u->getInterests();
764 updateMore2Info(Licq::CAT_INTERESTS, myInterests);
765
766 myOrganizations = u->getOrganizations();
767 updateMore2Info(Licq::CAT_ORGANIZATION, myOrganizations);
768
769 myBackgrounds = u->getBackgrounds();
770 updateMore2Info(Licq::CAT_BACKGROUND, myBackgrounds);
771 }
772
updateMore2Info(Licq::UserCat cat,const Licq::UserCategoryMap & category)773 void UserPages::Info::updateMore2Info(Licq::UserCat cat, const Licq::UserCategoryMap& category)
774 {
775 QTreeWidgetItem* lvi = NULL;
776
777 while (QTreeWidgetItem* lvChild = lviMore2Top[cat]->takeChild(0))
778 delete lvChild;
779
780 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
781 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
782 if (!icq)
783 return;
784
785 Licq::IcqCategoryType icqcattype;
786 switch (cat)
787 {
788 case Licq::CAT_INTERESTS:
789 icqcattype = Licq::IcqCatTypeInterest;
790 break;
791 case Licq::CAT_ORGANIZATION:
792 icqcattype = Licq::IcqCatTypeOrganization;
793 break;
794 case Licq::CAT_BACKGROUND:
795 icqcattype = Licq::IcqCatTypeBackground;
796 break;
797 default:
798 return;
799 }
800
801 Licq::UserCategoryMap::const_iterator i;
802 for (i = category.begin(); i != category.end(); ++i)
803 {
804 const struct Licq::IcqCategory* sCat = icq->getCategoryByCode(icqcattype, i->first);
805 QString name;
806 if (sCat == NULL)
807 name = tr("Unknown");
808 else
809 name = sCat->szName;
810
811 if (lvi == NULL)
812 {
813 lvi = new QTreeWidgetItem(lviMore2Top[cat]);
814 lvi->setText(0, name);
815 }
816 else
817 {
818 lvi = new QTreeWidgetItem(lviMore2Top[cat], lvi);
819 lvi->setText(0, name);
820 }
821 splitCategory(lvi, i->second.c_str());
822 }
823
824 if (category.empty())
825 {
826 lvi = new QTreeWidgetItem(lviMore2Top[cat]);
827 lvi->setText(0, tr("(none)"));
828 }
829 }
830
savePageMore2(Licq::IcqUser * u)831 void UserPages::Info::savePageMore2(Licq::IcqUser* u)
832 {
833 u->getInterests() = myInterests;
834 u->getOrganizations() = myOrganizations;
835 u->getBackgrounds() = myBackgrounds;
836 }
837
createPageWork(QWidget * parent)838 QWidget* UserPages::Info::createPageWork(QWidget* parent)
839 {
840 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
841 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
842
843 QWidget* w = new QWidget(parent);
844 myPageWorkLayout = new QVBoxLayout(w);
845 myPageWorkLayout->setContentsMargins(0, 0, 0, 0);
846
847 unsigned short CR = 0;
848
849 myWorkBox = new QGroupBox(tr("Work"));
850 QGridLayout* lay = new QGridLayout(myWorkBox);
851 lay->setColumnMinimumWidth(2, 10);
852 lay->setRowStretch(9, 1);
853
854 lay->addWidget(new QLabel(tr("Name:")), CR, 0);
855 nfoCompanyName = new InfoField(!m_bOwner);
856 lay->addWidget(nfoCompanyName, CR, 1, 1, 4);
857
858 lay->addWidget(new QLabel(tr("Department:")), ++CR, 0);
859 nfoCompanyDepartment = new InfoField(!m_bOwner);
860 lay->addWidget(nfoCompanyDepartment, CR, 1, 1, 4);
861
862 lay->addWidget(new QLabel(tr("Position:")), ++CR, 0);
863 nfoCompanyPosition = new InfoField(!m_bOwner);
864 lay->addWidget(nfoCompanyPosition, CR, 1, 1, 4);
865
866 lay->addWidget(new QLabel(tr("Occupation:")), ++CR, 0);
867 if (m_bOwner && icq != NULL)
868 {
869 cmbCompanyOccupation = new QComboBox();
870 cmbCompanyOccupation->setMaximumWidth(cmbCompanyOccupation->sizeHint().width()+20);
871
872 for (unsigned short i = 0; i < Licq::NUM_OCCUPATIONS; i++)
873 cmbCompanyOccupation->addItem(icq->getOccupationByIndex(i)->szName);
874 lay->addWidget(cmbCompanyOccupation, CR, 1);
875 }
876 else
877 {
878 nfoCompanyOccupation = new InfoField(!m_bOwner);
879 lay->addWidget(nfoCompanyOccupation, CR, 1);
880 }
881
882 lay->addWidget(new QLabel(tr("City:")), ++CR, 0);
883 nfoCompanyCity = new InfoField(!m_bOwner);
884 lay->addWidget(nfoCompanyCity, CR, 1);
885 lay->addWidget(new QLabel(tr("State:")), CR, 3);
886 nfoCompanyState = new InfoField(!m_bOwner);
887 nfoCompanyState->setMaxLength(5);
888 lay->addWidget(nfoCompanyState, CR, 4);
889
890 lay->addWidget(new QLabel(tr("Address:")), ++CR, 0);
891 nfoCompanyAddress = new InfoField(!m_bOwner);
892 lay->addWidget(nfoCompanyAddress, CR, 1, 1, 4);
893
894 lay->addWidget(new QLabel(tr("Zip:")), ++CR, 0);
895 nfoCompanyZip = new InfoField(!m_bOwner);
896 lay->addWidget(nfoCompanyZip, CR, 1);
897 lay->addWidget(new QLabel(tr("Country:")), CR, 3);
898 if (m_bOwner && icq != NULL)
899 {
900 cmbCompanyCountry = new QComboBox();
901 cmbCompanyCountry->setMaximumWidth(cmbCompanyCountry->sizeHint().width()+20);
902 for (unsigned short i = 0; i < Licq::NUM_COUNTRIES; i++)
903 cmbCompanyCountry->addItem(icq->getCountryByIndex(i)->szName);
904 lay->addWidget(cmbCompanyCountry, CR, 4);
905 }
906 else
907 {
908 nfoCompanyCountry = new InfoField(!m_bOwner);
909 lay->addWidget(nfoCompanyCountry, CR, 4);
910 }
911
912 lay->addWidget(new QLabel(tr("Phone:")), ++CR, 0);
913 nfoCompanyPhone = new InfoField(!m_bOwner);
914 lay->addWidget(nfoCompanyPhone, CR, 1);
915 lay->addWidget(new QLabel(tr("Fax:")), CR, 3);
916 nfoCompanyFax = new InfoField(!m_bOwner);
917 lay->addWidget(nfoCompanyFax, CR, 4);
918
919 lay->addWidget(new QLabel(tr("Homepage:")), ++CR, 0);
920 nfoCompanyHomepage = new InfoField(!m_bOwner);
921 lay->addWidget(nfoCompanyHomepage, CR, 1, 1, 4);
922
923 myPageWorkLayout->addWidget(myWorkBox);
924 myPageWorkLayout->addStretch(1);
925
926 return w;
927 }
928
loadPageWork(const Licq::User * u)929 void UserPages::Info::loadPageWork(const Licq::User* u)
930 {
931 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
932 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
933 if (!icq)
934 return;
935
936 nfoCompanyName->setText(QString::fromUtf8(u->getUserInfoString("CompanyName").c_str()));
937 nfoCompanyDepartment->setText(QString::fromUtf8(u->getUserInfoString("CompanyDepartment").c_str()));
938 nfoCompanyPosition->setText(QString::fromUtf8(u->getUserInfoString("CompanyPosition").c_str()));
939 nfoCompanyCity->setText(QString::fromUtf8(u->getUserInfoString("CompanyCity").c_str()));
940 nfoCompanyState->setText(QString::fromUtf8(u->getUserInfoString("CompanyState").c_str()));
941 nfoCompanyAddress->setText(QString::fromUtf8(u->getUserInfoString("CompanyAddress").c_str()));
942 nfoCompanyZip->setText(QString::fromUtf8(u->getUserInfoString("CompanyZip").c_str()));
943 unsigned int companyCountry = u->getUserInfoUint("CompanyCountry");
944 unsigned int companyOccupation = u->getUserInfoUint("CompanyOccupation");
945 const Licq::IcqCountry* c = icq->getCountryByCode(companyCountry);
946 const Licq::IcqCategory* o = icq->getOccupationByCode(companyOccupation);
947 if (m_bOwner)
948 {
949 if (c == NULL)
950 cmbCompanyCountry->setCurrentIndex(0);
951 else
952 cmbCompanyCountry->setCurrentIndex(c->nIndex);
953
954 if (o == NULL)
955 cmbCompanyOccupation->setCurrentIndex(0);
956 else
957 cmbCompanyOccupation->setCurrentIndex(o->nIndex);
958 }
959 else
960 {
961 if (c == NULL)
962 nfoCompanyCountry->setText(tr("Unknown (%1)").arg(companyCountry));
963 else // known
964 nfoCompanyCountry->setText(c->szName);
965
966 if (o == NULL)
967 nfoCompanyOccupation->setText(tr("Unknown (%1)").arg(companyOccupation));
968 else
969 nfoCompanyOccupation->setText(o->szName);
970 }
971 nfoCompanyPhone->setText(QString::fromUtf8(u->getUserInfoString("CompanyPhoneNumber").c_str()));
972 nfoCompanyFax->setText(QString::fromUtf8(u->getUserInfoString("CompanyFaxNumber").c_str()));
973 nfoCompanyHomepage->setText(QString::fromUtf8(u->getUserInfoString("CompanyHomepage").c_str()));
974 }
975
savePageWork(Licq::User * u)976 void UserPages::Info::savePageWork(Licq::User* u)
977 {
978 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
979 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
980 if (!icq)
981 return;
982
983 u->setUserInfoString("CompanyCity", nfoCompanyCity->text().toUtf8().constData());
984 u->setUserInfoString("CompanyState", nfoCompanyState->text().toUtf8().constData());
985 u->setUserInfoString("CompanyPhoneNumber", nfoCompanyPhone->text().toUtf8().constData());
986 u->setUserInfoString("CompanyFaxNumber", nfoCompanyFax->text().toUtf8().constData());
987 u->setUserInfoString("CompanyAddress", nfoCompanyAddress->text().toUtf8().constData());
988 u->setUserInfoString("CompanyZip", nfoCompanyZip->text().toUtf8().constData());
989 if (m_bOwner)
990 {
991 unsigned short i = cmbCompanyCountry->currentIndex();
992 u->setUserInfoUint("CompanyCountry", icq->getCountryByIndex(i)->nCode);
993
994 i = cmbCompanyOccupation->currentIndex();
995 u->setUserInfoUint("CompanyOccupation", icq->getOccupationByIndex(i)->nCode);
996 }
997 u->setUserInfoString("CompanyName", nfoCompanyName->text().toUtf8().constData());
998 u->setUserInfoString("CompanyDepartment", nfoCompanyDepartment->text().toUtf8().constData());
999 u->setUserInfoString("CompanyPosition", nfoCompanyPosition->text().toUtf8().constData());
1000 u->setUserInfoString("CompanyHomepage", nfoCompanyHomepage->text().toUtf8().constData());
1001 }
1002
createPageAbout(QWidget * parent)1003 QWidget* UserPages::Info::createPageAbout(QWidget* parent)
1004 {
1005 QWidget* w = new QWidget(parent);
1006 myPageAboutLayout = new QVBoxLayout(w);
1007 myPageAboutLayout->setContentsMargins(0, 0, 0, 0);
1008
1009 myAboutBox = new QGroupBox(tr("About"));
1010 QVBoxLayout* lay = new QVBoxLayout(myAboutBox);
1011
1012 mlvAbout = new MLView();//EditWrap(true, p);
1013 mlvAbout->setReadOnly(!m_bOwner);
1014 lay->addWidget(mlvAbout);
1015
1016 myPageAboutLayout->addWidget(myAboutBox);
1017 myPageAboutLayout->addStretch(1);
1018
1019 return w;
1020 }
1021
loadPageAbout(const Licq::User * u)1022 void UserPages::Info::loadPageAbout(const Licq::User* u)
1023 {
1024 bool bUseHTML = myPpid == ICQ_PPID && !myId[0].isDigit();
1025
1026 QString aboutstr = QString::fromUtf8(u->getUserInfoString("About").c_str());
1027 aboutstr.replace(QRegExp("\r"), "");
1028 mlvAbout->clear();
1029 mlvAbout->append(MLView::toRichText(aboutstr, true, bUseHTML));
1030 }
1031
savePageAbout(Licq::User * u)1032 void UserPages::Info::savePageAbout(Licq::User* u)
1033 {
1034 QString str = mlvAbout->toPlainText();
1035
1036 u->setUserInfoString("About", str.left(450).toUtf8().constData());
1037 }
1038
createPagePhoneBook(QWidget * parent)1039 QWidget* UserPages::Info::createPagePhoneBook(QWidget* parent)
1040 {
1041 QWidget* w = new QWidget(parent);
1042 myPagePhoneBookLayout = new QVBoxLayout(w);
1043 myPagePhoneBookLayout->setContentsMargins(0, 0, 0, 0);
1044
1045 myPhoneBookBox = new QGroupBox(tr("Phone Book"));
1046 QVBoxLayout* lay = new QVBoxLayout(myPhoneBookBox);
1047
1048 lsvPhoneBook = new QTreeWidget();
1049 lsvPhoneBook->setColumnCount(3);
1050 QStringList labels;
1051 labels << tr("Type");
1052 labels << tr("Number/Gateway");
1053 labels << tr("Country/Provider");
1054 lsvPhoneBook->setHeaderLabels(labels);
1055 lsvPhoneBook->setEnabled(true);
1056 lsvPhoneBook->setAllColumnsShowFocus(true);
1057 lay->addWidget(lsvPhoneBook);
1058
1059 QHBoxLayout* hlay = new QHBoxLayout();
1060 lay->addLayout(hlay);
1061
1062 hlay->addWidget(new QLabel(tr("Currently at:")));
1063
1064 if (m_bOwner)
1065 {
1066 cmbActive = new QComboBox();
1067 hlay->addWidget(cmbActive);
1068
1069 connect(lsvPhoneBook, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
1070 SLOT(editPhoneEntry(QTreeWidgetItem*)));
1071 connect(cmbActive, SIGNAL(activated(int)), SLOT(changeActivePhone(int)));
1072 }
1073 else
1074 {
1075 nfoActive = new InfoField(true);
1076 hlay->addWidget(nfoActive);
1077
1078 lsvPhoneBook->setSelectionMode(QTreeWidget::NoSelection);
1079 }
1080
1081 if (m_bOwner)
1082 {
1083 QHBoxLayout* buttonLayout = new QHBoxLayout();
1084 buttonLayout->addStretch(1);
1085
1086 myPhoneAddButton = new QPushButton(tr("Add..."));
1087 connect(myPhoneAddButton, SIGNAL(clicked()), SLOT(addPhone()));
1088 buttonLayout->addWidget(myPhoneAddButton);
1089
1090 myPhoneClearButton = new QPushButton(tr("Clear"));
1091 connect(myPhoneClearButton, SIGNAL(clicked()), SLOT(clearPhone()));
1092 buttonLayout->addWidget(myPhoneClearButton);
1093
1094 lay->addLayout(buttonLayout);
1095 }
1096
1097 myPagePhoneBookLayout->addWidget(myPhoneBookBox);
1098 myPagePhoneBookLayout->addStretch(1);
1099
1100 return w;
1101 }
1102
loadPagePhoneBook(const Licq::IcqUser * u)1103 void UserPages::Info::loadPagePhoneBook(const Licq::IcqUser* u)
1104 {
1105 myIcqPhoneBook = u->getPhoneBook();
1106 updatePhoneBook();
1107 }
1108
updatePhoneBook()1109 void UserPages::Info::updatePhoneBook()
1110 {
1111 Licq::IcqData::Ptr icq = plugin_internal_cast<Licq::IcqData>(
1112 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
1113 if (!icq)
1114 return;
1115
1116 lsvPhoneBook->clear();
1117
1118 if (m_bOwner)
1119 {
1120 cmbActive->clear();
1121 cmbActive->addItem("");
1122 }
1123 else
1124 nfoActive->clear();
1125
1126 QTreeWidgetItem* lsv = NULL;
1127 for (Licq::IcqPhoneBookVector::size_type i = 0; i < myIcqPhoneBook.size(); ++i)
1128 {
1129 const struct Licq::PhoneBookEntry* entry = &myIcqPhoneBook[i];
1130 QString description = QString::fromUtf8(entry->description.c_str());
1131 QString number;
1132 QString country;
1133 if (entry->nType == Licq::TYPE_PAGER)
1134 {
1135 //Windows icq uses extension, try it first
1136 if (!entry->extension.empty())
1137 number = QString::fromUtf8(entry->extension.c_str());
1138 else
1139 number = QString::fromUtf8(entry->phoneNumber.c_str());
1140
1141 QString gateway;
1142 if (entry->nGatewayType == Licq::GATEWAY_BUILTIN)
1143 {
1144 country = QString::fromUtf8(entry->gateway.c_str());
1145
1146 const struct Licq::IcqProvider* sProvider = icq->getProviderByName(entry->gateway.c_str());
1147 if (sProvider != NULL)
1148 gateway = sProvider->szGateway;
1149 else
1150 gateway = tr("Unknown");
1151 }
1152 else
1153 {
1154 country = tr("Unknown");
1155 gateway = QString::fromUtf8(entry->gateway.c_str());
1156 }
1157
1158 number += gateway;
1159 }
1160 else
1161 {
1162 const struct Licq::IcqCountry* sCountry = icq->getCountryByName(entry->country.c_str());
1163 if (sCountry != NULL)
1164 number.sprintf("+%u ", sCountry->nPhone);
1165 const char* szAreaCode = entry->areaCode.c_str();
1166 if (entry->nRemoveLeading0s)
1167 szAreaCode += strspn(szAreaCode, "0");
1168 if (szAreaCode[0] != '\0')
1169 number += tr("(") + QString::fromUtf8(szAreaCode) + tr(") ");
1170 else if (!entry->areaCode.empty())
1171 number += tr("(") + QString::fromUtf8(entry->areaCode.c_str()) + tr(") ");
1172 number += QString::fromUtf8(entry->phoneNumber.c_str());
1173 if (!entry->extension.empty())
1174 number += tr("-") + QString::fromUtf8(entry->extension.c_str());
1175
1176 country = QString::fromUtf8(entry->country.c_str());
1177 }
1178
1179 if (m_bOwner)
1180 {
1181 cmbActive->addItem(number);
1182 if (entry->nActive)
1183 cmbActive->setCurrentIndex(i + 1);
1184 }
1185 else if (entry->nActive)
1186 {
1187 nfoActive->setText(number);
1188 }
1189
1190 if (lsv == NULL)
1191 {
1192 lsv = new QTreeWidgetItem(lsvPhoneBook);
1193 lsv->setText(0, description);
1194 lsv->setText(1, number);
1195 lsv->setText(2, country);
1196 }
1197 else
1198 {
1199 lsv = new QTreeWidgetItem(lsvPhoneBook, lsv);
1200 lsv->setText(0, description);
1201 lsv->setText(1, number);
1202 lsv->setText(2, country);
1203 }
1204
1205 switch (entry->nType)
1206 {
1207 case Licq::TYPE_PHONE:
1208 lsv->setIcon(0, IconManager::instance()->getIcon(IconManager::PSTNIcon));
1209 break;
1210 case Licq::TYPE_CELLULAR:
1211 lsv->setIcon(0, IconManager::instance()->getIcon(IconManager::MobileIcon));
1212 break;
1213 case Licq::TYPE_CELLULARxSMS:
1214 lsv->setIcon(0, IconManager::instance()->getIcon(IconManager::SMSIcon));
1215 break;
1216 case Licq::TYPE_FAX:
1217 lsv->setIcon(0, IconManager::instance()->getIcon(IconManager::FaxIcon));
1218 break;
1219 case Licq::TYPE_PAGER:
1220 lsv->setIcon(0, IconManager::instance()->getIcon(IconManager::PagerIcon));
1221 break;
1222 default:
1223 break;
1224 }
1225 }
1226
1227 for (int i = 0; i < lsvPhoneBook->columnCount(); i++)
1228 lsvPhoneBook->resizeColumnToContents(i);
1229 }
1230
savePagePhoneBook(Licq::IcqUser * u)1231 void UserPages::Info::savePagePhoneBook(Licq::IcqUser* u)
1232 {
1233 u->getPhoneBook() = myIcqPhoneBook;
1234 }
1235
clearPhone()1236 void UserPages::Info::clearPhone()
1237 {
1238 unsigned long nSelection = lsvPhoneBook->indexOfTopLevelItem(lsvPhoneBook->currentItem());
1239
1240 Licq::IcqPhoneBookVector::iterator i;
1241 for (i = myIcqPhoneBook.begin(); nSelection > 0; --nSelection, ++i)
1242 ;
1243
1244 myIcqPhoneBook.erase(i);
1245
1246 updatePhoneBook();
1247 }
1248
1249
createPagePicture(QWidget * parent)1250 QWidget* UserPages::Info::createPagePicture(QWidget* parent)
1251 {
1252 QWidget* w = new QWidget(parent);
1253 myPagePictureLayout = new QVBoxLayout(w);
1254 myPagePictureLayout->setContentsMargins(0, 0, 0, 0);
1255
1256 myPictureBox = new QGroupBox(tr("Picture"));
1257 QVBoxLayout* lay = new QVBoxLayout(myPictureBox);
1258 lblPicture = new QLabel();
1259 lblPicture->setAlignment(lblPicture->alignment() | Qt::AlignHCenter);
1260 lay->addWidget(lblPicture);
1261
1262 if (m_bOwner)
1263 {
1264 QHBoxLayout* buttonLayout = new QHBoxLayout();
1265 buttonLayout->addStretch(1);
1266
1267 myPictureBrowseButton = new QPushButton(tr("Browse..."));
1268 connect(myPictureBrowseButton, SIGNAL(clicked()), SLOT(browsePicture()));
1269 buttonLayout->addWidget(myPictureBrowseButton);
1270
1271 myPictureClearButton = new QPushButton(tr("Clear"));
1272 connect(myPictureClearButton, SIGNAL(clicked()), SLOT(clearPicture()));
1273 buttonLayout->addWidget(myPictureClearButton);
1274
1275 lay->addLayout(buttonLayout);
1276 }
1277
1278 myPagePictureLayout->addWidget(myPictureBox);
1279 myPagePictureLayout->addStretch(1);
1280
1281 return w;
1282 }
1283
loadPagePicture(const Licq::User * u)1284 void UserPages::Info::loadPagePicture(const Licq::User* u)
1285 {
1286 //FIXME: other protocols
1287 if (u != NULL && u->GetPicturePresent())
1288 m_sFilename = QString::fromLocal8Bit(u->pictureFileName().c_str());
1289 else
1290 m_sFilename = QString::null;
1291
1292 QMovie* m = NULL;
1293 QString s = tr("Not Available");
1294 if (!m_sFilename.isNull())
1295 {
1296 m = new QMovie(m_sFilename, QByteArray(), this);
1297 if (!m->isValid())
1298 {
1299 delete m;
1300 m = NULL;
1301 s = tr("Failed to Load");
1302 }
1303 }
1304
1305 if (m_bOwner)
1306 myPictureClearButton->setEnabled(!m_sFilename.isNull());
1307
1308 if (m == NULL)
1309 lblPicture->setText(s);
1310 else
1311 {
1312 lblPicture->setMovie(m);
1313 if (m->frameCount() > 1)
1314 m->start();
1315 else
1316 m->jumpToNextFrame();
1317 }
1318 }
1319
clearPicture()1320 void UserPages::Info::clearPicture()
1321 {
1322 loadPagePicture(NULL);
1323 }
1324
savePagePicture(Licq::User * u)1325 void UserPages::Info::savePagePicture(Licq::User* u)
1326 {
1327 // Only owner can set his picture
1328 if (!m_bOwner) return;
1329
1330 Licq::Owner* o = dynamic_cast<Licq::Owner*>(u);
1331 if (m_sFilename.isEmpty())
1332 o->SetPicture(NULL);
1333 else
1334 o->SetPicture(m_sFilename.toLatin1());
1335 }
1336
createPageCounters(QWidget * parent)1337 QWidget* UserPages::Info::createPageCounters(QWidget* parent)
1338 {
1339 QWidget* w = new QWidget(parent);
1340 myPageCountersLayout = new QVBoxLayout(w);
1341 myPageCountersLayout->setContentsMargins(0, 0, 0, 0);
1342
1343 unsigned short CR = 0;
1344
1345 myCountersBox = new QGroupBox(tr("Last"));
1346 QGridLayout* lay = new QGridLayout(myCountersBox);
1347
1348 lay->addWidget(new QLabel(tr("Last online:")), CR, 0);
1349 nfoLastOnline = new InfoField(true);
1350 lay->addWidget(nfoLastOnline, CR, 1);
1351
1352 lay->addWidget(new QLabel(tr("Last sent event:")), ++CR, 0);
1353 nfoLastSent = new InfoField(true);
1354 lay->addWidget(nfoLastSent, CR, 1);
1355
1356 lay->addWidget(new QLabel(tr("Last received event:")), ++CR, 0);
1357 nfoLastRecv = new InfoField(true);
1358 lay->addWidget(nfoLastRecv, CR, 1);
1359
1360 lay->addWidget(new QLabel(tr("Last checked auto response:")), ++CR, 0);
1361 nfoLastCheckedAR = new InfoField(true);
1362 lay->addWidget(nfoLastCheckedAR, CR, 1);
1363
1364 lay->addWidget(new QLabel(tr("Online since:")), ++CR, 0);
1365 nfoOnlineSince = new InfoField(true);
1366 lay->addWidget(nfoOnlineSince, CR, 1);
1367
1368 lay->addWidget(new QLabel(tr("Registration date:")), ++CR, 0);
1369 nfoRegDate = new InfoField(true);
1370 lay->addWidget(nfoRegDate, CR, 1);
1371
1372 lay->setRowStretch(++CR, 5);
1373
1374 myPageCountersLayout->addWidget(myCountersBox);
1375 myPageCountersLayout->addStretch(1);
1376
1377 return w;
1378 }
1379
loadPageCounters(const Licq::User * u)1380 void UserPages::Info::loadPageCounters(const Licq::User* u)
1381 {
1382 if (u->isOnline())
1383 nfoLastOnline->setText(tr("Now"));
1384 else
1385 nfoLastOnline->setDateTime(u->LastOnline());
1386
1387 nfoLastSent->setDateTime(u->LastSentEvent());
1388 nfoLastRecv->setDateTime(u->LastReceivedEvent());
1389 nfoLastCheckedAR->setDateTime(u->LastCheckedAutoResponse());
1390 nfoRegDate->setDateTime(u->RegisteredTime());
1391
1392 if (u->isOnline())
1393 nfoOnlineSince->setDateTime(u->OnlineSince());
1394 else
1395 nfoOnlineSince->setText(tr("Offline"));
1396 }
1397
editCategory(QTreeWidgetItem * selected)1398 void UserPages::Info::editCategory(QTreeWidgetItem* selected)
1399 {
1400 //undo the effect of double click
1401 selected->setExpanded(!selected->isExpanded());
1402 //at the end of this, selected points at an item at the top level of the list
1403 while (selected->parent() != NULL)
1404 selected = selected->parent();
1405
1406 EditCategoryDlg* ecd;
1407
1408 if (selected == lviMore2Top[Licq::CAT_INTERESTS])
1409 ecd = new EditCategoryDlg(Licq::CAT_INTERESTS, myInterests, dynamic_cast<UserDlg*>(parent()));
1410 else if (selected == lviMore2Top[Licq::CAT_ORGANIZATION])
1411 ecd = new EditCategoryDlg(Licq::CAT_ORGANIZATION, myOrganizations, dynamic_cast<UserDlg*>(parent()));
1412 else if (selected == lviMore2Top[Licq::CAT_BACKGROUND])
1413 ecd = new EditCategoryDlg(Licq::CAT_BACKGROUND, myBackgrounds, dynamic_cast<UserDlg*>(parent()));
1414 else
1415 return;
1416
1417 connect(ecd, SIGNAL(updated(Licq::UserCat, const Licq::UserCategoryMap&)),
1418 SLOT(setCategory(Licq::UserCat, const Licq::UserCategoryMap&)));
1419 }
1420
setCategory(Licq::UserCat cat,const Licq::UserCategoryMap & category)1421 void UserPages::Info::setCategory(Licq::UserCat cat, const Licq::UserCategoryMap& category)
1422 {
1423 switch (cat)
1424 {
1425 case Licq::CAT_INTERESTS:
1426 myInterests = category;
1427 break;
1428 case Licq::CAT_ORGANIZATION:
1429 myOrganizations = category;
1430 break;
1431 case Licq::CAT_BACKGROUND:
1432 myBackgrounds = category;
1433 break;
1434 default:
1435 return;
1436 }
1437
1438 updateMore2Info(cat, category);
1439 }
1440
phoneBookUpdated(struct Licq::PhoneBookEntry & pbe,int entryNum)1441 void UserPages::Info::phoneBookUpdated(struct Licq::PhoneBookEntry& pbe, int entryNum)
1442 {
1443 // FIXME implement this
1444 pbe.nActive = 0;
1445 pbe.nPublish = Licq::PUBLISH_DISABLE;
1446
1447 if (entryNum == -1)
1448 myIcqPhoneBook.push_back(pbe);
1449 else
1450 myIcqPhoneBook[entryNum] = pbe;
1451
1452 updatePhoneBook();
1453 }
1454
editPhoneEntry(QTreeWidgetItem * selected)1455 void UserPages::Info::editPhoneEntry(QTreeWidgetItem* selected)
1456 {
1457 unsigned long nSelection = lsvPhoneBook->indexOfTopLevelItem(selected);
1458
1459 const struct Licq::PhoneBookEntry* entry = &myIcqPhoneBook[nSelection];
1460
1461 EditPhoneDlg* epd = new EditPhoneDlg(dynamic_cast<UserDlg*>(parent()), entry, nSelection);
1462 connect(epd, SIGNAL(updated(struct Licq::PhoneBookEntry&, int)),
1463 SLOT(phoneBookUpdated(struct Licq::PhoneBookEntry&, int)));
1464 epd->show();
1465 }
1466
changeActivePhone(int index)1467 void UserPages::Info::changeActivePhone(int index)
1468 {
1469 for (Licq::IcqPhoneBookVector::size_type i = 0; i < myIcqPhoneBook.size(); ++i)
1470 myIcqPhoneBook[i].nActive = (index == (int)i);
1471
1472 updatePhoneBook();
1473 }
1474
retrieve(UserDlg::UserPage page)1475 unsigned long UserPages::Info::retrieve(UserDlg::UserPage page)
1476 {
1477 if (page == UserDlg::CountersPage)
1478 return 0;
1479
1480 unsigned status;
1481 {
1482 Licq::OwnerReadGuard o(myUserId.ownerId());
1483 if (!o.isLocked())
1484 return 0;
1485 status = o->status();
1486 }
1487
1488 if(status == Licq::User::OfflineStatus)
1489 {
1490 InformUser(dynamic_cast<UserDlg*>(parent()),
1491 tr("You need to be connected to the\nICQ Network to retrieve your settings."));
1492 return 0;
1493 }
1494
1495 //TODO change in the daemon to support other protocols
1496 if (page == UserDlg::GeneralPage)
1497 {
1498 // Before retrieving the meta data we have to
1499 // save current status of "chkKeepAliasOnUpdate"
1500 // and the alias
1501 Licq::UserWriteGuard u(myUserId);
1502 if (!u.isLocked())
1503 return 0;
1504 u->SetEnableSave(false);
1505 u->setAlias(nfoAlias->text().toUtf8().data());
1506 if (!m_bOwner)
1507 u->SetKeepAliasOnUpdate(chkKeepAliasOnUpdate->isChecked());
1508 u->SetEnableSave(true);
1509 u->save(Licq::User::SaveUserInfo);
1510 }
1511
1512 unsigned long icqEventTag;
1513 if (page == UserDlg::PhonePage)
1514 {
1515 if (myPpid != ICQ_PPID)
1516 return 0;
1517 Licq::IcqProtocol::Ptr icq = plugin_internal_cast<Licq::IcqProtocol>(
1518 Licq::gPluginManager.getProtocolInstance(myUserId.ownerId()));
1519 icqEventTag = icq->icqRequestPluginInfo(
1520 myUserId, Licq::IcqProtocol::PluginPhoneBook);
1521 }
1522 else if (page == UserDlg::PicturePage)
1523 {
1524 icqEventTag = gProtocolManager.requestUserPicture(myUserId);
1525 }
1526 else
1527 {
1528 icqEventTag = gProtocolManager.requestUserInfo(myUserId);
1529 }
1530
1531 return icqEventTag;
1532 }
1533
send(UserDlg::UserPage page)1534 unsigned long UserPages::Info::send(UserDlg::UserPage page)
1535 {
1536 unsigned status;
1537
1538 {
1539 Licq::OwnerWriteGuard owner(myUserId);
1540 if (!owner.isLocked())
1541 return 0;
1542 status = owner->status();
1543
1544 // Owner info is read from owner so make sure it's updated
1545 if (page == UserDlg::GeneralPage)
1546 savePageGeneral(*owner);
1547 }
1548
1549 if (status == Licq::User::OfflineStatus)
1550 {
1551 InformUser(dynamic_cast<UserDlg*>(parent()),
1552 tr("You need to be connected to the\nICQ Network to change your settings."));
1553 return 0;
1554 }
1555
1556 unsigned short cc, i, occupation;
1557 unsigned long icqEventTag = 0;
1558
1559 Licq::IcqProtocol::Ptr icq;
1560 Licq::IcqData::Ptr icqdata;
1561 if (myPpid == ICQ_PPID)
1562 {
1563 icq = plugin_internal_cast<Licq::IcqProtocol>(
1564 Licq::gPluginManager.getProtocolInstance(myUserId));
1565 if (!icq)
1566 return 0;
1567 icqdata = plugin_internal_cast<Licq::IcqData>(
1568 Licq::gPluginManager.getProtocolPlugin(ICQ_PPID));
1569 }
1570
1571 switch (page)
1572 {
1573 case UserDlg::GeneralPage:
1574 if (myPpid == ICQ_PPID)
1575 icq->icqSetEmailInfo(myUserId,
1576 nfoEmailSecondary->text().toUtf8().constData(),
1577 nfoEmailOld->text().toUtf8().constData());
1578
1579 icqEventTag = gProtocolManager.updateOwnerInfo(myUserId);
1580 break;
1581
1582 case UserDlg::MorePage:
1583 icqEventTag = icq->icqSetMoreInfo(myUserId,
1584 nfoAge->text().toUShort(),
1585 cmbGender->currentIndex(),
1586 nfoHomepage->text().toLocal8Bit().constData(),
1587 (spnBirthYear->value() == spnBirthYear->minimum() ? 0 : spnBirthYear->value()),
1588 spnBirthMonth->value(),
1589 spnBirthDay->value(),
1590 icqdata->getLanguageByIndex(cmbLanguage[0]->currentIndex())->nCode,
1591 icqdata->getLanguageByIndex(cmbLanguage[1]->currentIndex())->nCode,
1592 icqdata->getLanguageByIndex(cmbLanguage[2]->currentIndex())->nCode);
1593 break;
1594
1595 case UserDlg::More2Page:
1596 icq->icqSetInterestsInfo(myUserId, myInterests);
1597 icqEventTag = icq->icqSetOrgBackInfo(myUserId, myOrganizations, myBackgrounds);
1598 break;
1599
1600 case UserDlg::WorkPage:
1601 i = cmbCompanyCountry->currentIndex();
1602 cc = icqdata->getCountryByIndex(i)->nCode;
1603 i = cmbCompanyOccupation->currentIndex();
1604 occupation = icqdata->getOccupationByIndex(i)->nCode;
1605 icqEventTag = icq->icqSetWorkInfo(myUserId,
1606 nfoCompanyCity->text().toUtf8().constData(),
1607 nfoCompanyState->text().toUtf8().constData(),
1608 nfoCompanyPhone->text().toUtf8().constData(),
1609 nfoCompanyFax->text().toUtf8().constData(),
1610 nfoCompanyAddress->text().toUtf8().constData(),
1611 nfoCompanyZip->text().toUtf8().constData(),
1612 cc,
1613 nfoCompanyName->text().toUtf8().constData(),
1614 nfoCompanyDepartment->text().toUtf8().constData(),
1615 nfoCompanyPosition->text().toUtf8().constData(),
1616 occupation,
1617 nfoCompanyHomepage->text().toUtf8().constData());
1618 break;
1619
1620 case UserDlg::AboutPage:
1621 icqEventTag = icq->icqSetAbout(myUserId, mlvAbout->toPlainText().toUtf8().constData());
1622 break;
1623
1624 case UserDlg::PhonePage:
1625 {
1626 {
1627 Licq::IcqOwnerWriteGuard o(myUserId);
1628 savePagePhoneBook(*o);
1629 }
1630 icq->icqUpdateInfoTimestamp(myUserId, Licq::IcqProtocol::PluginPhoneBook);
1631 icqEventTag = 0;
1632 break;
1633 }
1634 case UserDlg::PicturePage:
1635 {
1636 {
1637 Licq::OwnerWriteGuard o(myUserId);
1638 savePagePicture(*o);
1639 }
1640 if (icq)
1641 {
1642 icq->icqUpdateInfoTimestamp(myUserId, Licq::IcqProtocol::PluginPicture);
1643 icqEventTag = 0;
1644 }
1645 else
1646 icqEventTag = gProtocolManager.updateOwnerInfo(myUserId);
1647 break;
1648 }
1649 default:
1650 icqEventTag = 0;
1651 break;
1652 }
1653
1654 return icqEventTag;
1655 }
1656
addPhone()1657 void UserPages::Info::addPhone()
1658 {
1659 EditPhoneDlg* epd = new EditPhoneDlg(dynamic_cast<UserDlg*>(parent()));
1660 connect(epd, SIGNAL(updated(struct Licq::PhoneBookEntry&, int)),
1661 SLOT(phoneBookUpdated(struct Licq::PhoneBookEntry&, int)));
1662 epd->show();
1663 }
1664
browsePicture()1665 void UserPages::Info::browsePicture()
1666 {
1667 QString Filename;
1668
1669 do
1670 {
1671 #ifdef USE_KDE
1672 Filename = KFileDialog::getOpenFileName(KUrl(),
1673 "Images (*.bmp *.jpg *.jpeg *.jpe *.gif)",
1674 dynamic_cast<UserDlg*>(parent()),
1675 tr("Select your picture"));
1676 #else
1677 Filename = QFileDialog::getOpenFileName(
1678 dynamic_cast<UserDlg*>(parent()),
1679 tr("Select your picture"),
1680 QString::null,
1681 "Images (*.bmp *.jpg *.jpeg *.jpe *.gif)");
1682 #endif
1683 if (Filename.isNull())
1684 break;
1685
1686 QFile file(Filename);
1687 if (file.size() <= Licq::MAX_PICTURE_SIZE)
1688 break;
1689
1690 QString msg = Filename + tr(" is over %1 bytes.\nSelect another picture?")
1691 .arg(Licq::MAX_PICTURE_SIZE);
1692 if (!QueryYesNo(dynamic_cast<UserDlg*>(parent()), msg))
1693 {
1694 Filename = QString::null;
1695 break;
1696 }
1697 } while (1);
1698
1699 if (Filename.isNull())
1700 return;
1701
1702 m_sFilename = Filename;
1703 myPictureClearButton->setEnabled(true);
1704 QPixmap p;
1705 QString s = tr("Not Available");
1706 if (!p.load(Filename))
1707 {
1708 Licq::gLog.warning("Failed to load user picture, did you forget to compile GIF"
1709 " support?");
1710 s = tr("Failed to Load");
1711 }
1712
1713 if (p.isNull())
1714 lblPicture->setText(s);
1715 else
1716 lblPicture->setPixmap(p);
1717 }
1718
userUpdated(const Licq::User * user,unsigned long subSignal)1719 void UserPages::Info::userUpdated(const Licq::User* user, unsigned long subSignal)
1720 {
1721 switch (subSignal)
1722 {
1723 case Licq::PluginSignal::UserInfo:
1724 if (myPpid == ICQ_PPID)
1725 {
1726 const Licq::IcqUser* icquser = dynamic_cast<const Licq::IcqUser*>(user);
1727 loadPageMore(user);
1728 loadPageMore2(icquser);
1729 loadPageWork(user);
1730 loadPageAbout(user);
1731 loadPagePhoneBook(icquser);
1732 }
1733 // fall through
1734 case Licq::PluginSignal::UserBasic:
1735 loadPageGeneral(user);
1736 break;
1737 case Licq::PluginSignal::UserPicture:
1738 loadPagePicture(user);
1739 break;
1740 }
1741 }
1742
aliasChanged()1743 void UserPages::Info::aliasChanged()
1744 {
1745 chkKeepAliasOnUpdate->setChecked(true);
1746 }
1747