Matt Rogers schrieb:
> On Thursday 04 October 2007 06:11:14 Dennis Nienhüser wrote:
>   
>> Hi,
>>
>> when I used the account manager the first time it confused me quite a
>> bit. I think we could improve the first time experience with some simple
>> usability tweaks. I made a first mockup showing things that bother me
>> and how they could be improved, see
>> http://dev.gentoo.org/~earthwings/misc/am.png
>> Please leave some comments.
>>
>> Dennis
>>     
>
> Looks great. I say go ahead and implement this and send in the patch and 
> we'll 
> get it committed. :)
>   
Sounds good, patch is attached. It's a bit longer this time because I
also added the context menu, which required some refactoring prior to
this to have KActions do the job for less duplication.

I changed the following behavior:
- You can only switch identities if you have more than one
- You cannot delete the default identity anymore. This is especially
useful to avoid removing the last identity which contains accounts,
otherwise a non-completable dialog pops up.

Please test whether I broke something when trying to fix these things:
- When removing an identity containing accounts, the TreeWidget lost
them. I added another load() call in the end of the function to avoid that
- Account status changes were not displayed as the tree widget was
searched flat (I guess it was a list before)

It's still possible to drag 'n drop an account to the virtual tree root.
I think it's ok for now though (identity is kept, it's only visually
annoying). In the long run, a switch to MVC would be best and fix this
as a side-effect.

Screenshot is at http://dev.gentoo.org/~earthwings/misc/am1.png

Regards,
Dennis

Index: kopete/config/accounts/kopeteaccountconfig.h
===================================================================
--- kopete/config/accounts/kopeteaccountconfig.h	(revision 721318)
+++ kopete/config/accounts/kopeteaccountconfig.h	(working copy)
@@ -37,6 +37,8 @@
 
 class KopeteAccountLVI;
 class KopeteIdentityLVI;
