Bug 120588 - [liboscar/icq] add support for editing ICQ user info
Summary: [liboscar/icq] add support for editing ICQ user info
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: ICQ and AIM Plugins (show other bugs)
Version: 0.11
Platform: unspecified Linux
: NOR wishlist with 20 votes (vote)
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
: 121947 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-01-22 12:07 UTC by Heinrich Wendel
Modified: 2007-05-04 23:55 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Heinrich Wendel 2006-01-22 12:07:35 UTC
Version:           0.11 (using KDE 3.5.0, Kubuntu Package 4:3.5.0-0ubuntu0breezy2 )
Compiler:          Target: x86_64-linux-gnu
OS:                Linux (x86_64) release 2.6.12-10-amd64-generic

It would be nice to have support to change your ICQ profile, e.g. set your username, country etc. there. At least the username would be nice, since the current kopete version seems to reset it.
Comment 1 Bram Schoenmakers 2006-03-18 01:16:53 UTC
*** Bug 121947 has been marked as a duplicate of this bug. ***
Comment 2 Roman Jarosz 2006-10-18 17:00:04 UTC
SVN commit 596807 by rjarosz:

Add support for editing ICQ user info.

For now editing of ICQGeneralUserInfo class is supported, remaining user info classes will be done soon.

FEATURE: 120588
GUI:



 M  +46 -0     icq/icqaccount.cpp  
 M  +8 -0      icq/icqaccount.h  
 M  +2 -2      icq/icqcontact.cpp  
 M  +116 -81   icq/ui/icqgeneralinfo.ui  
 M  +99 -103   icq/ui/icqhomeinfowidget.ui  
 M  +99 -22    icq/ui/icquserinfowidget.cpp  
 M  +10 -2     icq/ui/icquserinfowidget.h  
 M  +1 -0      liboscar/CMakeLists.txt  
 M  +1 -1      liboscar/buffer.cpp  
 M  +13 -0     liboscar/client.cpp  
 M  +3 -0      liboscar/client.h  
 A             liboscar/icqinfovalue.h   [License: LGPL (v2+)]
 M  +106 -13   liboscar/icquserinfo.cpp  
 M  +24 -18    liboscar/icquserinfo.h  
 A             liboscar/icquserinfoupdatetask.cpp   [License: LGPL (v2+)]
 A             liboscar/icquserinfoupdatetask.h   [License: LGPL (v2+)]
Comment 3 Roman Jarosz 2006-10-19 20:24:00 UTC
SVN commit 597238 by rjarosz:

Add support for editing ICQWorkUserInfo.

CCBUG: 120588



 M  +66 -19    icq/ui/icquserinfowidget.cpp  
 M  +2 -0      icq/ui/icquserinfowidget.h  
 M  +136 -90   icq/ui/icqworkinfowidget.ui  
 M  +85 -2     liboscar/icquserinfo.cpp  
 M  +13 -12    liboscar/icquserinfo.h  
Comment 4 Roman Jarosz 2006-10-19 22:14:38 UTC
SVN commit 597286 by rjarosz:

Add support for editing ICQOrgAffInfo.

CCBUG: 120588



 M  +51 -27    icq/ui/icqorgaffinfowidget.ui  
 M  +146 -35   icq/ui/icquserinfowidget.cpp  
 M  +9 -0      icq/ui/icquserinfowidget.h  
 M  +67 -0     liboscar/icquserinfo.cpp  
 M  +13 -12    liboscar/icquserinfo.h  
Comment 5 Roman Jarosz 2006-10-20 00:01:40 UTC
SVN commit 597312 by rjarosz:

Add support for editing ICQInterestInfo.

CCBUG: 120588



 M  +2 -1      icq/icqprotocol.cpp  
 M  +18 -34    icq/ui/icqinterestinfowidget.ui  
 M  +91 -21    icq/ui/icquserinfowidget.cpp  
 M  +8 -1      icq/ui/icquserinfowidget.h  
 M  +30 -3     liboscar/icquserinfo.cpp  
 M  +3 -3      liboscar/icquserinfo.h  


--- trunk/KDE/kdenetwork/kopete/protocols/oscar/icq/icqprotocol.cpp #597311:597312
@@ -658,10 +658,11 @@
 	mInterests.insert(133, i18n("Social science"));
 	mInterests.insert(134, i18n("60's"));
 	mInterests.insert(135, i18n("70's"));
