Here's the patch rewritten for avoiding #defines.

Bye,
Rafael Fernández López.
Index: kopete/kopete/addaccountwizard/addaccountwizard.cpp
===================================================================
--- kopete/kopete/addaccountwizard/addaccountwizard.cpp (revisión: 594826)
+++ kopete/kopete/addaccountwizard/addaccountwizard.cpp (copia de trabajo)
@@ -36,49 +36,71 @@
 #include "kopeteprotocol.h"
 #include "kopetepluginmanager.h"
 
+
+class AddAccountWizard::Private {
+  public:
+
+   Private()
+   :
+   m_accountPage(0),
+   m_proto(0)
+   {
+   }
+
+   QMap<QTreeWidgetItem *, KPluginInfo *>  m_protocolItems;
+   KopeteEditAccountWidget *m_accountPage;
+   KVBox *m_accountPageWidget;
+   QWidget *m_selectService;
+   QWidget *m_finish;
+   Ui::AddAccountWizardPage1 m_uiSelectService;
+   Ui::AddAccountWizardPage2 m_uiFinish;
+   Kopete::Protocol *m_proto;
+   KPageWidgetItem *m_selectServiceItem;
+};
+
 AddAccountWizard::AddAccountWizard( QWidget *parent, bool firstRun )
        : 
        KAssistantDialog(parent),