+class KMenu;
+class KAction;
 
 /**
  * @author Olivier Goffart <[EMAIL PROTECTED]>
@@ -48,6 +50,9 @@
 public:
 	KopeteAccountConfig(QWidget *parent, const QStringList &args );
 
+protected:
+	virtual void contextMenuEvent ( QContextMenuEvent * event );
+
 public slots:
 	virtual void save();
 	virtual void load();
@@ -57,19 +62,40 @@
 	KopeteIdentityLVI* selectedIdentity();
 	Kopete::OnlineStatus mStatus;
 	
-	void editAccount(Kopete::Account *);
-	void editIdentity(Kopete::Identity *);
+	void configureActions();
+	void configureMenus();
+
+	void modifyAccount(Kopete::Account *);
+	void modifyIdentity(Kopete::Identity *);
 	void removeAccount(KopeteAccountLVI *);
 	void removeIdentity(KopeteIdentityLVI *);
+
 	bool m_protected;
 
+	KMenu *m_identityContextMenu;
+	KMenu *m_accountContextMenu;
+
+	KAction *m_actionAccountAdd;
+	KAction *m_actionAccountModify;
+	KAction *m_actionAccountRemove;
+	KAction *m_actionAccountSwitchIdentity;
+
+	KAction *m_actionIdentityAdd;
+	KAction *m_actionIdentityModify;
+	KAction *m_actionIdentityRemove;
+	KAction *m_actionIdentitySetDefault;
+
 private slots:
-	void slotRemove();
-	void slotEdit();
-	void slotSelectIdentity();
+	void slotModify();
+
 	void slotAddAccount();
+	void slotRemoveAccount();
+	void slotAccountSwitchIdentity();
+
+	void slotAddIdentity();
+	void slotRemoveIdentity();
 	void slotSetDefaultIdentity();
-	void slotAddIdentity();
+
 	void slotAddWizardDone();
 	void slotItemSelected();
 	void slotOnlineStatusChanged( Kopete::Contact *contact,
Index: kopete/config/accounts/kopeteaccountconfigbase.ui
===================================================================
--- kopete/config/accounts/kopeteaccountconfigbase.ui	(revision 721318)
+++ kopete/config/accounts/kopeteaccountconfigbase.ui	(working copy)
@@ -6,19 +6,22 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>350</width>
-    <height>324</height>
+    <width>403</width>
+    <height>465</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Manage Accounts</string>
   </property>
-  <layout class="QHBoxLayout" >
-   <item>
+  <layout class="QGridLayout" >
+   <item rowspan="3" row="0" column="0" >
     <widget class="QTreeWidget" name="mAccountList" >
      <property name="acceptDrops" >
       <bool>true</bool>
      </property>
+     <property name="whatsThis" >
+      <string>This widget shows your identities and accounts in a hierarchical view. Each configured identity shows its associated accounts.</string>
+     </property>
      <property name="dragEnabled" >
       <bool>true</bool>
      </property>
@@ -55,88 +58,138 @@
      </column>
     </widget>
    </item>
-   <item>
-    <layout class="QVBoxLayout" >
-     <item>
-      <widget class="QPushButton" name="mButtonNew" >
-       <property name="toolTip" >
-        <string>Add new account</string>
-       </property>
-       <property name="text" >
-        <string>&amp;Add Account</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="mButtonRemove" >
-       <property name="toolTip" >
-        <string>Remove selected account</string>
-       </property>
-       <property name="whatsThis" >
-        <string>Remove selected account</string>
-       </property>
-       <property name="text" >
-        <string>&amp;Remove</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="mButtonNewIdentity" >
-       <property name="text" >
-        <string>&amp;New Identity</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer>
-       <property name="orientation" >
-        <enum>Qt::Vertical</enum>
-       </property>
-       <property name="sizeHint" >
-        <size>
-         <width>20</width>
-         <height>111</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QPushButton" name="mButtonDefault" >
-       <property name="text" >
-        <string>Set &amp;Default</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="mButtonIdentity" >
-       <property name="text" >
-        <string>Change &amp;Identity...</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="mButtonEdit" >
-       <property name="toolTip" >
-        <string>Modify selected account</string>
-       </property>
-       <property name="whatsThis" >
-        <string>Let you edit the account's properties.</string>
-       </property>
-       <property name="text" >
-        <string>&amp;Modify...</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
+   <item row="0" column="1" >
+    <widget class="QGroupBox" name="mGroupBoxAccounts" >
+     <property name="title" >
+      <string>Accounts</string>
+     </property>
+     <layout class="QVBoxLayout" >
+      <item>
+       <widget class="QPushButton" name="mButtonAccountNew" >
+        <property name="toolTip" >
+         <string>Add a new account</string>
+        </property>
+        <property name="text" >
+         <string>&amp;Add</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mButtonAccountRemove" >
+        <property name="toolTip" >
+         <string>Remove selected account</string>
+        </property>
+        <property name="whatsThis" >
+         <string>Remove selected account</string>
+        </property>
+        <property name="text" >
+         <string>&amp;Remove</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mButtonAccountModify" >
+        <property name="toolTip" >
+         <string>Modify selected account</string>
+        </property>
+        <property name="whatsThis" >
+         <string>Let you edit the account's properties.</string>
+        </property>
+        <property name="text" >
+         <string>&amp;Modify</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mButtonAccountSwitchIdentity" >
+        <property name="toolTip" >
+         <string>Associate the selected account with another identity</string>
+        </property>
+        <property name="whatsThis" >
+         <string>Each account is associated with exactly one identity. You can use this button to change the association and switch an account to a different identity</string>
+        </property>
+        <property name="text" >
+         <string>Switch &amp;Identity</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
    </item>
+   <item row="1" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>136</width>
+       <height>161</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="2" column="1" >
+    <widget class="QGroupBox" name="mGroupBoxIdentities" >
+     <property name="title" >
+      <string>Identities</string>
+     </property>
+     <layout class="QVBoxLayout" >
+      <item>
+       <widget class="QPushButton" name="mButtonIdentityAdd" >
+        <property name="toolTip" >
+         <string>Add a new identity</string>
+        </property>
+        <property name="text" >
+         <string>A&amp;dd</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mButtonIdentityRemove" >
+        <property name="toolTip" >
+         <string>Remove selected identity</string>
+        </property>
+        <property name="whatsThis" >
+         <string>Remove selected identity</string>
+        </property>
+        <property name="text" >
+         <string>R&amp;emove</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mButtonIdentityModify" >
+        <property name="toolTip" >
+         <string>Modify selected identity</string>
+        </property>
+        <property name="whatsThis" >
+         <string>Let you edit the account's properties.</string>
+        </property>
+        <property name="text" >
+         <string>M&amp;odify</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mButtonIdentitySetDefault" >
+        <property name="toolTip" >
+         <string>Set the selected identity as default identity</string>
+        </property>
+        <property name="text" >
+         <string>&amp;Set Default</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
   </layout>
  </widget>
  <layoutdefault spacing="6" margin="11" />
  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
  <tabstops>
-  <tabstop>mButtonNew</tabstop>
-  <tabstop>mButtonEdit</tabstop>
-  <tabstop>mButtonRemove</tabstop>
+  <tabstop>mButtonIdentityModify</tabstop>
  </tabstops>
  <resources/>
  <connections/>
Index: kopete/config/accounts/kopeteaccountconfig.cpp
===================================================================
--- kopete/config/accounts/kopeteaccountconfig.cpp	(revision 721318)
+++ kopete/config/accounts/kopeteaccountconfig.cpp	(working copy)
@@ -25,6 +25,7 @@
 #include <QtGui/QBoxLayout>
 #include <QtCore/QPointer>
 #include <QtCore/QTimer>
+#include <QtGui/QContextMenuEvent>
 
 #include <kcolorbutton.h>
 #include <kpushbutton.h>
@@ -35,6 +36,8 @@
 #include <klocale.h>
 #include <kmessagebox.h>
 #include <kicon.h>
+#include <kaction.h>
+#include <kmenu.h>
 
 #include "addaccountwizard.h"
 #include "editaccountwidget.h"
@@ -71,7 +74,6 @@
 		Kopete::Identity *m_identity;
 };
 
-
 typedef KGenericFactory<KopeteAccountConfig, QWidget> KopeteAccountConfigFactory;
 K_EXPORT_COMPONENT_FACTORY( kcm_kopete_accountconfig, KopeteAccountConfigFactory( "kcm_kopete_accountconfig" ) )
 
@@ -84,23 +86,18 @@
 	header->setResizeMode( 1, QHeaderView::ResizeToContents );
 	header->setResizeMode( 0, QHeaderView::Stretch );
 	header->setVisible(false);
+
+	configureActions();
+	configureMenus();
 	
-	mButtonNew->setIcon( KIcon("edit-add") );
-	mButtonRemove->setIcon( KIcon("edit-delete") );
-
-	connect( mButtonNew,    SIGNAL( clicked() ), this, SLOT( slotAddAccount() ) );
-	connect( mButtonNewIdentity,    SIGNAL( clicked() ), this, SLOT( slotAddIdentity() ) );
-	connect( mButtonEdit,   SIGNAL( clicked() ), this, SLOT( slotEdit() ) );
-	connect( mButtonIdentity, SIGNAL( clicked() ), this, SLOT( slotSelectIdentity() ) );
-	connect( mButtonRemove, SIGNAL( clicked() ), this, SLOT( slotRemove() ) );
-	connect( mButtonDefault, SIGNAL( clicked() ), this, SLOT( slotSetDefaultIdentity() ) );
 	connect( mAccountList,  SIGNAL( itemSelectionChanged() ), this, SLOT( slotItemSelected() ) );
-	connect( mAccountList,  SIGNAL( itemDoubleClicked(QTreeWidgetItem*, int) ), this, SLOT( slotEdit() ) );
+	connect( mAccountList,  SIGNAL( itemDoubleClicked(QTreeWidgetItem*, int) ), this, SLOT( slotModify() ) );
 	connect( mAccountList,  SIGNAL( itemChanged ( QTreeWidgetItem * , int )), this, SLOT( slotItemChanged(QTreeWidgetItem*) ) );
 	setButtons( Help );
 	load();
 }
 
+
 KopeteAccountLVI* KopeteAccountConfig::selectedAccount()
 {
 	QList<QTreeWidgetItem*> selectedItems = mAccountList->selectedItems();
@@ -141,10 +138,10 @@
 void KopeteAccountConfig::load()
 {
 	mAccountList->clear();
-	
+
 	//FIXME: this doesn't work
 	mAccountList->invisibleRootItem()->setFlags(mAccountList->invisibleRootItem()->flags() & ~Qt::ItemIsDropEnabled);
-		
+
 	QHash<Kopete::Identity *,QTreeWidgetItem *> identityItemHash;
 	Kopete::Identity *defaultIdentity = Kopete::IdentityManager::self()->defaultIdentity();
 	foreach(Kopete::Identity *i, Kopete::IdentityManager::self()->identities())
@@ -200,45 +197,52 @@
 
 void KopeteAccountConfig::slotItemSelected()
 {
+	// FIXME: What is m_protected for? It's only used in this function and never read
 	m_protected=true;
 
 	bool accountSelected = selectedAccount();
+	bool hasMultipleIdentities ( Kopete::IdentityManager::self()->identities().size() > 1 );
+	mButtonAccountModify->setEnabled( accountSelected );
+	mButtonAccountRemove->setEnabled( accountSelected );
+	m_actionAccountSwitchIdentity->setEnabled( accountSelected && hasMultipleIdentities );
+	mButtonAccountSwitchIdentity->setEnabled( m_actionAccountSwitchIdentity->isEnabled() );
+
 	bool identitySelected = selectedIdentity();
+	bool isDefaultIdentity = (identitySelected && Kopete::IdentityManager::self()->defaultIdentity() == selectedIdentity()->identity());
+	mButtonIdentityModify->setEnabled( identitySelected );
+	m_actionIdentityRemove->setEnabled( identitySelected && !isDefaultIdentity );
+	mButtonIdentityRemove->setEnabled( m_actionIdentityRemove->isEnabled() );
+	m_actionIdentitySetDefault->setEnabled( identitySelected && !isDefaultIdentity );
+	mButtonIdentitySetDefault->setEnabled( m_actionIdentitySetDefault->isEnabled() );
 
-	mButtonEdit->setEnabled( accountSelected || identitySelected );
-	mButtonRemove->setEnabled( accountSelected || identitySelected );
-	mButtonIdentity->setEnabled( accountSelected );
-	mButtonDefault->setEnabled( identitySelected );
-
 	m_protected=false;
 }
 
 void KopeteAccountConfig::slotAddAccount()
 {
-	AddAccountWizard *m_addwizard = new AddAccountWizard( this, true );
-	connect( m_addwizard, SIGNAL(finished()), this, SLOT(slotAddWizardDone()) );
-	m_addwizard->show();
+	AddAccountWizard *addwizard = new AddAccountWizard( this, true );
+	connect( addwizard, SIGNAL(finished()), this, SLOT(slotAddWizardDone()) );
+	addwizard->show();
 }
 
-void KopeteAccountConfig::slotEdit()
+void KopeteAccountConfig::slotModify()
 {
 	KopeteAccountLVI *alvi = selectedAccount();
 	KopeteIdentityLVI *ilvi = selectedIdentity();
 	
+	if ( ilvi && ilvi->identity() )
+		return modifyIdentity( ilvi->identity() );
+
 	if ( alvi && alvi->account() )
-		return editAccount( alvi->account() );
-	
-	if ( ilvi && ilvi->identity() )
-		return editIdentity( ilvi->identity() );
+		return modifyAccount( alvi->account() );	
 }
-	
-	
-void KopeteAccountConfig::editAccount(Kopete::Account *account)
+
+void KopeteAccountConfig::modifyAccount(Kopete::Account *account)
 {
 	Kopete::Protocol *proto = account->protocol();
 
 	KDialog editDialog ( this );
-	editDialog.setCaption( i18n("Edit Account" ) );
+	editDialog.setCaption( i18n("Modify Account" ) );
 	editDialog.setButtons( KDialog::Ok | KDialog::Cancel );
 	editDialog.setDefaultButton(KDialog::Ok);
 	editDialog.showButtonSeparator(true);
@@ -268,8 +272,7 @@
 	Kopete::AccountManager::self()->save();
 }
 
-
-void KopeteAccountConfig::editIdentity(Kopete::Identity *)
+void KopeteAccountConfig::modifyIdentity(Kopete::Identity *)
 {
 	KopeteIdentityLVI *lvi = selectedIdentity();
 	
@@ -285,20 +288,22 @@
 	Kopete::IdentityManager::self()->save();
 }
 
-
-void KopeteAccountConfig::slotRemove()
+void KopeteAccountConfig::slotRemoveAccount()
 {
 	KopeteAccountLVI *alvi = selectedAccount();
-	KopeteIdentityLVI *ilvi = selectedIdentity();
 	
 	if ( alvi && alvi->account() )
 		return removeAccount( alvi );
+}	
+
+void KopeteAccountConfig::slotRemoveIdentity()
+{
+	KopeteIdentityLVI *ilvi = selectedIdentity();
 	
 	if ( ilvi && ilvi->identity() )
 		return removeIdentity( ilvi );
+}
 
-}	
-	
 void KopeteAccountConfig::removeAccount(KopeteAccountLVI *lvi)
 {
 	Kopete::Account *i = lvi->account();
@@ -338,9 +343,12 @@
 	}
 	// if we removed the default identity, this will trigger an update
 	Kopete::IdentityManager::self()->defaultIdentity();
+
+	// To be sure that accounts with relocated identities appear, reload
+	load();
 }
 
-void KopeteAccountConfig::slotSelectIdentity()
+void KopeteAccountConfig::slotAccountSwitchIdentity()
 {
 	KopeteAccountLVI *lvi = selectedAccount();
 	
@@ -381,13 +389,11 @@
 	load();
 }
 
-
-void KopeteAccountConfig::slotOnlineStatusChanged( Kopete::Contact *contact,
-												   const Kopete::OnlineStatus &status, 
-												   const Kopete::OnlineStatus &oldStatus )
+void KopeteAccountConfig::slotOnlineStatusChanged( Kopete::Contact *contact, const Kopete::OnlineStatus &newStatus, 
+const Kopete::OnlineStatus &oldStatus )
 {
 	//get all items
-	QList<QTreeWidgetItem*> items = mAccountList->findItems("", Qt::MatchContains);
+	QList<QTreeWidgetItem*> items = mAccountList->findItems("", Qt::MatchContains | Qt::MatchRecursive );
 	QList<QTreeWidgetItem*>::iterator it;
 	for (it = items.begin(); it != items.end(); ++it)
 	{
@@ -397,8 +403,8 @@
 
 		if (i->account()->myself() == contact)
 		{
-			(*it)->setIcon( 0, QIcon(status.iconFor(i->account(), 32)) );
-			(*it)->setText( 1, contact->onlineStatus().statusTypeToString(status.status()) );
+			(*it)->setIcon( 0, QIcon(newStatus.iconFor(i->account(), 32)) );
+			(*it)->setText( 1, contact->onlineStatus().statusTypeToString(newStatus.status()) );
 			break;
 		}
 	}
@@ -411,7 +417,6 @@
 	load();
 }
 
-
 void KopeteAccountConfig::slotItemChanged(QTreeWidgetItem* item)
 {
 	if(!item)
@@ -428,7 +433,104 @@
 	}
 }
 
+void KopeteAccountConfig::contextMenuEvent ( QContextMenuEvent * event )
+{	
+	KopeteIdentityLVI *ilvi = selectedIdentity();
+	if ( ilvi && ilvi->identity() )
+	{
+		m_identityContextMenu->popup(event->globalPos());
+	}
 
+	KopeteAccountLVI *alvi = selectedAccount();
+	if ( alvi && alvi->account() )
+	{
+		m_accountContextMenu->popup(event->globalPos());
+	}
+}
+
+void KopeteAccountConfig::configureActions()
+{
+	// Add account
+	m_actionAccountAdd = new KAction( i18n( "&Add Account" ), this );
+	m_actionAccountAdd->setIcon( KIcon("edit-add") );
+	mButtonAccountNew->setIcon( m_actionAccountAdd->icon() );
+	mButtonAccountNew->setText( m_actionAccountAdd->text() );
+	connect ( m_actionAccountAdd, SIGNAL ( triggered ( bool ) ), this, SLOT ( slotAddAccount() ) );
+	connect( mButtonAccountNew, SIGNAL( clicked() ), m_actionAccountAdd, SLOT( trigger() ) );
+
+	// Modify account
+	m_actionAccountModify = new KAction( i18n( "&Modify Account" ), this );
+	m_actionAccountModify->setIcon( KIcon("configure") );
+	mButtonAccountModify->setIcon( m_actionAccountModify->icon() );
+	mButtonAccountModify->setText( m_actionAccountModify->text() );
+	connect ( m_actionAccountModify, SIGNAL ( triggered ( bool ) ), this, SLOT ( slotModify() ) );
+	connect( mButtonAccountModify, SIGNAL( clicked() ), m_actionAccountModify, SLOT( trigger() ) );
+
+	// Remove account
+	m_actionAccountRemove = new KAction( i18n( "&Remove Account" ), this );
+	m_actionAccountRemove->setIcon( KIcon("edit-delete") );
+	m_actionAccountRemove->setShortcut(KShortcut(Qt::Key_Delete));
+	mButtonAccountRemove->setIcon( m_actionAccountRemove->icon() );
+	mButtonAccountRemove->setText( m_actionAccountRemove->text() );
+	connect ( m_actionAccountRemove, SIGNAL ( triggered ( bool ) ), this, SLOT ( slotRemoveAccount() ) );
+	connect( mButtonAccountRemove, SIGNAL( clicked() ), m_actionAccountRemove, SLOT( trigger() ) );
+
+	// Switch identity for an account
+	m_actionAccountSwitchIdentity = new KAction( i18n( "&Switch Identity" ), this );
+	mButtonAccountSwitchIdentity->setText( m_actionAccountSwitchIdentity->text() );
+	connect ( m_actionAccountSwitchIdentity, SIGNAL ( triggered ( bool ) ), this, SLOT ( slotAccountSwitchIdentity() ) );
+	connect( mButtonAccountSwitchIdentity, SIGNAL( clicked() ), m_actionAccountSwitchIdentity, SLOT( trigger() ) );
+
+	// Add identity
+	m_actionIdentityAdd = new KAction( i18n( "Add &Identity" ), this );
+	m_actionIdentityAdd->setIcon( KIcon("edit-add") );
+	mButtonIdentityAdd->setIcon( m_actionIdentityAdd->icon() );
+	mButtonIdentityAdd->setText( m_actionIdentityAdd->text() );
+	connect ( m_actionIdentityAdd, SIGNAL ( triggered ( bool ) ), this, SLOT ( slotAddIdentity() ) );
+	connect( mButtonIdentityAdd, SIGNAL( clicked() ), m_actionIdentityAdd, SLOT( trigger() ) );
+
+	// Modify identity
+	m_actionIdentityModify = new KAction( i18n( "M&odify Identity" ), this );
+	m_actionIdentityModify->setIcon( KIcon("configure") );
+	mButtonIdentityModify->setIcon( m_actionIdentityModify->icon() );
+	mButtonIdentityModify->setText( m_actionIdentityModify->text() );
+	connect ( m_actionIdentityModify, SIGNAL ( triggered ( bool ) ), this, SLOT ( slotModify() ) );
+	connect( mButtonIdentityModify, SIGNAL( clicked() ), m_actionIdentityModify, SLOT( trigger() ) );
+
+	// Remove identity
+	m_actionIdentityRemove = new KAction( i18n( "R&emove Identity" ), this );
+	m_actionIdentityRemove->setIcon( KIcon("edit-delete") );
+	mButtonIdentityRemove->setIcon( m_actionIdentityRemove->icon() );
+	mButtonIdentityRemove->setText( m_actionIdentityRemove->text() );
+	connect ( m_actionIdentityRemove, SIGNAL ( triggered ( bool ) ), this, SLOT ( slotRemoveIdentity() ) );
+	connect( mButtonIdentityRemove, SIGNAL( clicked() ), m_actionIdentityRemove, SLOT( trigger() ) );
+
+	// Switch identity for an identity
+	m_actionIdentitySetDefault = new KAction( i18n( "Set &Default" ), this );
+	mButtonIdentitySetDefault->setText( m_actionIdentitySetDefault->text() );
+	connect ( m_actionIdentitySetDefault, SIGNAL ( triggered ( bool ) ), this, SLOT ( slotSetDefaultIdentity() ) );
+	connect( mButtonIdentitySetDefault, SIGNAL( clicked() ), m_actionIdentitySetDefault, SLOT( trigger() ) );
+}
+
+void KopeteAccountConfig::configureMenus()
+{
+	// Account management context menu
+	m_accountContextMenu = new KMenu ( this );
+	m_accountContextMenu->addTitle( i18n( "Account Management" ) );
+	m_accountContextMenu->addAction( m_actionAccountModify );
+	m_accountContextMenu->addAction( m_actionAccountRemove );
+
+	// Identity management context menu
+	m_identityContextMenu = new KMenu ( this );
+	m_identityContextMenu->addTitle( i18n( "Identity Management" ) );
+	m_identityContextMenu->addAction( m_actionAccountAdd );
+	m_identityContextMenu->addSeparator();
+	m_identityContextMenu->addAction( m_actionIdentityModify );
+	m_identityContextMenu->addAction( m_actionIdentityRemove );
+	m_identityContextMenu->addAction( m_actionIdentitySetDefault );
+}
+
+
 #include "kopeteaccountconfig.moc"
 
 // vim: set noet ts=4 sts=4 sw=4:
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to