-	mInterests.insert(136, i18n("40's"));
+	mInterests.insert(136, i18n("80's"));
 	mInterests.insert(137, i18n("50's"));
 	mInterests.insert(138, i18n("Finance and Corporate"));
 	mInterests.insert(139, i18n("Entertainment"));
+	mInterests.insert(140, i18n("Consumer Electronics"));
 	mInterests.insert(141, i18n("Retail Stores"));
 	mInterests.insert(142, i18n("Health and Beauty"));
 	mInterests.insert(143, i18n("Media"));
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/icq/ui/icqinterestinfowidget.ui #597311:597312
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>376</width>
-    <height>249</height>
+    <height>193</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" >
@@ -28,6 +28,9 @@
       <property name="spacing" >
        <number>6</number>
       </property>
+      <item row="0" column="0" >
+       <widget class="QComboBox" name="topic1Combo" />
+      </item>
       <item row="0" column="1" >
        <widget class="QLineEdit" name="desc1" >
         <property name="readOnly" >
@@ -35,20 +38,19 @@
         </property>
        </widget>
       </item>
-      <item row="3" column="0" >
-       <widget class="QLineEdit" name="topic4" >
-        <property name="readOnly" >
-         <bool>true</bool>
-        </property>
-       </widget>
+      <item row="1" column="0" >
+       <widget class="QComboBox" name="topic2Combo" />
       </item>
-      <item row="0" column="0" >
-       <widget class="QLineEdit" name="topic1" >
+      <item row="1" column="1" >
+       <widget class="QLineEdit" name="desc2" >
         <property name="readOnly" >
          <bool>true</bool>
         </property>
        </widget>
       </item>
+      <item row="2" column="0" >
+       <widget class="QComboBox" name="topic3Combo" />
+      </item>
       <item row="2" column="1" >
        <widget class="QLineEdit" name="desc3" >
         <property name="readOnly" >
@@ -56,6 +58,9 @@
         </property>
        </widget>
       </item>
+      <item row="3" column="0" >
+       <widget class="QComboBox" name="topic4Combo" />
+      </item>
       <item row="3" column="1" >
        <widget class="QLineEdit" name="desc4" >
         <property name="readOnly" >
@@ -63,27 +68,6 @@
         </property>
        </widget>
       </item>
-      <item row="2" column="0" >
-       <widget class="QLineEdit" name="topic3" >
-        <property name="readOnly" >
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1" >
-       <widget class="QLineEdit" name="desc2" >
-        <property name="readOnly" >
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0" >
-       <widget class="QLineEdit" name="topic2" >
-        <property name="readOnly" >
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
      </layout>
     </widget>
    </item>
@@ -108,13 +92,13 @@
  <layoutdefault spacing="6" margin="11" />
  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
  <tabstops>
-  <tabstop>topic1</tabstop>
+  <tabstop>topic1Combo</tabstop>
   <tabstop>desc1</tabstop>
-  <tabstop>topic2</tabstop>
+  <tabstop>topic2Combo</tabstop>
   <tabstop>desc2</tabstop>
-  <tabstop>topic3</tabstop>
+  <tabstop>topic3Combo</tabstop>
   <tabstop>desc3</tabstop>
-  <tabstop>topic4</tabstop>
+  <tabstop>topic4Combo</tabstop>
   <tabstop>desc4</tabstop>
  </tabstops>
  <resources/>
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/icq/ui/icquserinfowidget.cpp #597311:597312
@@ -110,6 +110,11 @@
 	connect( m_orgAffInfoWidget->aff2CategoryCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotAff2CategoryChanged(int)) );
 	connect( m_orgAffInfoWidget->aff3CategoryCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotAff3CategoryChanged(int)) );
 
+	connect( m_interestInfoWidget->topic1Combo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotInterestTopic1Changed(int)) );
+	connect( m_interestInfoWidget->topic2Combo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotInterestTopic2Changed(int)) );
+	connect( m_interestInfoWidget->topic3Combo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotInterestTopic3Changed(int)) );
+	connect( m_interestInfoWidget->topic4Combo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotInterestTopic4Changed(int)) );
+
 	//ICQGeneralUserInfo
 	m_genInfoWidget->nickNameEdit->setReadOnly( !m_editable );
 	m_genInfoWidget->firstNameEdit->setReadOnly( !m_editable );
