[Konversation-devel] [Bug 99458] notification list 'New Contact' crash
Peter Simonsson
peter.simonsson at gmail.com
Thu Jul 1 16:02:03 CEST 2010
https://bugs.kde.org/show_bug.cgi?id=99458
--- Comment #4 from Peter Simonsson <peter simonsson gmail com> 2010-07-01 16:02:00 ---
commit 29a3195c150d0e626a8054e27ef4a0234497118f
Author: Peter Simonsson <peter.simonsson at gmail.com>
Date: Fri Apr 1 15:38:48 2005 +0000
* Don't crash on New Contact
* Rename New Contact to Create New Contact
* Reindent the code as it was unreadable
BUG:99458
svn path=/trunk/kdeextragear-2/konversation/; revision=402428
diff --git a/konversation/nicklistviewitem.cpp
b/konversation/nicklistviewitem.cpp
index 7d47313..ad01f97 100644
--- a/konversation/nicklistviewitem.cpp
+++ b/konversation/nicklistviewitem.cpp
@@ -179,9 +179,9 @@ void NickListViewItem::paintCell(QPainter * p, const
QColorGroup & cg, int colum
NickInfo* nickInfo = nick->getNickInfo();
if(nickInfo->isAway())
- {
- cg2 = kapp->palette().disabled();
- }
+ {
+ cg2 = kapp->palette().disabled();
+ }
QListViewItem::paintCell(p,cg2,column,width,align);
}
diff --git a/konversation/nicksonline.cpp b/konversation/nicksonline.cpp
index 06fa1b2..d89d994 100644
--- a/konversation/nicksonline.cpp
+++ b/konversation/nicksonline.cpp
@@ -603,50 +603,64 @@ QListViewItem* NicksOnline::getServerAndNickItem(const
QString& serverName,
*/
void NicksOnline::doCommand(int id)
{
- if (id < 0) return;
+ if(id < 0) {
+ return;
+ }
+
QString serverName;
QString nickname;
QListViewItem* item = m_nickListView->selectedItem();
- if (!getItemServerAndNick(item, serverName, nickname)) return;
+
+ if(!getItemServerAndNick(item, serverName, nickname)) {
+ return;
+ }
+
// Get the server object corresponding to the server name.
- KonversationApplication *konvApp =
- static_cast<KonversationApplication *>(KApplication::kApplication());
+ KonversationApplication *konvApp = static_cast<KonversationApplication
*>(kapp);
Server* server = konvApp->getServerByName(serverName);
- if (!server) return;
+
+ if(!server) {
+ return;
+ }
+
// Get NickInfo object corresponding to the nickname.
NickInfoPtr nickInfo = server->getNickInfo(nickname);
// Get addressbook entry for the nick.
KABC::Addressee addressee;
- if (nickInfo)
+
+ if(nickInfo) {
addressee = nickInfo->getAddressee();
- else
+ } else {
addressee = server->getOfflineNickAddressee(nickname);
+ }
switch(id)
{
- case(ciSendEmail):
- Konversation::Addressbook::self()->sendEmail(addressee);
- return; //no need to refresh item
- case(ciAddressbookEdit):
- Konversation::Addressbook::self()->editAddressee(addressee.uid());
- return; //no need to refresh item - nickinfo changed will be called
anyway.
- case(ciAddressbookChange):
- if(nickInfo)
- nickInfo->showLinkAddressbookUI();
- else {
- LinkAddressbookUI *linkaddressbookui = new
LinkAddressbookUI(server->getMainWindow(), NULL, nickname,
server->getServerName(), server->getServerGroup(), addressee.realName());
- linkaddressbookui->show();
- }
- break;
-
- case ciAddressbookNew:
+ case ciSendEmail:
+ Konversation::Addressbook::self()->sendEmail(addressee);
+ return; //no need to refresh item
+ case ciAddressbookEdit:
+ Konversation::Addressbook::self()->editAddressee(addressee.uid());
+ return; //no need to refresh item - nickinfo changed will be
called anyway.
+ case ciAddressbookChange:
+ if(nickInfo) {
+ nickInfo->showLinkAddressbookUI();
+ } else {
+ LinkAddressbookUI *linkaddressbookui = new
LinkAddressbookUI(server->getMainWindow(), NULL, nickname,
server->getServerName(), server->getServerGroup(), addressee.realName());
+ linkaddressbookui->show();
+ }
+ break;
+ case ciAddressbookNew:
case ciAddressbookDelete:
{
Konversation::Addressbook *addressbook =
Konversation::Addressbook::self();
- if(addressbook->getAndCheckTicket())
- {
+
+ if(addressbook && addressbook->getAndCheckTicket()) {
if(id == ciAddressbookDelete) {
- if (addressee.isEmpty()) return;
+ if (addressee.isEmpty()) {
+ return;
+ }
+
addressbook->unassociateNick(addressee, nickname,
server->getServerName(), server->getServerGroup());
} else {
addressee.setGivenName(nickname);
@@ -656,13 +670,14 @@ void NicksOnline::doCommand(int id)
if(addressbook->saveTicket())
{
//saveTicket will refresh the addressees for us.
- if(id == ciAddressbookNew)
-
Konversation::Addressbook::self()->editAddressee(nickInfo->getAddressee().uid());
+ if(id == ciAddressbookNew) {
+
Konversation::Addressbook::self()->editAddressee(addressee.uid());
+ }
}
}
break;
}
- case ciJoinChannel:
+ case ciJoinChannel:
{
// Channels have no nlvcServerName entry.
// We test if it is empty to see if we really have a channel name.
@@ -677,6 +692,7 @@ void NicksOnline::doCommand(int id)
server->queue("WHOIS "+nickname);
return;
}
+
refreshItem(item);
}
@@ -734,7 +750,7 @@ void NicksOnline::setupAddressbookButtons(int nickState)
}
case nsNoAddress:
{
- m_editContactButton->setText(i18n("New C&ontact..."));
+ m_editContactButton->setText(i18n("Create New C&ontact..."));
m_editContactButton->setEnabled(true);
m_changeAssociationButton->setText(i18n("&Choose
Association..."));
m_changeAssociationButton->setEnabled(true);
@@ -800,7 +816,7 @@ void
NicksOnline::slotNickListView_RightButtonClicked(QListViewItem* item, const
case nsNoAddress:
{
m_popupMenu->insertItem(i18n("&Choose Association..."),
ciAddressbookChange);
- m_popupMenu->insertItem(i18n("New C&ontact..."),
ciAddressbookNew);
+ m_popupMenu->insertItem(i18n("Create New C&ontact..."),
ciAddressbookNew);
m_popupMenu->insertSeparator();
m_popupMenu->insertItem(i18n("&Whois"), ciWhois);
if (item->text(nlvcServerName).isEmpty())
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Konversation-devel
mailing list