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

List:       kopete-devel
Subject:    [kopete-devel] Updated: meta-contact changes...
From:       "Michael D. Stemle, Jr." <manchicken () notsosoft ! net>
Date:       2006-07-28 11:29:17
Message-ID: 200607280629.17693.manchicken () notsosoft ! net
[Download RAW message or body]

Okie dokie all, so here are my changes (again ^_^).

What's changed you ask?  Well, per direction from others, 
stealContactsFromMetaContact is no longer a lib function in 
Kopete::MetaContact, but is just another loop in 
kopetecontactlistview.cpp->slotMakeMetaContact().  I also moved the KAction 
for making a meta contact out of KopeteStdAction and it's now just done in 
kopetecontactlistview.cpp.

Anyway, on to the diff!

-- 
~ Michael D. Stemle, Jr. <><
(A)bort, (R)etry, (I)nfluence with large hammer

["20060728-metacontact.svn-diff" (text/x-diff)]

Index: protocols/sms/smscontact.cpp
===================================================================
--- protocols/sms/smscontact.cpp	(revision 567121)
+++ protocols/sms/smscontact.cpp	(working copy)
@@ -20,6 +20,7 @@
 #include <kdebug.h>
 #include <klocale.h>
 #include <kmessagebox.h>
+#include <kactioncollection.h>
 
 #include "kopetechatsessionmanager.h"
 #include "kopeteaccount.h"
@@ -119,13 +120,27 @@
 	new SMSContact(account(), phoneNumber, nickName(), metaContact());
 }
 
-QList<KAction*>* SMSContact::customContextMenuActions()
+KActionCollection* SMSContact::customContextMenuActions(QWidget *parent)
 {
-	QList<KAction*> *m_actionCollection = new QList<KAction*>();
+	KActionCollection *m_actionCollection = new KActionCollection(parent);
+
 	if( !m_actionPrefs )
-		m_actionPrefs = new KAction(i18n("&Contact Settings"), 0, this, SLOT(userPrefs()), \
this, "userPrefs"); +   {
+		m_actionPrefs = new KAction(i18n("&Contact Settings"),
+                                  m_actionCollection,
+                                  "userPrefs");
+   
+//       dynamic_cast<QObject*>(this),
+//          SLOT(userPrefs()),
+//          dynamic_cast<QObject*>(this),
+//          "userPrefs");
+      QObject::connect(m_actionPrefs,
+                       SIGNAL(triggered(bool)),
+                       dynamic_cast<QObject*>(this),
+                       SLOT(userPrefs()));
+   }
 
-	m_actionCollection->append( m_actionPrefs );
+	m_actionCollection->insert( m_actionPrefs );
 
 	return m_actionCollection;
 }
Index: protocols/sms/smsaccount.cpp
===================================================================
--- protocols/sms/smsaccount.cpp	(revision 567121)
+++ protocols/sms/smsaccount.cpp	(working copy)
@@ -184,16 +184,21 @@
 	return theActionMenu;
 }
 
-void SMSAccount::setOnlineStatus( const Kopete::OnlineStatus & status , const \
QString &reason) +void SMSAccount::setOnlineStatus( const Kopete::OnlineStatus & \
status , const Kopete::StatusMessage &reason)  {
 	if ( myself()->onlineStatus().status() == Kopete::OnlineStatus::Offline && \
status.status() == Kopete::OnlineStatus::Online )  connect();
 	else if ( myself()->onlineStatus().status() != Kopete::OnlineStatus::Offline && \
status.status() == Kopete::OnlineStatus::Offline )  disconnect();
 	else if ( myself()->onlineStatus().status() != Kopete::OnlineStatus::Offline && \
                status.status() == Kopete::OnlineStatus::Away )
-		setAway( true, reason );
+		setAway( true, reason.message() );
 }
 
