[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kopete
From:       Duncan Mac-Vicar Prett <duncan () kde ! org>
Date:       2007-11-13 20:15:06
Message-ID: 1194984906.299582.7492.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 736273 by dmacvicar:

Various suggestions from #kopete
- use contactAt in data()
- tabs, guards, etc


 M  +2 -2      kopete/chatwindow/chatmemberslistview.h  
 M  +4 -5      kopete/chatwindow/kopetechatwindow.cpp  
 M  +1 -1      kopete/chatwindow/kopetechatwindow.h  
 M  +1 -1      kopete/chatwindow/kopetechatwindow.rc  
 M  +28 -35    libkopete/chatsessionmemberslistmodel.cpp  
 M  +8 -3      libkopete/chatsessionmemberslistmodel.h  


--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/chatmemberslistview.h \
#736272:736273 @@ -15,8 +15,8 @@
     *************************************************************************
 */
 
-#ifndef CHATMEMBERSLISTWIDGET_H
-#define CHATMEMBERSLISTWIDGET_H
+#ifndef CHATMEMBERSLISTVIEW_H
+#define CHATMEMBERSLISTVIEW_H
 
 #include <QListView>
 
--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/kopetechatwindow.cpp #736272:736273
@@ -451,10 +451,9 @@
         coll->addAction( "options_membersright", membersRight );
 	connect( membersRight, SIGNAL(toggled(bool)), this, SLOT(slotViewMembersRight()) );
 
-	toggleMembers = new KToggleAction( i18n( "Show" ), coll );
-        coll->addAction( "options_togglemembers", toggleMembers );
-	toggleMembers->setCheckedState( KGuiItem( i18n("Hide") ) );
-	connect( toggleMembers, SIGNAL(toggled(bool)), this, SLOT(slotToggleViewMembers()) \
); +	toggleMembers = m_participantsWidget->toggleViewAction();
+	toggleMembers->setText(i18n( "Participants" ));
+	coll->addAction( "options_togglemembers", toggleMembers );
 
 	toggleAutoSpellCheck = new KToggleAction( i18n( "Automatic Spell Checking" ), coll \
                );
         coll->addAction( "enable_auto_spell_check", toggleAutoSpellCheck );
@@ -462,7 +461,7 @@
 	connect( toggleAutoSpellCheck, SIGNAL(triggered(bool)), this, \
SLOT(toggleAutoSpellChecking()) );  
 	QAction *toggleParticipantsAction = m_participantsWidget->toggleViewAction( );
-	toggleParticipantsAction->setText( i18n( "Show Participants" ) );
+	toggleParticipantsAction->setText( i18n( "Participants" ) );
 	coll->addAction ( "show_participants_widget", toggleParticipantsAction );
 
 	actionSmileyMenu = new KopeteEmoticonAction( coll );
--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/kopetechatwindow.h #736272:736273
@@ -164,7 +164,7 @@
 
 	KToggleAction* membersLeft;
 	KToggleAction* membersRight;
-	KToggleAction* toggleMembers;
+	QAction* toggleMembers;
 	KToggleAction* toggleAutoSpellCheck;
 
 	KopeteEmoticonAction *actionSmileyMenu;
--- trunk/KDE/kdenetwork/kopete/kopete/chatwindow/kopetechatwindow.rc #736272:736273
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui version="33" name="kopetechatwindow">
+<kpartgui version="34" name="kopetechatwindow">
 	<MenuBar>
 		<Menu noMerge="1" name="file">
 			<text>&amp;Chat</text>
--- trunk/KDE/kdenetwork/kopete/libkopete/chatsessionmemberslistmodel.cpp \
#736272:736273 @@ -45,7 +45,7 @@
 	reset();
 }
 
