Hi,
Today I was bored, so I decided to do something easy. I removed the Qt3Support 
dependencies from the KabcExportWizard and ported it to KAssistantDialog.

Is it okay if I commit these changes?

Bye,
Alexander Rieder
Index: kopete/contactlist/kabcexport.cpp
===================================================================
--- kopete/contactlist/kabcexport.cpp	(Revision 721169)
+++ kopete/contactlist/kabcexport.cpp	(Arbeitskopie)
@@ -20,8 +20,6 @@
 */
 
 #include <qpushbutton.h>
-#include <q3listbox.h>
-#include <q3listview.h>
 #include <qmap.h>
 
 #include <klocale.h>
@@ -43,25 +41,34 @@
 
 #include "kabcexport.h"
 
-class ContactLVI : public Q3CheckListItem
+class ContactLVI : public QListWidgetItem
 {
 	public:
-		ContactLVI ( Kopete::MetaContact * mc, Q3ListView * parent, const QString & text, Type tt = RadioButtonController ) : Q3CheckListItem( parent, text, tt ), mc( mc )
-		{	}
+		ContactLVI ( Kopete::MetaContact * mc, QListWidget * parent, const QString & text, QListWidgetItem::ItemType tt = Type ) : QListWidgetItem( text,parent, tt ), mc( mc )
+		{
+			setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);	
+		}
 		Kopete::MetaContact * mc;
 		QString uid;
 };
 
 // ctor populates the resource list and contact list, and enables the next button on the first page 
 KabcExportWizard::KabcExportWizard( QWidget *parent )