-       m_accountPage(0),
-       m_proto(0)
+       d (new Private)
 {
        // setup the select service page
-       m_selectService = new QWidget(this);
-       m_uiSelectService.setupUi(m_selectService);
-       m_uiSelectService.protocolListView->setColumnCount( 2 );
+       d->m_selectService = new QWidget(this);
+       d->m_uiSelectService.setupUi(d->m_selectService);
+       d->m_uiSelectService.protocolListView->setColumnCount( 2 );
        QStringList header;
        header << i18n("Name") << i18n("Description");
-       m_uiSelectService.protocolListView->setHeaderLabels( header );
+       d->m_uiSelectService.protocolListView->setHeaderLabels( header );
        if ( firstRun )
-               m_uiSelectService.m_header->setText( i18nc( "1st message shown 
to users on first run of Kopete. Please keep the formatting.", "<h2>Welcome to 
Kopete</h2><p>Which messaging service do you want to connect to?</p>") );
+               d->m_uiSelectService.m_header->setText( i18nc( "1st message 
shown to users on first run of Kopete. Please keep the formatting.", 
"<h2>Welcome to Kopete</h2><p>Which messaging service do you want to connect 
to?</p>") );
        
-       m_selectServiceItem = 
addPage(m_selectService,m_selectService->windowTitle());
-       setValid(m_selectServiceItem, false);
+       d->m_selectServiceItem = 
addPage(d->m_selectService,d->m_selectService->windowTitle());
+       setValid(d->m_selectServiceItem, false);
                
-       m_accountPageWidget = new KVBox(this);
-       addPage(m_accountPageWidget,i18n("Step Two: Account Information"));
+       d->m_accountPageWidget = new KVBox(this);
+       addPage(d->m_accountPageWidget,i18n("Step Two: Account Information"));
 
        // setup the final page
-       m_finish = new QWidget(this);
-       m_uiFinish.setupUi(m_finish);
+       d->m_finish = new QWidget(this);
+       d->m_uiFinish.setupUi(d->m_finish);
        if ( firstRun )
-               m_uiFinish.m_header->setText( i18nc( "2nd message shown to 
users on first run of Kopete. Please keep the formatting.", 
"<h2>Congratulations</h2><p>You have finished configuring the account. You can 
add more accounts with <i>Settings->Configure</i>.  Please click the \"Finish\" 
button.</p>") );
-       addPage(m_finish,m_finish->windowTitle());
+               d->m_uiFinish.m_header->setText( i18nc( "2nd message shown to 
users on first run of Kopete. Please keep the formatting.", 
"<h2>Congratulations</h2><p>You have finished configuring the account. You can 
add more accounts with <i>Settings->Configure</i>.  Please click the \"Finish\" 
button.</p>") );
 
+       addPage(d->m_finish,d->m_finish->windowTitle());
+
        // add the available messenger services to the dialogs list
        QList<KPluginInfo *> protocols = 
Kopete::PluginManager::self()->availablePlugins("Protocols");
        for (QList<KPluginInfo *>::Iterator it = protocols.begin(); it != 
protocols.end(); ++it)
        {
-               QTreeWidgetItem *pluginItem = new 
QTreeWidgetItem(m_uiSelectService.protocolListView);
+               QTreeWidgetItem *pluginItem = new 
QTreeWidgetItem(d->m_uiSelectService.protocolListView);
                pluginItem->setIcon(0, QIcon(SmallIcon((*it)->icon())));
                pluginItem->setText(0, (*it)->name());
                pluginItem->setText(1, (*it)->comment());
 
-               m_protocolItems.insert(pluginItem, *it);
+               d->m_protocolItems.insert(pluginItem, *it);
        }
 
        // focus the ListView and select the first item
-       QTreeWidget *protocol_list = m_uiSelectService.protocolListView;
+       QTreeWidget *protocol_list = d->m_uiSelectService.protocolListView;
        protocol_list->setFocus();
        if (protocol_list->topLevelItemCount() > 0)
                protocol_list->setItemSelected( protocol_list->topLevelItem(0), 
true );
@@ -88,17 +110,17 @@
        
  
        // hook up the user input
-       connect(m_uiSelectService.protocolListView, 
SIGNAL(itemClicked(QTreeWidgetItem *, int)),
+       connect(d->m_uiSelectService.protocolListView, 
SIGNAL(itemClicked(QTreeWidgetItem *, int)),
                this, SLOT(slotProtocolListClicked()));
-       connect(m_uiSelectService.protocolListView, 
SIGNAL(itemSelectionChanged()),
+       connect(d->m_uiSelectService.protocolListView, 
SIGNAL(itemSelectionChanged()),
                this, SLOT( slotProtocolListClicked()));
-       connect(m_uiSelectService.protocolListView, 
SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
+       connect(d->m_uiSelectService.protocolListView, 
SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
                this, SLOT(slotProtocolListDoubleClicked()));
 }
 
 QTreeWidgetItem* AddAccountWizard::selectedProtocol()
 {
-       QList<QTreeWidgetItem*> selectedItems = 
m_uiSelectService.protocolListView->selectedItems();
+       QList<QTreeWidgetItem*> selectedItems = 
d->m_uiSelectService.protocolListView->selectedItems();
        if(!selectedItems.empty())
                return selectedItems.first();
        return 0;
@@ -107,7 +129,7 @@
 void AddAccountWizard::slotProtocolListClicked()
 {
        // Make sure a protocol is selected before allowing the user to continue
-       setValid(m_selectServiceItem, selectedProtocol() != 0);
+       setValid(d->m_selectServiceItem, selectedProtocol() != 0);
 }
 
 void AddAccountWizard::slotProtocolListDoubleClicked()
@@ -118,13 +140,13 @@
 
 void AddAccountWizard::back()
 {
-       if (currentPage()->widget() == m_accountPageWidget)
+       if (currentPage()->widget() == d->m_accountPageWidget)
        {
                // Deletes the accountPage, K3Wizard does not like deleting 
pages
                // using different pointers, it only seems to watch its own 
pointer
-               delete m_accountPage;
-               m_accountPage = 0;
-               m_proto       = 0;
+               delete d->m_accountPage;
+               d->m_accountPage = 0;
+               d->m_proto       = 0;
 
                // removePage() already goes back to previous page, no back() 
needed
        }
@@ -133,24 +155,24 @@
 
 void AddAccountWizard::next()
 {
-       if (currentPage()->widget() == m_selectService)
+       if (currentPage()->widget() == d->m_selectService)
        {
                QTreeWidgetItem *lvi = selectedProtocol();
-               if(!m_protocolItems[lvi])
+               if(!d->m_protocolItems[lvi])
                { //no item selected
                        return;
                }
-               m_proto = qobject_cast<Kopete::Protocol 
*>(Kopete::PluginManager::self()->loadPlugin(m_protocolItems[lvi]->pluginName()));
-               if (!m_proto)
+               d->m_proto = qobject_cast<Kopete::Protocol 
*>(Kopete::PluginManager::self()->loadPlugin(d->m_protocolItems[lvi]->pluginName()));
+               if (!d->m_proto)
                {
                        KMessageBox::queuedMessageBox(this, KMessageBox::Error,
-                               i18n("Cannot load the %1 protocol plugin.", 
m_protocolItems[lvi]->name()), 
+                               i18n("Cannot load the %1 protocol plugin.", 
d->m_protocolItems[lvi]->name()),
                                i18n("Error While Adding Account"));
                        return;
                }
 
-               m_accountPage = m_proto->createEditAccountWidget(0, 
m_accountPageWidget);
-               if (!m_accountPage)
+               d->m_accountPage = d->m_proto->createEditAccountWidget(0, 
d->m_accountPageWidget);
+               if (!d->m_accountPage)
                {
                        KMessageBox::queuedMessageBox(this, KMessageBox::Error,
                                i18n("This protocol does not currently support 
adding accounts."),
@@ -160,18 +182,18 @@
        
                KAssistantDialog::next();
        }
-       else if (currentPage()->widget() == m_accountPageWidget)
+       else if (currentPage()->widget() == d->m_accountPageWidget)
        {
                // check the data of the page is valid
-               if (!m_accountPage->validateData())
+               if (!d->m_accountPage->validateData())
                {
                        return;
                }
 
-               QColor col = 
Kopete::AccountManager::self()->guessColor(m_proto);
+               QColor col = 
Kopete::AccountManager::self()->guessColor(d->m_proto);
 
-               m_uiFinish.mColorButton->setColor(col);
-               m_uiFinish.mUseColor->setChecked(col.isValid());
+               d->m_uiFinish.mColorButton->setColor(col);
+               d->m_uiFinish.mUseColor->setChecked(col.isValid());
                KAssistantDialog::next();
        }
        else 
@@ -187,7 +209,7 @@
        // registeredAccount shouldn't probably be called here. Anyway, if the 
account is already registered, 
        // it won't be registered twice
        Kopete::AccountManager *manager = Kopete::AccountManager::self();
-       Kopete::Account        *account = 
manager->registerAccount(m_accountPage->apply());
+       Kopete::Account        *account = 
manager->registerAccount(d->m_accountPage->apply());
 
        // if the account wasn't created correctly then leave
        if (!account)
@@ -196,17 +218,17 @@
        }
 
        // Make sure the protocol is correctly enabled.  This is not really 
needed, but still good
-       const QString PROTO_NAME = 
m_proto->pluginId().remove("Protocol").toLower();
+       const QString PROTO_NAME = 
d->m_proto->pluginId().remove("Protocol").toLower();
        Kopete::PluginManager::self()->setPluginEnabled(PROTO_NAME , true);
 
        // setup the custom colour
-       if (m_uiFinish.mUseColor->isChecked())
+       if (d->m_uiFinish.mUseColor->isChecked())
        {
-               account->setColor(m_uiFinish.mColorButton->color());
+               account->setColor(d->m_uiFinish.mColorButton->color());
        }
 
        // connect if necessary
-       if (m_uiFinish.mConnectNow->isChecked())
+       if (d->m_uiFinish.mConnectNow->isChecked())
        {
                account->connect();
        }
@@ -217,12 +239,12 @@
 void AddAccountWizard::reject()
 {
     // if we have a protocol plugin loaded and its not being used, unload it
-       if (m_proto)
+       if (d->m_proto)
        {
                bool hasAccount=false;
                foreach( Kopete::Account *act, 
Kopete::AccountManager::self()->accounts() )
                {
-                       if( act->protocol() == m_proto )
+                       if( act->protocol() == d->m_proto )
                        {
                                hasAccount=true;
                                break;
@@ -230,7 +252,7 @@
                }
                if(hasAccount)
                {
-                       const QString PROTO_NAME = 
m_proto->pluginId().remove("Protocol").toLower();
+                       const QString PROTO_NAME = 
d->m_proto->pluginId().remove("Protocol").toLower();
                        Kopete::PluginManager::self()->unloadPlugin(PROTO_NAME);
                }
        }
Index: kopete/kopete/addaccountwizard/addaccountwizard.h
===================================================================
--- kopete/kopete/addaccountwizard/addaccountwizard.h   (revisión: 594826)
+++ kopete/kopete/addaccountwizard/addaccountwizard.h   (copia de trabajo)
@@ -63,17 +63,10 @@
        virtual void reject();
 
 private:
-       QTreeWidgetItem* selectedProtocol();
+   QTreeWidgetItem* selectedProtocol();
 
-       QMap<QTreeWidgetItem *, KPluginInfo *>  m_protocolItems;
-       KopeteEditAccountWidget *m_accountPage;
-       KVBox *m_accountPageWidget;
-       QWidget *m_selectService;
-       QWidget *m_finish;
-       Ui::AddAccountWizardPage1 m_uiSelectService;
-       Ui::AddAccountWizardPage2 m_uiFinish;
-       Kopete::Protocol *m_proto;
-       KPageWidgetItem *m_selectServiceItem;
+   class Private;
+   Private *d;
 };
 
 #endif
Index: kopete/kopete/config/accounts/kopeteaccountconfig.cpp
===================================================================
--- kopete/kopete/config/accounts/kopeteaccountconfig.cpp       (revisión: 
594826)
+++ kopete/kopete/config/accounts/kopeteaccountconfig.cpp       (copia de 
trabajo)
@@ -206,9 +206,9 @@
 
 void KopeteAccountConfig::slotAddAccount()
 {
-       AddAccountWizard *m_addwizard = new AddAccountWizard( this, 
"addAccountWizard", true );
-       connect( m_addwizard, SIGNAL( destroyed( QObject * ) ), this, SLOT( 
slotAddWizardDone() ) );
-       m_addwizard->show();
+       AddAccountWizard *m_addwizard = new AddAccountWizard( this );
+   connect( m_addwizard, SIGNAL(finished()), this, SLOT(slotAddWizardDone()) );
+   m_addwizard->show();
 }
 
 void KopeteAccountConfig::slotEditAccount()
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to