-Kopete::Contact * ChatSessionMembersListModel::contactAt( const QModelIndex &index )
+Kopete::Contact * ChatSessionMembersListModel::contactAt( const QModelIndex &index ) \
const  {
 	if ( m_session )
 	{
@@ -66,6 +66,7 @@
 
 int ChatSessionMembersListModel::rowCount(const QModelIndex &parent) const
 {
+	Q_UNUSED(parent)
 	if ( m_session )
 		return m_session->members().count() + 1;
 	
@@ -74,41 +75,28 @@
 
 QVariant ChatSessionMembersListModel::data(const QModelIndex &index, int role) const
 {
-	if ( m_session )
-	{
-		if (!index.isValid())
-			return QVariant();
-	
-		if (index.row() >= m_session->members().size() + 1)
-			return QVariant();
-	
-		const Contact *c;
-		if ( index.row() == 0 )
-			c = m_session->myself();
-		else
-			c = m_session->members().at(index.row() - 1);
+	Contact *c = contactAt(index);
+	if (!c)
+		return QVariant();
 
-		if (role == Qt::DisplayRole)
-		{
-			QString nick = c->property(Kopete::Global::Properties::self()->nickName().key()).value().toString();
                
-			if ( nick.isEmpty() )
-				nick = c->contactId();
-			
-			return nick;
-		}
-		else if (role == Qt::DecorationRole)
-		{
-			return c->onlineStatus().iconFor(c);
-		}
-		else if (role == Qt::ToolTipRole)
-		{
-			return c->toolTip();
-		}
-		else
-			return QVariant();
+	if (role == Qt::DisplayRole)
+	{
+		QString nick = c->property(Kopete::Global::Properties::self()->nickName().key()).value().toString();
 +		if ( nick.isEmpty() )
+			nick = c->contactId();
+		
+		return nick;
 	}
-
-	return QVariant();
+	else if (role == Qt::DecorationRole)
+	{
+		return c->onlineStatus().iconFor(c);
+	}
+	else if (role == Qt::ToolTipRole)
+	{
+		return c->toolTip();
+	}
+	else
+		return QVariant();
 }
 
 QVariant ChatSessionMembersListModel::headerData(int section, Qt::Orientation \
orientation, int role) const @@ -124,6 +112,7 @@
 
 void ChatSessionMembersListModel::slotContactAdded( const Kopete::Contact *contact )
 {
+	Q_UNUSED(contact)
 	// NOTE in the future the adding of a contact
   // could be done just for the contact
 	reset();
@@ -131,6 +120,7 @@
 
 void ChatSessionMembersListModel::slotContactRemoved( const Kopete::Contact *contact \
)  {
+	Q_UNUSED(contact)
 	// NOTE in the future the removal of a contact
   // could be done just for the contact
 	reset();
@@ -138,6 +128,8 @@
 
 void ChatSessionMembersListModel::slotContactStatusChanged( Kopete::Contact \
*contact, const Kopete::OnlineStatus &status )  {
+	Q_UNUSED(contact)
+	Q_UNUSED(status)
 	// NOTE in the future the change of a contact
   // could be done just for the contact
 	reset();
@@ -148,4 +140,5 @@
 	reset();
 }
 
-}
\ No newline at end of file
+}
+
--- trunk/KDE/kdenetwork/kopete/libkopete/chatsessionmemberslistmodel.h \
#736272:736273 @@ -15,6 +15,9 @@
     *************************************************************************
 */
 
+#ifndef Kopete_ChatSessionMembersListModel_H
+#define Kopete_ChatSessionMembersListModel_H
+
 #include <QAbstractListModel>
 
 #include "kopetechatsession.h"
@@ -37,7 +40,7 @@
 	QVariant headerData(int section, Qt::Orientation orientation, int role = \
Qt::DisplayRole) const;  Kopete::ChatSession *session() { return m_session; }
 
-	Kopete::Contact *contactAt( const QModelIndex &index );
+	Kopete::Contact *contactAt( const QModelIndex &index ) const;
 public slots:
 	/**
 	 * Called when the ChatSession change for this list (eg. when the tab in the \
KopeteChatWindow is changing) @@ -67,8 +70,8 @@
 	void slotContactStatusChanged( Kopete::Contact *contact, const Kopete::OnlineStatus \
&status );  
 	/**
-   * Called when something in the session changed that requires a full
-   * model reset
+	 * Called when something in the session changed that requires a full
+	 * model reset
 	 */
 	void slotSessionChanged();
 
@@ -79,3 +82,5 @@
 
 }
 
+#endif
+


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic