diff -u ../../psi-cvs/psi/src/contactview.cpp ./src/contactview.cpp --- ../../psi-cvs/psi/src/contactview.cpp 2005-02-06 11:15:23.000000000 +0100 +++ ./src/contactview.cpp 2005-02-20 17:02:33.000000000 +0100 @@ -531,6 +531,17 @@ removeUnneededContactItems(e); } +void ContactProfile::resetAllContactItemNames() +{ + QPtrListIterator it(d->roster); + for(Entry *e; (e = it.current()); ++it) { + QPtrListIterator cvi_it(e->cvi); + for(ContactViewItem *i; (i = cvi_it.current()); ++cvi_it) { + i->resetName(); + } + } +} + void ContactProfile::removeEntry(const Jid &j) { Entry *e = findEntry(j); @@ -1497,6 +1508,7 @@ if((i->type() == ContactViewItem::Contact && i->u()->inList()) || (i->type() == ContactViewItem::Group && i->groupType() == ContactViewItem::gUser && i->groupName() != ContactView::tr("Hidden"))) { + i->resetName(true); i->setRenameEnabled(0, true); i->startRename(0); i->setRenameEnabled(0, false); @@ -1586,6 +1598,7 @@ //e->u.setName(text); //i->setContact(&e->u); actionRename(e->u.jid(), text); + i->resetName(); // to put the status message in if needed } else { // no change? @@ -1792,6 +1805,7 @@ v_showHidden = true; v_showAgents = true; v_showSelf = true; + v_showStatusMsg = true; lastSize = QSize( 0, 0 ); @@ -1966,6 +1980,19 @@ } } +void ContactView::setShowStatusMsg(bool x) +{ + if (v_showStatusMsg != x) { + v_showStatusMsg = x; + emit showStatusMsg(v_showStatusMsg); + + QPtrListIterator it(d->profiles); + for(ContactProfile *cp; (cp = it.current()); ++it) { + cp->resetAllContactItemNames(); + } + } +} + void ContactView::setShowAgents(bool x) { @@ -2826,15 +2853,34 @@ if ( !d->alerting && d->u ) { setIcon(is->statusPtr(d->u)); } + + // If the status is shown, update the text of the item too + if (static_cast(QListViewItem::listView())->isShowStatusMsg()) { + resetName(); + } } -void ContactViewItem::resetName() +void ContactViewItem::resetName(bool forceNoStatusMsg) { - resetStatus(); if ( d->u ) { QString s = jidnick(d->u->jid().full(), d->u->name()); - if ( s != text(0) ) + + // Add the status message if wanted + if (!forceNoStatusMsg && static_cast(QListViewItem::listView())->isShowStatusMsg()) { + QString statusMsg; + if (d->u->priority() != d->u->userResourceList().end()) + statusMsg = (*d->u->priority()).status().status(); + else + statusMsg = d->u->lastUnavailableStatus().status(); + + statusMsg = statusMsg.simplifyWhiteSpace(); + if (!statusMsg.isEmpty()) + s += " (" + statusMsg + ")"; + } + + if ( s != text(0) ) { setText(0, s); + } } } @@ -3079,6 +3125,12 @@ } } +void ContactViewItem::cancelRename (int i) +{ + QListViewItem::cancelRename(i); + resetName(); +} + int ContactViewItem::rtti() const { return 5103; diff -u ../../psi-cvs/psi/src/contactview.h ./src/contactview.h --- ../../psi-cvs/psi/src/contactview.h 2005-02-06 11:15:23.000000000 +0100 +++ ./src/contactview.h 2005-02-20 17:02:33.000000000 +0100 @@ -73,6 +73,7 @@ void addAllNeededContactItems(); void removeAllUnneededContactItems(); + void resetAllContactItemNames(); void ensureVisible(const Jid &); void clear(); @@ -184,6 +185,7 @@ bool isShowAway() const { return v_showAway; } bool isShowHidden() const { return v_showHidden; } bool isShowSelf() const { return v_showSelf; } + bool isShowStatusMsg() const { return v_showStatusMsg; } void clear(); void resetAnim(); @@ -208,6 +210,7 @@ void showHidden(bool); void showAgents(bool); void showSelf(bool); + void showStatusMsg(bool); public slots: void setShowOffline(bool); @@ -215,6 +218,7 @@ void setShowAway(bool); void setShowHidden(bool); void setShowSelf(bool); + void setShowStatusMsg(bool); void optionsUpdate(); void recalculateSize(); @@ -246,7 +250,7 @@ Private *d; QPoint mousePressPos; // store pressed position, idea taken from Licq - bool v_showOffline, v_showAgents, v_showAway, v_showHidden, v_showSelf; + bool v_showOffline, v_showAgents, v_showAway, v_showHidden, v_showSelf, v_showStatusMsg; bool lcto_active; // double click active? QPoint lcto_pos; QListViewItem *lcto_item; @@ -296,7 +300,7 @@ void setIcon(const Icon *, bool alert = false); void resetStatus(); - void resetName(); // use this to cancel a rename + void resetName(bool forceNoStatusMsg = false); // use this to cancel a rename void resetGroupName(); void updatePosition(); @@ -323,6 +327,7 @@ void dragEntered(); void dragLeft(); void dropped(QDropEvent *); + void cancelRename (int); private: class Private; diff -u ../../psi-cvs/psi/src/mainwin.cpp ./src/mainwin.cpp --- ../../psi-cvs/psi/src/mainwin.cpp 2005-02-14 20:52:56.000000000 +0100 +++ ./src/mainwin.cpp 2005-02-20 17:02:33.000000000 +0100 @@ -273,6 +273,8 @@ d->getAction("show_hidden")->addTo(viewMenu); d->getAction("show_agents")->addTo(viewMenu); d->getAction("show_self")->addTo(viewMenu); + viewMenu->insertSeparator(); + d->getAction("show_statusmsg")->addTo(viewMenu); // Mac-only menus #ifdef Q_WS_MAC @@ -339,6 +341,7 @@ { "show_hidden", toggled, cvlist, SLOT( setShowHidden(bool) ) }, { "show_agents", toggled, cvlist, SLOT( setShowAgents(bool) ) }, { "show_self", toggled, cvlist, SLOT( setShowSelf(bool) ) }, + { "show_statusmsg", toggled, cvlist, SLOT( setShowStatusMsg(bool) ) }, { "button_options", activated, this, SIGNAL( doOptions() ) }, @@ -395,6 +398,7 @@ { "show_offline", cvlist, SIGNAL( showOffline(bool) ), setOn }, { "show_self", cvlist, SIGNAL( showSelf(bool) ), setOn }, { "show_agents", cvlist, SIGNAL( showAgents(bool) ), setOn }, + { "show_statusmsg", cvlist, SIGNAL( showStatusMsg(bool) ), setOn }, { "", 0, 0, 0 } }; Tylko w ./src/: mainwin.cpp~ Wspólne podkatalogi: ../../psi-cvs/psi/src/options i ./src/options diff -u ../../psi-cvs/psi/src/profiles.h ./src/profiles.h --- ../../psi-cvs/psi/src/profiles.h 2004-08-03 08:18:11.000000000 +0200 +++ ./src/profiles.h 2005-02-20 17:02:33.000000000 +0100 @@ -43,7 +43,7 @@ QString jid, pass, host, resource; int port, priority; bool opt_enabled, opt_ssl, opt_pass, opt_host, opt_auto, opt_keepAlive, opt_plain, opt_log, opt_reconn, opt_ignoreSSLWarnings; - bool tog_offline, tog_away, tog_agents, tog_hidden, tog_self; + bool tog_offline, tog_away, tog_agents, tog_hidden, tog_self, tog_statusmsg; int proxy_index; int proxy_type, proxy_port; diff -u ../../psi-cvs/psi/src/psiaccount.cpp ./src/psiaccount.cpp --- ../../psi-cvs/psi/src/psiaccount.cpp 2005-02-14 20:52:57.000000000 +0100 +++ ./src/psiaccount.cpp 2005-02-20 17:02:33.000000000 +0100 @@ -493,7 +493,7 @@ connect(d->psi, SIGNAL(pgpToggled(bool)), SLOT(pgpToggled(bool))); connect(d->psi, SIGNAL(pgpKeysUpdated()), SLOT(pgpKeysUpdated())); - d->psi->setToggles(d->acc.tog_offline, d->acc.tog_away, d->acc.tog_agents, d->acc.tog_hidden,d->acc.tog_self); + d->psi->setToggles(d->acc.tog_offline, d->acc.tog_away, d->acc.tog_agents, d->acc.tog_hidden,d->acc.tog_self, d->acc.tog_statusmsg); setEnabled(d->acc.opt_enabled); @@ -587,7 +587,7 @@ const UserAccount & PsiAccount::userAccount() const { - d->psi->getToggles(&d->acc.tog_offline, &d->acc.tog_away, &d->acc.tog_agents, &d->acc.tog_hidden,&d->acc.tog_self); + d->psi->getToggles(&d->acc.tog_offline, &d->acc.tog_away, &d->acc.tog_agents, &d->acc.tog_hidden,&d->acc.tog_self,&d->acc.tog_statusmsg); // save the roster and pgp key bindings d->acc.roster.clear(); Tylko w ./src/: psiaccount.cpp~ diff -u ../../psi-cvs/psi/src/psiactionlist.cpp ./src/psiactionlist.cpp --- ../../psi-cvs/psi/src/psiactionlist.cpp 2004-08-13 08:28:51.000000000 +0200 +++ ./src/psiactionlist.cpp 2005-02-20 17:02:33.000000000 +0100 @@ -127,6 +127,9 @@ IconAction *showSelf = new IconAction (tr("Show Self Contact"), "psi/self", tr("Show Self Contact"), 0, viewGroups, 0, true); showSelf->setWhatsThis (tr("Toggles visibility of self contact in roster")); + IconAction *showStatusMsg = new IconAction (tr("Show Status Messages"), "psi/statusmsg", tr("Show Status Messages"), 0, viewGroups, 0, true); + showSelf->setWhatsThis (tr("Toggles visibility of status messages of contacts")); + ActionNames actions[] = { { "view_groups", viewGroups }, { "show_offline", showOffline }, @@ -134,6 +137,7 @@ { "show_hidden", showHidden }, { "show_agents", showAgents }, { "show_self", showSelf }, + { "show_statusmsg", showStatusMsg }, { "", 0 } }; diff -u ../../psi-cvs/psi/src/psicon.cpp ./src/psicon.cpp --- ../../psi-cvs/psi/src/psicon.cpp 2005-02-01 19:45:53.000000000 +0100 +++ ./src/psicon.cpp 2005-02-20 17:02:33.000000000 +0100 @@ -1032,7 +1032,7 @@ } } -void PsiCon::setToggles(bool tog_offline, bool tog_away, bool tog_agents, bool tog_hidden, bool tog_self) +void PsiCon::setToggles(bool tog_offline, bool tog_away, bool tog_agents, bool tog_hidden, bool tog_self, bool tog_statusmsg) { if(d->listEnabled.count() > 1) return; @@ -1042,15 +1042,17 @@ d->mainwin->cvlist->setShowAgents(tog_agents); d->mainwin->cvlist->setShowHidden(tog_hidden); d->mainwin->cvlist->setShowSelf(tog_self); + d->mainwin->cvlist->setShowStatusMsg(tog_statusmsg); } -void PsiCon::getToggles(bool *tog_offline, bool *tog_away, bool *tog_agents, bool *tog_hidden, bool *tog_self) +void PsiCon::getToggles(bool *tog_offline, bool *tog_away, bool *tog_agents, bool *tog_hidden, bool *tog_self, bool *tog_statusmsg) { *tog_offline = d->mainwin->cvlist->isShowOffline(); *tog_away = d->mainwin->cvlist->isShowAway(); *tog_agents = d->mainwin->cvlist->isShowAgents(); *tog_hidden = d->mainwin->cvlist->isShowHidden(); *tog_self = d->mainwin->cvlist->isShowSelf(); + *tog_statusmsg = d->mainwin->cvlist->isShowStatusMsg(); } void PsiCon::doOptions() diff -u ../../psi-cvs/psi/src/psicon.h ./src/psicon.h --- ../../psi-cvs/psi/src/psicon.h 2005-02-01 19:45:53.000000000 +0100 +++ ./src/psicon.h 2005-02-20 17:02:33.000000000 +0100 @@ -195,8 +195,8 @@ friend class PsiAccount; void link(PsiAccount *); void unlink(PsiAccount *); - void setToggles(bool tog_offline, bool tog_away, bool tog_agents, bool tog_hidden, bool tog_self); - void getToggles(bool *tog_offline, bool *tog_away, bool *tog_agents, bool *tog_hidden, bool *tog_self); + void setToggles(bool tog_offline, bool tog_away, bool tog_agents, bool tog_hidden, bool tog_self, bool tog_statusmsg); + void getToggles(bool *tog_offline, bool *tog_away, bool *tog_agents, bool *tog_hidden, bool *tog_self, bool *tog_statusmsg); friend class EventQueue; int getId(); diff -u ../../psi-cvs/psi/src/psi_profiles.cpp ./src/psi_profiles.cpp --- ../../psi-cvs/psi/src/psi_profiles.cpp 2005-02-14 20:52:56.000000000 +0100 +++ ./src/psi_profiles.cpp 2005-02-20 17:05:32.000000000 +0100 @@ -68,6 +68,7 @@ opt_passphrase = false; pgpPassphrase = ""; pgpSecretKeyID = ""; + tog_statusmsg = TRUE; proxy_index = 0; proxy_type = PROXY_NONE; @@ -98,6 +99,7 @@ setBoolAttribute(a, "showHidden", tog_hidden); setBoolAttribute(a, "showAgents", tog_agents); setBoolAttribute(a, "showSelf", tog_self); + setBoolAttribute(a, "showStatusMsg", tog_statusmsg); setBoolAttribute(a, "keepAlive", opt_keepAlive); setBoolAttribute(a, "plain", opt_plain); setBoolAttribute(a, "log", opt_log); @@ -208,6 +210,7 @@ readBoolAttribute(a, "showHidden", &tog_hidden); readBoolAttribute(a, "showAgents", &tog_agents); readBoolAttribute(a, "showSelf", &tog_self); + readBoolAttribute(a, "showStatusMsg", &tog_statusmsg); readBoolAttribute(a, "keepAlive", &opt_keepAlive); readBoolAttribute(a, "plain", &opt_plain); readBoolAttribute(a, "log", &opt_log); @@ -527,7 +530,7 @@ tb[1].name = QObject::tr("Show contacts"); tb[1].on = defaultEnableToolbars; tb[1].locked = true; - tb[1].keys << "show_offline" << "show_away" << "show_agents" << "show_self"; + tb[1].keys << "show_offline" << "show_away" << "show_agents" << "spacer" << "show_statusmsg"; tb[2].name = QObject::tr("Event notifier"); tb[2].on = false;