+void SMSAccount::setStatusMessage( const Kopete::StatusMessage& msg )
+{
+   return;
+}
+
 SMSService* SMSAccount::service()
 {
 	return theService;
Index: protocols/sms/smscontact.h
===================================================================
--- protocols/sms/smscontact.h	(revision 567121)
+++ protocols/sms/smscontact.h	(working copy)
@@ -36,7 +36,7 @@
 	SMSContact( Kopete::Account* _account, const QString &phoneNumber,
 		const QString &displayName, Kopete::MetaContact *parent );
 
-	QList<KAction*>* customContextMenuActions();
+	KActionCollection* customContextMenuActions(QWidget *parent);
 
 	const QString &phoneNumber();
 	void setPhoneNumber( const QString phoneNumber );
Index: protocols/sms/smsaccount.h
===================================================================
--- protocols/sms/smsaccount.h	(revision 567121)
+++ protocols/sms/smsaccount.h	(working copy)
@@ -52,7 +52,8 @@
 
 public slots:
 	void loadConfig();
-	void setOnlineStatus( const Kopete::OnlineStatus& status , const QString &reason = \
QString::null); +	void setOnlineStatus( const Kopete::OnlineStatus& status , const \
Kopete::StatusMessage &reason); +   void setStatusMessage( const \
Kopete::StatusMessage& msg );  
 public slots:
 	virtual void connect(const Kopete::OnlineStatus& initial= Kopete::OnlineStatus());
Index: protocols/sms/ui/CMakeLists.txt
===================================================================
--- protocols/sms/ui/CMakeLists.txt	(revision 567121)
+++ protocols/sms/ui/CMakeLists.txt	(working copy)
@@ -3,8 +3,9 @@
 
 
 ########### next target ###############
+set( uiSrcs empty.cpp )
+kde4_add_ui3_files( uiSrcs smsactprefs.ui smsadd.ui smsuserprefs.ui )
 
-
 ########### install files ###############
 
 
Index: protocols/sms/CMakeLists.txt
===================================================================
--- protocols/sms/CMakeLists.txt	(revision 567121)
+++ protocols/sms/CMakeLists.txt	(working copy)
@@ -1,13 +1,19 @@
 
-add_subdirectory( ui ) 
+#add_subdirectory( ui ) 
 add_subdirectory( services ) 
 add_subdirectory( icons ) 
+#include_directories( ui )
 
 
 
-
 ########### next target ###############
 
+set(kopete_sms_ui_SRCS)
+kde4_add_ui3_files ( kopete_sms_ui_SRCS 
+ui/smsactprefs.ui
+ui/smsuserprefs.ui
+ui/smsadd.ui )
+
 set(kopete_sms_PART_SRCS 
    smsaddcontactpage.cpp 
    smscontact.cpp 
Index: protocols/CMakeLists.txt
===================================================================
--- protocols/CMakeLists.txt	(revision 567121)
+++ protocols/CMakeLists.txt	(working copy)
@@ -2,7 +2,7 @@
 
 option(WITH_testbed "Enable Kopete testbed protocol" ON)
 option(WITH_messenger "Enable Kopete MSN/Windows Live Messenger protocol" ON)
-
+#option(WITH_sms "Enable Kopete SMS protocol" ON)
 include_directories(${KOPETE_INCLUDES})
 
 add_subdirectory( msn ) 
@@ -26,6 +26,10 @@
   add_subdirectory( testbed )
 endif(WITH_testbed)
 
+# if(WITH_sms)
+#   add_subdirectory( sms )
+# endif(WITH_sms)
+
 message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: Disabled IRC, Groupwise, SMS and \
Meanwhile for compiling, because they are not ported right now. I leave that to the \
protocol maintainer (-DarkShock)")  
 
Index: kopete/contactlist/kopetecontactlistview.h
===================================================================
--- kopete/contactlist/kopetecontactlistview.h	(revision 567121)
+++ kopete/contactlist/kopetecontactlistview.h	(working copy)
@@ -180,6 +180,8 @@
 
 	void slotTimeout();
 
+	void slotMakeMetaContact();
+
 private:
 	bool mShowAsTree;
 
@@ -206,6 +208,7 @@
 	KAction *actionProperties;
 	KAction *actionUndo;
 	KAction *actionRedo;
+	KAction *actionMakeMetaContact;
 
 	KopeteContactListViewPrivate *d;
 
Index: kopete/contactlist/kopetecontactlistview.cpp
===================================================================
--- kopete/contactlist/kopetecontactlistview.cpp	(revision 567121)
+++ kopete/contactlist/kopetecontactlistview.cpp	(working copy)
@@ -495,6 +495,9 @@
 	actionCopy = new KopeteGroupListAction( i18n( "&Copy To" ), QLatin1String( \
"editcopy" ), 0,  this, SLOT( slotCopyToGroup() ), ac, "contactCopy" );
 
+	actionMakeMetaContact = new KAction(KIcon("move"), i18n("Make Meta Contact"), ac, \
"makeMetaContact"); +    connect (actionMakeMetaContact, SIGNAL(triggered(bool)), \
this, SLOT(slotMakeMetaContact())); +
 	actionRemove = KopeteStdAction::deleteContact( this, SLOT( slotRemove() ),
 		ac, "contactRemove" );
 	actionSendEmail = new KAction( KIcon("mail_generic"), i18n( "Send Email..." ), ac, \
"contactSendEmail" ); @@ -1449,6 +1452,9 @@
 		actionRename->setEnabled(false);
 		actionRemove->setEnabled(contacts.count()+groups.count());
 		actionAddContact->setEnabled(false);
+
+		actionMakeMetaContact->setText(i18n("Make Meta Contact"));
+		actionMakeMetaContact->setEnabled(contacts.count()); // Specifically for multiple \
contacts, not groups.  }
 
 	actionMove->setCurrentItem( -1 );
@@ -1878,7 +1884,6 @@
 	undoTimer.start(10*60*1000);
 }
 