-	: Q3Wizard(parent), Ui::KabcExportWizard_Base()
+	: KAssistantDialog(parent)
 {
-	setupUi(this);
+	QWidget *page1Widget=new QWidget(this);
+	m_page1.setupUi(page1Widget);
+	m_page1WidgetItem=addPage(page1Widget,i18n("Select Address Book"));
+	QWidget *page2Widget=new QWidget(this);
+	m_page2.setupUi(page2Widget);
+	m_page2WidgetItem=addPage(page2Widget,i18n("Select Contact"));
 
-	connect( m_addrBooks, SIGNAL( selectionChanged( Q3ListBoxItem * ) ), SLOT( slotResourceSelectionChanged( Q3ListBoxItem * ) ) );
 
-	connect( m_btnSelectAll, SIGNAL( clicked() ), SLOT( slotSelectAll() ) );
-	connect( m_btnDeselectAll, SIGNAL( clicked() ), SLOT( slotDeselectAll() ) );
+	connect( m_page1.addrBooks, SIGNAL( currentItemChanged ( QListWidgetItem * , QListWidgetItem * )  ),
+		  SLOT( slotResourceSelectionChanged( QListWidgetItem * )));
+
+	connect( m_page2.btnSelectAll, SIGNAL( clicked() ), SLOT( slotSelectAll() ) );
+	connect( m_page2.btnDeselectAll, SIGNAL( clicked() ), SLOT( slotDeselectAll() ) );
 	
 	// fill resource selector
 	m_addressBook = Kopete::KABCPersistence::self()->addressBook();
@@ -78,22 +85,23 @@ KabcExportWizard::KabcExportWizard( QWid
 		if ( !resource->readOnly() ) 
 		{
 			m_resourceMap.insert( counter, resource );
-			m_addrBooks->insertItem( resource->resourceName() );
+			m_page1.addrBooks->addItem( resource->resourceName() );
 			counter++;
 		}
 	}
-	setNextEnabled( Q3Wizard::page( 0 ), false );
-	setFinishEnabled( Q3Wizard::page( 1 ), true );
+
+	setValid(m_page1WidgetItem,false);
+
 	// if there were no writable address books, tell the user
 	if ( counter == 0 )
 	{
-		m_addrBooks->insertItem( i18n( "No writeable addressbook resource found." ) );
-		m_addrBooks->insertItem( i18n( "Add or enable one using the KDE Control Center." ) );
-		m_addrBooks->setEnabled( false );
+		m_page1.addrBooks->addItem( i18n( "No writeable addressbook resource found." ) );
+		m_page1.addrBooks->addItem( i18n( "Add or enable one using the KDE Control Center." ) );
+		m_page1.addrBooks->setEnabled( false );
 	}
 
-	if ( m_addrBooks->count() == 1 )
-		m_addrBooks->setSelected( 0, true );
+	if ( m_page1.addrBooks->count() == 1 )
+		m_page1.addrBooks->setCurrentRow( 0 );
 	
 	// fill contact list
 	QList<Kopete::MetaContact*> contacts = Kopete::ContactList::self()->metaContacts();
@@ -104,16 +112,18 @@ KabcExportWizard::KabcExportWizard( QWid
 	{
 		Kopete::MetaContact* mc = (*it);
 		m_contactMap.insert( counter, mc );
-		Q3CheckListItem * lvi = new ContactLVI( mc, m_contactList,
-				mc->displayName(), Q3CheckListItem::CheckBox );
-		lvi->setOn( false );
+		QListWidgetItem * lvi = new ContactLVI( mc, m_page2.contactList,
+				mc->displayName() );
+		lvi->setCheckState( Qt::Unchecked );
 		if ( mc->metaContactId().contains(':') )
 		{
-			lvi->setOn( true );
-			lvi->setEnabled( true );
+			lvi->setCheckState( Qt::Checked );
+			lvi->setFlags( Qt::ItemIsEnabled );
 		}
 		else
-			lvi->setText( 0, lvi->text( 0 ) + alreadyIn );
+		{
+			lvi->setText( lvi->text() + alreadyIn );
+		}
 	}
 }
 
@@ -124,31 +134,28 @@ KabcExportWizard::~KabcExportWizard()
 
 void KabcExportWizard::slotDeselectAll()
 {
-	Q3ListViewItemIterator it( m_contactList );
-	while ( it.current() )
+	for(int i=0;i<m_page2.contactList->count();i++)
 	{
-		ContactLVI *item = static_cast<ContactLVI *>( it.current() );
-		item->setOn( false );
-		++it;
+		ContactLVI *item = static_cast<ContactLVI *>( m_page2.contactList->item(i) );
+		item->setCheckState( Qt::Unchecked );
 	}
 }
 
 void KabcExportWizard::slotSelectAll()
 {
-	Q3ListViewItemIterator it( m_contactList );
-	while ( it.current() )
+	for(int i=0;i<m_page2.contactList->count();i++)
 	{
-		ContactLVI *item = static_cast<ContactLVI *>( it.current() );
-		++it;
-		if ( !item->isEnabled() )
+		ContactLVI *item = static_cast<ContactLVI *>( m_page2.contactList->item(i) );
+		if ( !item->flags() & Qt::ItemIsEnabled)
 			continue;
-		item->setOn( true );
+		item->setCheckState( Qt::Checked );
 	}
 }
 
-void KabcExportWizard::slotResourceSelectionChanged( Q3ListBoxItem * lbi )
+void KabcExportWizard::slotResourceSelectionChanged( QListWidgetItem * lbi )
 {
-	setNextEnabled( Q3Wizard::page( 0 ), lbi->isSelected() );
+	kDebug(14000)<<"changed"<<endl;
+	setValid( m_page1WidgetItem,true );
 }
 
 // accept runs the export algorithm
@@ -157,15 +164,14 @@ void KabcExportWizard::accept()
 	// first add an addressee to the selected resource 
 	// then set the metacontactId of each MC to that of the new addressee
 	KABC::Resource * selectedResource = 
-			m_resourceMap[ ( m_addrBooks->index( m_addrBooks->selectedItem() ) ) ];
+			m_resourceMap[ ( m_page1.addrBooks->currentRow() ) ];
 	// for each item checked
 	{
-		Q3ListViewItemIterator it( m_contactList );
-		while ( it.current() )
+		for(int i=0;i<m_page2.contactList->count();i++)
 		{
-			ContactLVI *item = static_cast<ContactLVI *>( it.current() );
+			ContactLVI *item = static_cast<ContactLVI *>(  m_page2.contactList->item(i) );
 			// if it is checked and enabled
-			if ( item->isEnabled() && item->isOn() )
+			if ( item->flags() & Qt::ItemIsEnabled && item->checkState() & Qt::Checked)
 			{
 				KABC::Addressee addr;
 				addr = m_addressBook->findByUid( item->mc->metaContactId() );
@@ -203,7 +209,6 @@ void KabcExportWizard::accept()
 					m_addressBook->insertAddressee( addr );
 				}
 			}
-			++it;
 		}
 	}
 	// request a write in case we only changed details on existing linked addressee
Index: kopete/contactlist/kabcexport.h
===================================================================
--- kopete/contactlist/kabcexport.h	(Revision 721169)
+++ kopete/contactlist/kabcexport.h	(Arbeitskopie)
@@ -18,9 +18,11 @@
 #ifndef KABCEXPORTWIZARD_H
 #define KABCEXPORTWIZARD_H
 
-#include <Q3Wizard>
+#include <kassistantdialog.h>
+
+#include "ui_kabcexport_page1.h"
+#include "ui_kabcexport_page2.h"
 