@@ -148,6 +153,11 @@
 	m_orgAffInfoWidget->aff1KeywordEdit->setReadOnly( !m_editable );
 	m_orgAffInfoWidget->aff2KeywordEdit->setReadOnly( !m_editable );
 	m_orgAffInfoWidget->aff3KeywordEdit->setReadOnly( !m_editable );
+
+	m_interestInfoWidget->desc1->setReadOnly( !m_editable );
+	m_interestInfoWidget->desc2->setReadOnly( !m_editable );
+	m_interestInfoWidget->desc3->setReadOnly( !m_editable );
+	m_interestInfoWidget->desc4->setReadOnly( !m_editable );
 }
 
 ICQUserInfoWidget::~ ICQUserInfoWidget()
@@ -251,6 +261,18 @@
 		m_orgAffInfoWidget->aff3CategoryCombo->addItem( it.key(), it.value() );
 	}
 
+	//Interests
+	sortedMap = reverseMap( icqProtocol->interests() );
+	it = sortedMap;
+	while ( it.hasNext() )
+	{
+		it.next();
+		m_interestInfoWidget->topic1Combo->addItem( it.key(), it.value() );
+		m_interestInfoWidget->topic2Combo->addItem( it.key(), it.value() );
+		m_interestInfoWidget->topic3Combo->addItem( it.key(), it.value() );
+		m_interestInfoWidget->topic4Combo->addItem( it.key(), it.value() );
+	}
+
 	//Timezone
 	QString timezone;
 	for ( int zone = 24; zone >= -24; zone-- )
@@ -275,6 +297,7 @@
 	infoList.append( storeMoreInfo() );
 	infoList.append( storeWorkInfo() );
 	infoList.append( storeOrgAffInfo() );
+	infoList.append( storeInterestInfo() );
 	
 	return infoList;
 }
@@ -343,29 +366,28 @@
 	m_otherInfoWidget->notesEdit->setText( codec->toUnicode( info.notes ) );
 }
 
-void ICQUserInfoWidget::fillInterestInfo( const ICQInterestInfo& info)
+void ICQUserInfoWidget::fillInterestInfo( const ICQInterestInfo& info )
 {
 	QTextCodec* codec = m_contact->contactCodec();
-	if (info.count>0) {
-		QString topic = static_cast<ICQProtocol*>( m_contact->protocol() )->interests()[info.topics[0]];
-		m_interestInfoWidget->topic1->setText( topic );
-		m_interestInfoWidget->desc1->setText( codec->toUnicode( info.descriptions[0] ) );
-	}
-	if (info.count>1) {
-		QString topic = static_cast<ICQProtocol*>( m_contact->protocol() )->interests()[info.topics[1]];
-		m_interestInfoWidget->topic2->setText( topic );
-		m_interestInfoWidget->desc2->setText( codec->toUnicode( info.descriptions[1] ) );
-	}
-	if (info.count>2) {
-		QString topic = static_cast<ICQProtocol*>( m_contact->protocol() )->interests()[info.topics[2]];
-		m_interestInfoWidget->topic3->setText( topic );
-		m_interestInfoWidget->desc3->setText( codec->toUnicode( info.descriptions[2] ) );
-	}
-	if (info.count>3) {
-		QString topic = static_cast<ICQProtocol*>( m_contact->protocol() )->interests()[info.topics[3]];
-		m_interestInfoWidget->topic4->setText( topic );
-		m_interestInfoWidget->desc4->setText( codec->toUnicode( info.descriptions[3] ) );
-	}
+
+	if ( m_editable )
+		m_interestInfo = info;
+
+	int index = m_interestInfoWidget->topic1Combo->findData( info.topics[0].get() );
+	m_interestInfoWidget->topic1Combo->setCurrentIndex( index );
+	m_interestInfoWidget->desc1->setText( codec->toUnicode( info.descriptions[0].get() ) );
+
+	index = m_interestInfoWidget->topic2Combo->findData( info.topics[1].get() );
+	m_interestInfoWidget->topic2Combo->setCurrentIndex( index );
+	m_interestInfoWidget->desc2->setText( codec->toUnicode( info.descriptions[1].get() ) );
+
+	index = m_interestInfoWidget->topic3Combo->findData( info.topics[2].get() );
+	m_interestInfoWidget->topic3Combo->setCurrentIndex( index );
+	m_interestInfoWidget->desc3->setText( codec->toUnicode( info.descriptions[2].get() ) );
+
+	index = m_interestInfoWidget->topic4Combo->findData( info.topics[3].get() );
+	m_interestInfoWidget->topic4Combo->setCurrentIndex( index );
+	m_interestInfoWidget->desc4->setText( codec->toUnicode( info.descriptions[3].get() ) );
 }
 
 void ICQUserInfoWidget::fillOrgAffInfo( const ICQOrgAffInfo& info )