-
 void KopeteContactListView::slotUndo()
 {
 	bool step = false;
@@ -2187,6 +2192,33 @@
 	actionRedo->setEnabled(false);
 }
 
+void KopeteContactListView::slotMakeMetaContact()
+{
+    QList<Kopete::MetaContact*> contacts = \
Kopete::ContactList::self()->selectedMetaContacts(); +    \
QList<Kopete::MetaContact*>::iterator cit, citEnd = contacts.end(); +    \
Kopete::MetaContact * first = (Kopete::MetaContact *) NULL; +
+    // Iterate through the selected contacts.
+    for( cit = contacts.begin(); cit != citEnd; ++cit ) {
+        Kopete::MetaContact* mc = static_cast<Kopete::MetaContact*>(*cit);
+
+        if (!first) {
+            // Grab the first one.
+            first = mc;
+        } else {
+            QList<Kopete::Contact*> foreignList = mc->contacts();
+            QList<Kopete::Contact *>::iterator theContact, stopit = \
foreignList.end(); +            // Have the first of all in the selected contacts \
steal the contacts from all the others. +            for (theContact = \
foreignList.begin(); theContact != stopit; ++theContact) { +                \
Kopete::Contact *one = static_cast<Kopete::Contact*>(*theContact); +                \
one->setMetaContact(first); +            }
+        }
+    }
+
+    return;
+}
+
 #include "kopetecontactlistview.moc"
 
 // vim: set noet ts=4 sts=4 sw=4:
Index: kopete/kopeteui.rc
===================================================================
--- kopete/kopeteui.rc	(revision 567121)
+++ kopete/kopeteui.rc	(working copy)
@@ -94,6 +94,8 @@
 		<Action name="contactProperties" />
 	</Menu>
 	<Menu name="contactlistitems_popup">
+		<Action name="makeMetaContact" />
+		<Separator lineSeparator="false"/>
 		<Action name="contactRemove" />
 	</Menu>
 	<Menu name="contactlist_popup">
Index: libkopete/ui/addcontactpage.h
===================================================================
--- libkopete/ui/addcontactpage.h	(revision 567121)
+++ libkopete/ui/addcontactpage.h	(working copy)
@@ -37,6 +37,7 @@
 
 public:
 	AddContactPage(QWidget *parent=0);
+    AddContactPage(QWidget *parent, const char *name);
 	virtual ~AddContactPage();
 	//Kopete::Protocol *protocol;
 
Index: libkopete/ui/addcontactpage.cpp
===================================================================
--- libkopete/ui/addcontactpage.cpp	(revision 567121)
+++ libkopete/ui/addcontactpage.cpp	(working copy)
@@ -21,6 +21,10 @@
 {
 }
 
+AddContactPage::AddContactPage(QWidget *parent, const char *name) : QWidget(parent, \
name) +{
+}
+
 AddContactPage::~AddContactPage()
 {
 }



_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


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

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