-#include "ui_kabcexport_base.h"
 
 namespace KABC {
 	class AddressBook;
@@ -35,7 +37,7 @@ namespace KRES {
 	class Resource;
 }
 
-class KabcExportWizard : public Q3Wizard, private Ui::KabcExportWizard_Base
+class KabcExportWizard : public KAssistantDialog
 {
 Q_OBJECT
 	public:
@@ -46,13 +48,17 @@ Q_OBJECT
 	protected slots:
 		void slotDeselectAll();
 		void slotSelectAll();
-		void slotResourceSelectionChanged( Q3ListBoxItem * lbi );
+		void slotResourceSelectionChanged( QListWidgetItem * lbi );
 	protected:
 		void exportDetails( Kopete::MetaContact * mc, KABC::Addressee & addr );
 	private:
 		KABC::AddressBook* m_addressBook;
 		QMap<int, KABC::Resource*> m_resourceMap;
 		QMap<int, Kopete::MetaContact*> m_contactMap;
+		Ui::KabcExportWizardPage1 m_page1;
+		KPageWidgetItem *m_page1WidgetItem;
+		Ui::KabcExportWizardPage2 m_page2;
+		KPageWidgetItem *m_page2WidgetItem;
 };
 
 #endif
Index: kopete/contactlist/kabcexport_page1.ui
===================================================================
--- kopete/contactlist/kabcexport_page1.ui	(Revision 0)
+++ kopete/contactlist/kabcexport_page1.ui	(Revision 0)
@@ -0,0 +1,63 @@
+<ui version="4.0" >
+ <class>KabcExportWizardPage1</class>
+ <widget class="QWidget" name="KabcExportWizardPage1" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>600</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <item>
+    <widget class="QLabel" name="textLabel1" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text" >
+      <string>This wizard helps you export instant messaging contacts to the KDE address book.</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignVCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox" >
+     <property name="title" >
+      <string>&amp;Select Address Book</string>
+     </property>
+     <layout class="QHBoxLayout" >
+      <property name="spacing" >
+       <number>6</number>
+      </property>
+      <property name="leftMargin" >
+       <number>9</number>
+      </property>
+      <property name="topMargin" >
+       <number>9</number>
+      </property>
+      <property name="rightMargin" >
+       <number>9</number>
+      </property>
+      <property name="bottomMargin" >
+       <number>9</number>
+      </property>
+      <item>
+       <widget class="QListWidget" name="addrBooks" />
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: kopete/contactlist/kabcexport_page2.ui
===================================================================
--- kopete/contactlist/kabcexport_page2.ui	(Revision 0)
+++ kopete/contactlist/kabcexport_page2.ui	(Revision 0)
@@ -0,0 +1,85 @@
+<ui version="4.0" >
+ <class>KabcExportWizardPage2</class>
+ <widget class="QWidget" name="KabcExportWizardPage2" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>543</width>
+    <height>395</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <item>
+    <widget class="QLabel" name="textLabel3" >
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text" >
+      <string>Selected contacts will be added to the KDE address book.</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QListWidget" name="contactList" />
+   </item>
+   <item>
+    <layout class="QHBoxLayout" >
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <property name="leftMargin" >
+      <number>0</number>
+     </property>
+     <property name="topMargin" >
+      <number>0</number>
+     </property>
+     <property name="rightMargin" >
+      <number>0</number>
+     </property>
+     <property name="bottomMargin" >
+      <number>0</number>
+     </property>
+     <item>
+      <widget class="QPushButton" name="btnSelectAll" >
+       <property name="text" >
+        <string>Select &amp;All</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="btnDeselectAll" >
+       <property name="text" >
+        <string>&amp;Deselect All</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>51</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: kopete/contactlist/kabcexport_base.ui
===================================================================
--- kopete/contactlist/kabcexport_base.ui	(Revision 721169)
+++ kopete/contactlist/kabcexport_base.ui	(Arbeitskopie)
@@ -1,197 +0,0 @@
-<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
- <class>KabcExportWizard_Base</class>
- <widget class="Q3Wizard" name="KabcExportWizard_Base" >
-  <property name="geometry" >
-        <rect>
-            <x>0</x>
-            <y>0</y>
-    <width>429</width>
-    <height>294</height>
-        </rect>
-    </property>
-  <property name="windowTitle" >
-        <string>Export Contacts</string>
-    </property>
-  <widget class="QWidget" name="page" >
-   <property name="geometry" >
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>417</width>
-     <height>218</height>
-    </rect>
-                </property>
-   <layout class="QVBoxLayout" >
-    <property name="margin" >
-     <number>9</number>
-    </property>
-    <property name="spacing" >
-     <number>6</number>
-    </property>
-    <item>
-     <widget class="QLabel" name="textLabel1" >
-      <property name="sizePolicy" >
-                    <sizepolicy>
-                        <hsizetype>1</hsizetype>
-                        <vsizetype>1</vsizetype>
-                        <horstretch>0</horstretch>
-                        <verstretch>0</verstretch>
-                    </sizepolicy>
-                </property>
-      <property name="text" >
-                    <string>This wizard helps you export instant messaging contacts to the KDE address book.</string>
-                </property>
-      <property name="alignment" >
-       <set>Qt::AlignVCenter</set>
-                </property>
-            </widget>
-    </item>
-    <item>
-     <widget class="QGroupBox" name="groupBox" >
-      <property name="title" >
-                    <string>&amp;Select Address Book</string>
-                </property>
-      <layout class="QHBoxLayout" >
-       <property name="margin" >
-        <number>9</number>
-       </property>
-       <property name="spacing" >
-        <number>6</number>
-       </property>
-       <item>
-        <widget class="Q3ListBox" name="m_addrBooks" >
-         <property name="sizePolicy" >
-                        <sizepolicy>
-                            <hsizetype>3</hsizetype>
-                            <vsizetype>3</vsizetype>
-                            <horstretch>0</horstretch>
-                            <verstretch>0</verstretch>
-                        </sizepolicy>
-                    </property>
-                </widget>
-       </item>
-      </layout>
-            </widget>
-    </item>
-   </layout>
-    </widget>
-  <widget class="QWidget" name="WizardPage" >
-   <property name="geometry" >
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>100</width>
-     <height>30</height>
-    </rect>
-                </property>
-   <layout class="QVBoxLayout" >
-    <property name="margin" >
-     <number>0</number>
-    </property>
-    <property name="spacing" >
-     <number>6</number>
-    </property>
-    <item>
-     <widget class="QLabel" name="textLabel3" >
-      <property name="sizePolicy" >
-                    <sizepolicy>
-                        <hsizetype>1</hsizetype>
-                        <vsizetype>1</vsizetype>
-                        <horstretch>0</horstretch>
-                        <verstretch>0</verstretch>
-                    </sizepolicy>
-                </property>
-      <property name="text" >
-                    <string>Selected contacts will be added to the KDE address book.</string>
-                </property>
-            </widget>
-    </item>
-    <item>
-     <widget class="Q3ListView" name="m_contactList" >
-      <property name="allColumnsShowFocus" >
-                        <bool>true</bool>
-                    </property>
-      <property name="resizeMode" >
-       <enum>Q3ListView::AllColumns</enum>
-                </property>
-      <column>
-       <property name="text" >
-        <string>Contact</string>
-                </property>
-      </column>
-            </widget>
-    </item>
-    <item>
-     <layout class="QHBoxLayout" >
-      <property name="margin" >
-       <number>0</number>
-      </property>
-      <property name="spacing" >
-       <number>6</number>
-      </property>
-      <item>
-       <widget class="QPushButton" name="m_btnSelectAll" >
-        <property name="text" >
-                            <string>Select &amp;All</string>
-                        </property>
-                    </widget>
-      </item>
-      <item>
-       <widget class="QPushButton" name="m_btnDeselectAll" >
-        <property name="text" >
-                            <string>&amp;Deselect All</string>
-                        </property>
-                    </widget>
-      </item>
-      <item>
-                    <spacer>
-        <property name="orientation" >
-         <enum>Qt::Horizontal</enum>
-                        </property>
-        <property name="sizeType" >
-         <enum>QSizePolicy::Expanding</enum>
-                        </property>
-        <property name="sizeHint" >
-                            <size>
-                                <width>51</width>
-                                <height>20</height>
-                            </size>
-                        </property>
-                    </spacer>
-      </item>
-     </layout>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <layoutdefault spacing="6" margin="11" />
- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
- <customwidgets>
-  <customwidget>
-   <class>Q3Wizard</class>
-   <extends></extends>
-   <header>q3wizard.h</header>
-   <container>1</container>
-   <pixmap></pixmap>
-  </customwidget>
-  <customwidget>
-   <class>Q3ListBox</class>
-   <extends></extends>
-   <header>q3listbox.h</header>
-   <container>0</container>
-   <pixmap></pixmap>
-  </customwidget>
-  <customwidget>
-   <class>Q3ListView</class>
-   <extends></extends>
-   <header>q3listview.h</header>
-   <container>0</container>
-   <pixmap></pixmap>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
Index: kopete/CMakeLists.txt
===================================================================
--- kopete/CMakeLists.txt	(Revision 721169)
+++ kopete/CMakeLists.txt	(Arbeitskopie)
@@ -42,7 +42,9 @@ kde4_add_ui_files(kopetecontactlist_SRCS
     contactlist/kopetegvipropswidget.ui
     contactlist/kopetemetalvipropswidget.ui
     contactlist/kopeteaddrbookexportui.ui
-    contactlist/kabcexport_base.ui )
+    contactlist/kabcexport_page1.ui
+    contactlist/kabcexport_page2.ui
+ )
 
 # Configure plugins
 set(kopetepluginconfig_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/config/plugins/kopetepluginconfig.cpp)
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to