@@ -501,6 +523,30 @@
 	m_orgAffInfoWidget->aff3KeywordEdit->setEnabled( enable );
 }
 
+void ICQUserInfoWidget::slotInterestTopic1Changed( int index )
+{
+	bool enable = !( m_interestInfoWidget->topic1Combo->itemData( index ).toInt() == 0 );
+	m_interestInfoWidget->desc1->setEnabled( enable );
+}
+
+void ICQUserInfoWidget::slotInterestTopic2Changed( int index )
+{
+	bool enable = !( m_interestInfoWidget->topic2Combo->itemData( index ).toInt() == 0 );
+	m_interestInfoWidget->desc2->setEnabled( enable );
+}
+
+void ICQUserInfoWidget::slotInterestTopic3Changed( int index )
+{
+	bool enable = !( m_interestInfoWidget->topic3Combo->itemData( index ).toInt() == 0 );
+	m_interestInfoWidget->desc3->setEnabled( enable );
+}
+
+void ICQUserInfoWidget::slotInterestTopic4Changed( int index )
+{
+	bool enable = !( m_interestInfoWidget->topic4Combo->itemData( index ).toInt() == 0 );
+	m_interestInfoWidget->desc4->setEnabled( enable );
+}
+
 ICQGeneralUserInfo* ICQUserInfoWidget::storeBasicInfo() const
 {
 	QTextCodec* codec = m_contact->contactCodec();
@@ -622,6 +668,30 @@
 	return info;
 }
 
+ICQInterestInfo* ICQUserInfoWidget::storeInterestInfo() const
+{
+	QTextCodec* codec = m_contact->contactCodec();
+	ICQInterestInfo* info = new ICQInterestInfo( m_interestInfo );
+
+	int index = m_interestInfoWidget->topic1Combo->currentIndex();
+	info->topics[0].set( m_interestInfoWidget->topic1Combo->itemData( index ).toInt() );
+	info->descriptions[0].set( codec->fromUnicode( m_interestInfoWidget->desc1->text() ) );
+
+	index = m_interestInfoWidget->topic2Combo->currentIndex();
+	info->topics[1].set( m_interestInfoWidget->topic2Combo->itemData( index ).toInt() );
+	info->descriptions[1].set( codec->fromUnicode( m_interestInfoWidget->desc2->text() ) );
+
+	index = m_interestInfoWidget->topic3Combo->currentIndex();
+	info->topics[2].set( m_interestInfoWidget->topic3Combo->itemData( index ).toInt() );
+	info->descriptions[2].set( codec->fromUnicode( m_interestInfoWidget->desc3->text() ) );
+
+	index = m_interestInfoWidget->topic4Combo->currentIndex();
+	info->topics[3].set( m_interestInfoWidget->topic4Combo->itemData( index ).toInt() );
+	info->descriptions[3].set( codec->fromUnicode( m_interestInfoWidget->desc4->text() ) );
+
+	return info;
+}
+
 QMap<QString, int> ICQUserInfoWidget::reverseMap( const QMap<int, QString>& map ) const
 {
 	QMap<QString, int> revMap;
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/icq/ui/icquserinfowidget.h #597311:597312
@@ -65,12 +65,18 @@
 	void slotAff1CategoryChanged( int index );
 	void slotAff2CategoryChanged( int index );
 	void slotAff3CategoryChanged( int index );
-	
+
+	void slotInterestTopic1Changed( int index );
+	void slotInterestTopic2Changed( int index );
+	void slotInterestTopic3Changed( int index );
+	void slotInterestTopic4Changed( int index );
+
 private:
 	ICQGeneralUserInfo* storeBasicInfo() const;
 	ICQMoreUserInfo* storeMoreInfo() const;
 	ICQWorkUserInfo* storeWorkInfo() const;
 	ICQOrgAffInfo* storeOrgAffInfo() const;
+	ICQInterestInfo* storeInterestInfo() const;
 
 	QMap<QString, int> reverseMap( const QMap<int, QString>& map ) const;
 
@@ -89,6 +95,7 @@
 	ICQMoreUserInfo m_moreUserInfo;
 	ICQWorkUserInfo m_workUserInfo;
 	ICQOrgAffInfo m_orgAffUserInfo;
+	ICQInterestInfo m_interestInfo;
 };
 
 #endif
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/icquserinfo.cpp #597311:597312
@@ -419,14 +419,15 @@
 
 ICQInterestInfo::ICQInterestInfo()
 {
-	count=0;
+	for ( int i = 0; i < 4; i++ )
+		topics[i] = 0;
 }
 
 void ICQInterestInfo::fill( Buffer* buffer )
 {
 	if ( buffer->getByte() == 0x0A )
 	{
-		count=0; //valid interests
+		int count=0; //valid interests
 		int len= buffer->getByte();  //interests we get
 		for ( int i = 0; i < len; i++ )
 		{
@@ -436,7 +437,6 @@
 				if (count<4) { //i think this could not happen, i have never seen more
 					topics[count]=t;
 					descriptions[count]=d;
-					kDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "got topic: "<<topics[count]<<" desc: " << topics[count] << endl;
 					count++;
 				} else {
 					kDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "got more than four interest infos" << endl;
@@ -449,6 +449,33 @@
 		kDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Couldn't parse ICQ interest user info packet" << endl;
 }
 
+void ICQInterestInfo::store( Buffer* buffer )
+{
+	bool hasChanged = false;
+	for ( int i = 0; i < 4; i++ )
+	{
+		if ( topics[i].hasChanged() || descriptions[i].hasChanged() )
+		{
+			hasChanged = true;
+			break;
+		}
+	}
+
+	if ( hasChanged )
+	{
+		for ( int i = 0; i < 4; i++ )
+		{
+			if ( topics[i].get() != 0 )
+			{
+				Buffer buf;
+				buf.addLEWord( topics[i].get() );
+				buf.addLELNTS( descriptions[i].get() );
+				buffer->addLETLV( 0x01EA, buf );
+			}
+		}
+	}
+}
+
 ICQOrgAffInfo::ICQOrgAffInfo()
 {
 	org1Category.init( 0 );
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/icquserinfo.h #597311:597312
@@ -172,11 +172,11 @@
 	ICQInterestInfo();
 	~ICQInterestInfo() {}
 	void fill( Buffer* buffer );
+	void store( Buffer* buffer );
 	
 public:
-	int count;
-	int topics[4];
-	QByteArray descriptions[4];
+	ICQInfoValue<int> topics[4];
+	ICQInfoValue<QByteArray> descriptions[4];
 };
 
 class KOPETE_EXPORT ICQOrgAffInfo : public ICQInfoBase
Comment 6 Roman Jarosz 2006-10-24 00:26:31 UTC
SVN commit 598552 by rjarosz:

Add support for editing ICQEmailInfo and ICQNotesInfo.
All user info classes are implemented :)

CCBUG: 120588



 M  +4 -30     icq/ui/icqhomeinfowidget.ui  
 M  +100 -16   icq/ui/icqotherinfowidget.ui  
 M  +246 -15   icq/ui/icquserinfowidget.cpp  
 M  +16 -3     icq/ui/icquserinfowidget.h  
 M  +48 -14    liboscar/icquserinfo.cpp  
 M  +16 -3     liboscar/icquserinfo.h  
Comment 7 Marcel Partap 2007-05-04 22:22:39 UTC
has this feature been removed recently? because I can not find any setting to change my ICQ profile, not in the properties or anywhere else...? regards.
Comment 8 Roman Jarosz 2007-05-04 23:55:18 UTC
No it hasn't been removed, it's in trunk and it will be in Kopete 1.0 (KDE4)