diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-08 01:37:34 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-08 01:37:34 +0000 |
commit | d4f48636cc2631625434326e146d04f503d0247a (patch) | |
tree | a371a2337bddce3de3fa3fcac52275a8204570d9 /kitchensync/src | |
parent | d8b40941f9d1a221add0b9094eb09405a91a8aab (diff) | |
download | tdepim-d4f48636cc2631625434326e146d04f503d0247a.tar.gz tdepim-d4f48636cc2631625434326e146d04f503d0247a.zip |
Reverse OpenSync patch as it causes a build failure on Debian
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1172771 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kitchensync/src')
-rw-r--r-- | kitchensync/src/Makefile.am | 2 | ||||
-rw-r--r-- | kitchensync/src/configguifile.cpp | 40 | ||||
-rw-r--r-- | kitchensync/src/configguisyncmlhttp.cpp | 4 | ||||
-rw-r--r-- | kitchensync/src/configguisyncmlobex.cpp | 4 | ||||
-rw-r--r-- | kitchensync/src/groupconfig.cpp | 58 | ||||
-rw-r--r-- | kitchensync/src/groupconfig.h | 15 | ||||
-rw-r--r-- | kitchensync/src/groupconfigcommon.cpp | 21 | ||||
-rw-r--r-- | kitchensync/src/groupconfigcommon.h | 5 | ||||
-rw-r--r-- | kitchensync/src/groupconfigdialog.cpp | 24 | ||||
-rw-r--r-- | kitchensync/src/groupconfigdialog.h | 5 | ||||
-rw-r--r-- | kitchensync/src/groupitem.cpp | 71 | ||||
-rw-r--r-- | kitchensync/src/mainwidget.cpp | 20 | ||||
-rw-r--r-- | kitchensync/src/memberconfig.cpp | 11 | ||||
-rw-r--r-- | kitchensync/src/memberconfig.h | 2 | ||||
-rw-r--r-- | kitchensync/src/multiconflictdialog.cpp | 6 | ||||
-rw-r--r-- | kitchensync/src/pluginpicker.cpp | 14 | ||||
-rw-r--r-- | kitchensync/src/singleconflictdialog.cpp | 14 | ||||
-rw-r--r-- | kitchensync/src/syncprocess.cpp | 43 | ||||
-rw-r--r-- | kitchensync/src/syncprocess.h | 4 | ||||
-rw-r--r-- | kitchensync/src/syncprocessmanager.cpp | 48 | ||||
-rw-r--r-- | kitchensync/src/syncprocessmanager.h | 23 |
21 files changed, 162 insertions, 272 deletions
diff --git a/kitchensync/src/Makefile.am b/kitchensync/src/Makefile.am index 6527084cc..7f94fc173 100644 --- a/kitchensync/src/Makefile.am +++ b/kitchensync/src/Makefile.am @@ -24,7 +24,7 @@ libkitchensync_la_SOURCES = aboutpage.cpp mainwidget.cpp groupconfigdialog.cpp \ pluginpicker.cpp configgui.cpp configguiblank.cpp configguifile.cpp \ memberinfo.cpp groupconfigcommon.cpp kwidgetlist.cpp \ configguipalm.cpp conflictdialog.cpp singleconflictdialog.cpp \ - addresseediffalgo.cpp calendardiffalgo.cpp xmldiffalgo.cpp \ + addresseediffalgo.cpp calendardiffalgo.cpp \ htmldiffalgodisplay.cpp genericdiffalgo.cpp multiconflictdialog.cpp \ configguiirmc.cpp \ configguisyncmlobex.cpp configguisyncmlhttp.cpp configguiopie.cpp \ diff --git a/kitchensync/src/configguifile.cpp b/kitchensync/src/configguifile.cpp index a0c6a596d..6a8b0402c 100644 --- a/kitchensync/src/configguifile.cpp +++ b/kitchensync/src/configguifile.cpp @@ -55,20 +55,13 @@ void ConfigGuiFile::load( const TQString &xml ) TQDomDocument doc; doc.setContent( xml ); TQDomElement docElement = doc.documentElement(); - - TQDomNode node; - for ( node = docElement.firstChild(); !node.isNull(); node = node.nextSibling() ) { - TQDomElement e = node.toElement(); - if ( e.tagName() == "directory" ) { - TQDomNode subNode; - for ( subNode = e.firstChild(); !subNode.isNull(); subNode = subNode.nextSibling() ) { - TQDomElement subElement = subNode.toElement(); - if ( subElement.tagName() == "path" ) { - mFilename->setURL( subElement.text() ); - } else if ( subElement.tagName() == "recursive" ) { - mRecursive->setChecked( subElement.text() == "TRUE" ); - } - } + TQDomNode n; + for( n = docElement.firstChild(); !n.isNull(); n = n.nextSibling() ) { + TQDomElement e = n.toElement(); + if ( e.tagName() == "path" ) { + mFilename->setURL( e.text() ); + } else if ( e.tagName() == "recursive" ) { + mRecursive->setChecked( e.text() == "TRUE" ); } } } @@ -76,18 +69,13 @@ void ConfigGuiFile::load( const TQString &xml ) TQString ConfigGuiFile::save() const { TQString xml; - xml = "<config>\n"; - xml += " <directory>\n"; - xml += " <path>" + mFilename->url() + "</path>\n"; - xml += " <objtype>data</objtype>\n"; - xml += " <recursive>"; - if ( mRecursive->isChecked() ) - xml += "TRUE"; - else - xml += "FALSE"; - xml += "</recursive>\n"; - xml += " </directory>\n"; - xml += "</config>\n"; + xml = "<config>"; + xml += "<path>" + mFilename->url() + "</path>"; + xml += "<recursive>"; + if ( mRecursive->isChecked() ) xml += "TRUE"; + else xml += "FALSE"; + xml += "</recursive>"; + xml += "</config>"; return xml; } diff --git a/kitchensync/src/configguisyncmlhttp.cpp b/kitchensync/src/configguisyncmlhttp.cpp index b07111675..26a8c2241 100644 --- a/kitchensync/src/configguisyncmlhttp.cpp +++ b/kitchensync/src/configguisyncmlhttp.cpp @@ -121,7 +121,7 @@ ConfigGuiSyncmlHttp::ConfigGuiSyncmlHttp( const QSync::Member &member, TQWidget mGridLayout->addWidget( label, 5, 0 ); mRecvLimit = new TQSpinBox( optionWidget ); - mRecvLimit->setMinValue( 0 ); + mRecvLimit->setMinValue( 1 ); mRecvLimit->setMaxValue( 65536 ); mGridLayout->addWidget( mRecvLimit, 5, 1 ); @@ -130,7 +130,7 @@ ConfigGuiSyncmlHttp::ConfigGuiSyncmlHttp( const QSync::Member &member, TQWidget mGridLayout->addWidget( label, 6, 0 ); mMaxObjSize = new TQSpinBox( optionWidget ); - mMaxObjSize->setMinValue( 0 ); + mMaxObjSize->setMinValue( 1 ); mMaxObjSize->setMaxValue( 65536 ); mGridLayout->addWidget( mMaxObjSize, 6, 1 ); diff --git a/kitchensync/src/configguisyncmlobex.cpp b/kitchensync/src/configguisyncmlobex.cpp index ea952ef4a..372cf9261 100644 --- a/kitchensync/src/configguisyncmlobex.cpp +++ b/kitchensync/src/configguisyncmlobex.cpp @@ -153,7 +153,7 @@ ConfigGuiSyncmlObex::ConfigGuiSyncmlObex( const QSync::Member &member, TQWidget mGridLayout->addWidget( label, 14, 0 ); mRecvLimit = new TQSpinBox( optionsWidget ); - mRecvLimit->setMinValue( 0 ); + mRecvLimit->setMinValue( 1 ); mRecvLimit->setMaxValue( 65536 ); mGridLayout->addWidget( mRecvLimit, 14, 1 ); @@ -162,7 +162,7 @@ ConfigGuiSyncmlObex::ConfigGuiSyncmlObex( const QSync::Member &member, TQWidget mGridLayout->addWidget( label, 15, 0 ); mMaxObjSize = new TQSpinBox( optionsWidget ); - mMaxObjSize->setMinValue( 0 ); + mMaxObjSize->setMinValue( 1 ); mMaxObjSize->setMaxValue( 65536 ); mGridLayout->addWidget( mMaxObjSize, 15, 1 ); diff --git a/kitchensync/src/groupconfig.cpp b/kitchensync/src/groupconfig.cpp index 7e0af734a..cfedcbfad 100644 --- a/kitchensync/src/groupconfig.cpp +++ b/kitchensync/src/groupconfig.cpp @@ -27,10 +27,8 @@ #include "syncprocess.h" #include "syncprocessmanager.h" -#include <libqopensync/engine.h> #include <libqopensync/group.h> #include <libqopensync/plugin.h> -#include <libqopensync/result.h> #include <kdialog.h> #include <kiconloader.h> @@ -42,7 +40,6 @@ #include <tqlabel.h> #include <tqlayout.h> #include <tqpushbutton.h> -#include <tqtimer.h> GroupConfig::GroupConfig( TQWidget *parent ) : TQWidget( parent ) @@ -87,6 +84,14 @@ GroupConfig::GroupConfig( TQWidget *parent ) mMemberView = new KJanusWidget( this, 0, KJanusWidget::IconList ); topLayout->addWidget( mMemberView ); + TQBoxLayout *buttonLayout = new TQHBoxLayout( topLayout ); + + TQPushButton *addButton = new TQPushButton( i18n("Add Member..."), this ); + connect( addButton, TQT_SIGNAL( clicked() ), TQT_SLOT( addMember() ) ); + buttonLayout->addWidget( addButton ); + + buttonLayout->addStretch( 1 ); + icon = KGlobal::iconLoader()->loadIcon( "bookmark", KIcon::Desktop ); TQFrame *page = mMemberView->addPage( i18n("Group"), i18n("General Group Settings"), icon ); @@ -94,8 +99,6 @@ GroupConfig::GroupConfig( TQWidget *parent ) mCommonConfig = new GroupConfigCommon( page ); pageLayout->addWidget( mCommonConfig ); - - connect( mMemberView, TQT_SIGNAL( aboutToShowPage( TQWidget* ) ), TQT_SLOT( memberWidgetSelected( TQWidget* ) ) ); } void GroupConfig::setSyncProcess( SyncProcess *process ) @@ -110,9 +113,9 @@ void GroupConfig::setSyncProcess( SyncProcess *process ) void GroupConfig::updateMembers() { - TQMap<TQWidget*, MemberConfig *>::ConstIterator memberIt; + TQValueList<MemberConfig *>::ConstIterator memberIt; for ( memberIt = mMemberConfigs.begin(); memberIt != mMemberConfigs.end(); ++memberIt ) - memberIt.data()->saveData(); + (*memberIt)->saveData(); TQValueList<TQFrame *>::ConstIterator it2; for ( it2 = mConfigPages.begin(); it2 != mConfigPages.end(); ++it2 ) { @@ -122,9 +125,10 @@ void GroupConfig::updateMembers() mConfigPages.clear(); mMemberConfigs.clear(); - const QSync::Group group = mProcess->group(); - for ( int i = 0; i < group.memberCount(); ++i ) { - QSync::Member member = group.memberAt( i ); + QSync::Group group = mProcess->group(); + QSync::Group::Iterator it( group.begin() ); + for ( ; it != group.end(); ++it ) { + QSync::Member member = *it; MemberInfo mi( member ); TQFrame *page = mMemberView->addPage( mi.name(), TQString( "%1 (%2)" ).arg( mi.name() ).arg(member.pluginName()), mi.desktopIcon() ); @@ -133,7 +137,7 @@ void GroupConfig::updateMembers() mConfigPages.append( page ); MemberConfig *memberConfig = new MemberConfig( page, member ); - mMemberConfigs.insert( page, memberConfig ); + mMemberConfigs.append( memberConfig ); pageLayout->addWidget( memberConfig ); memberConfig->loadData(); @@ -144,30 +148,15 @@ void GroupConfig::saveConfig() { mProcess->group().save(); - TQMap<TQWidget*, MemberConfig*>::ConstIterator it; + TQValueList<MemberConfig *>::ConstIterator it; for ( it = mMemberConfigs.begin(); it != mMemberConfigs.end(); ++it ) - it.data()->saveData(); + (*it)->saveData(); mCommonConfig->save(); - const QSync::Group group = mProcess->group(); - for ( int i = 0; i < group.memberCount(); ++i ) { - const QSync::Member member = group.memberAt( i ); - mProcess->engine()->discover( member ); - } - mProcess->reinitEngine(); } -void GroupConfig::memberWidgetSelected( TQWidget *wdg ) -{ - /** - * Emit 'true' whenever a real member widget is selected by the - * user. - */ - emit memberSelected( wdg != mCommonConfig->parentWidget() ); -} - void GroupConfig::addMember() { QSync::Plugin plugin = PluginPickerDialog::getPlugin( this ); @@ -187,17 +176,4 @@ void GroupConfig::addMember() } } -void GroupConfig::removeMember() -{ - TQWidget *selectedWidget = mMemberView->pageWidget( mMemberView->activePageIndex() ); - if ( selectedWidget && mMemberConfigs.contains( selectedWidget ) ) { - MemberConfig *config = mMemberConfigs[ selectedWidget ]; - - SyncProcessManager::self()->removeMember( mProcess, config->member() ); - mMemberConfigs.remove( selectedWidget ); - - TQTimer::singleShot( 0, this, TQT_SLOT( updateMembers() ) ); - } -} - #include "groupconfig.moc" diff --git a/kitchensync/src/groupconfig.h b/kitchensync/src/groupconfig.h index 4deb8f255..8dc300b6b 100644 --- a/kitchensync/src/groupconfig.h +++ b/kitchensync/src/groupconfig.h @@ -40,19 +40,12 @@ class GroupConfig : public QWidget void setSyncProcess( SyncProcess *process ); - void saveConfig(); - - public slots: - void addMember(); - void removeMember(); - void updateMembers(); - signals: - void memberSelected( bool ); + void saveConfig(); protected slots: - void memberWidgetSelected( TQWidget* ); + void addMember(); private: TQLabel *mNameLabel; @@ -62,8 +55,8 @@ class GroupConfig : public QWidget SyncProcess *mProcess; GroupConfigCommon *mCommonConfig; - TQMap<TQWidget*, MemberConfig*> mMemberConfigs; - TQValueList<TQFrame*> mConfigPages; + TQValueList<MemberConfig *> mMemberConfigs; + TQValueList<TQFrame *> mConfigPages; }; #endif diff --git a/kitchensync/src/groupconfigcommon.cpp b/kitchensync/src/groupconfigcommon.cpp index 360746893..9f629c4d2 100644 --- a/kitchensync/src/groupconfigcommon.cpp +++ b/kitchensync/src/groupconfigcommon.cpp @@ -30,15 +30,14 @@ #include <tqcheckbox.h> #include <libqopensync/group.h> -//#include <libqopensync/conversion.h> +#include <libqopensync/conversion.h> +#include <libqopensync/environment.h> #include "syncprocess.h" #include "syncprocessmanager.h" #include "groupconfigcommon.h" -// TODO: port ObjectTypeSelector to ported solution of Conversation class -#if 0 ObjectTypeSelector::ObjectTypeSelector( TQWidget *parent ) : TQWidget( parent ) { @@ -125,7 +124,6 @@ void ObjectTypeSelector::save( QSync::Group group ) QSync::GroupConfig config = group.config(); config.setActiveObjectTypes( objectTypes ); } -#endif GroupConfigCommon::GroupConfigCommon( TQWidget *parent ) : TQWidget( parent ) @@ -137,11 +135,10 @@ GroupConfigCommon::GroupConfigCommon( TQWidget *parent ) mGroupName = new KLineEdit( this ); layout->addWidget( mGroupName, 0, 1 ); - //layout->addWidget( new TQLabel( i18n( "Object Types to be Synchronized:"), this ), 1, 0, Qt::AlignTop ); + layout->addWidget( new TQLabel( i18n( "Object Types to be Synchronized:"), this ), 1, 0, Qt::AlignTop ); - // TODO port ObjectTypeSelector class.. - //mObjectTypeSelector = new ObjectTypeSelector( this ); - //layout->addWidget( mObjectTypeSelector, 1, 1 ); + mObjectTypeSelector = new ObjectTypeSelector( this ); + layout->addWidget( mObjectTypeSelector, 1, 1 ); layout->setRowStretch( 2, 1 ); } @@ -151,15 +148,11 @@ void GroupConfigCommon::setSyncProcess( SyncProcess *syncProcess ) mSyncProcess = syncProcess; mGroupName->setText( mSyncProcess->group().name() ); - - // TODO port ObjectTypeSelector class.. - //mObjectTypeSelector->load( mSyncProcess->group() ); + mObjectTypeSelector->load( mSyncProcess->group() ); } void GroupConfigCommon::save() { mSyncProcess->group().setName( mGroupName->text() ); - - // TODO port ObjectTypeSelector class.. - //mObjectTypeSelector->save( mSyncProcess->group() ); + mObjectTypeSelector->save( mSyncProcess->group() ); } diff --git a/kitchensync/src/groupconfigcommon.h b/kitchensync/src/groupconfigcommon.h index 15ec5e5ab..25a0ceb0c 100644 --- a/kitchensync/src/groupconfigcommon.h +++ b/kitchensync/src/groupconfigcommon.h @@ -30,8 +30,6 @@ class KLineEdit; class SyncProcess; class TQCheckBox; -//TODO: Conversation needs to be ported before... -#if 0 class ObjectTypeSelector : public TQWidget { public: @@ -43,7 +41,6 @@ class ObjectTypeSelector : public TQWidget private: TQMap<TQString,TQCheckBox *> mObjectTypeChecks; }; -#endif class GroupConfigCommon : public QWidget { @@ -55,7 +52,7 @@ class GroupConfigCommon : public QWidget private: KLineEdit *mGroupName; - // ObjectTypeSelector *mObjectTypeSelector; + ObjectTypeSelector *mObjectTypeSelector; SyncProcess *mSyncProcess; }; diff --git a/kitchensync/src/groupconfigdialog.cpp b/kitchensync/src/groupconfigdialog.cpp index d0b5894f9..4d8be65d0 100644 --- a/kitchensync/src/groupconfigdialog.cpp +++ b/kitchensync/src/groupconfigdialog.cpp @@ -28,7 +28,7 @@ GroupConfigDialog::GroupConfigDialog( TQWidget *parent, SyncProcess *process ) : KDialogBase( parent, 0, true, i18n("Configure Synchronization Group"), - Ok | User1 | User2, Ok ) + Ok ) { TQFrame *topFrame = makeMainWidget(); @@ -40,13 +40,6 @@ GroupConfigDialog::GroupConfigDialog( TQWidget *parent, SyncProcess *process ) mConfigWidget->setSyncProcess( process ); setInitialSize( configDialogSize( "size_groupconfigdialog" ) ); - - enableButton( User1, false ); - setButtonText( User1, i18n( "Remove Member" ) ); - - connect( mConfigWidget, TQT_SIGNAL( memberSelected( bool ) ), TQT_SLOT( memberSelected( bool ) ) ); - - setButtonText( User2, i18n("Add Member...") ); } GroupConfigDialog::~GroupConfigDialog() @@ -61,19 +54,4 @@ void GroupConfigDialog::slotOk() accept(); } -void GroupConfigDialog::slotUser1() -{ - mConfigWidget->removeMember(); -} - -void GroupConfigDialog::slotUser2() -{ - mConfigWidget->addMember(); -} - -void GroupConfigDialog::memberSelected( bool selected ) -{ - enableButton( User1, selected ); -} - #include "groupconfigdialog.moc" diff --git a/kitchensync/src/groupconfigdialog.h b/kitchensync/src/groupconfigdialog.h index 8dde4da77..5fd70884f 100644 --- a/kitchensync/src/groupconfigdialog.h +++ b/kitchensync/src/groupconfigdialog.h @@ -35,11 +35,6 @@ class GroupConfigDialog : public KDialogBase protected slots: void slotOk(); - void slotUser1(); - void slotUser2(); - - private slots: - void memberSelected( bool ); private: GroupConfig *mConfigWidget; diff --git a/kitchensync/src/groupitem.cpp b/kitchensync/src/groupitem.cpp index fe4b2fdcd..784991c6f 100644 --- a/kitchensync/src/groupitem.cpp +++ b/kitchensync/src/groupitem.cpp @@ -33,9 +33,6 @@ #include <tqprogressbar.h> #include <tqvbox.h> -#include <libqopensync/plugin.h> -#include <libqopensync/pluginenv.h> - #include "memberinfo.h" #include "multiconflictdialog.h" #include "singleconflictdialog.h" @@ -153,9 +150,12 @@ void GroupItem::update() mProgressBar->reset(); mProgressBar->hide(); - const QSync::Group group = mSyncProcess->group(); - for ( int i = 0; i < group.memberCount(); ++i ) { - MemberItem *item = new MemberItem( mBox, mSyncProcess, group.memberAt( i ) ); + QSync::Group group = mSyncProcess->group(); + QSync::Group::Iterator memberIt( group.begin() ); + QSync::Group::Iterator memberEndIt( group.end() ); + + for ( ; memberIt != memberEndIt; ++memberIt ) { + MemberItem *item = new MemberItem( mBox, mSyncProcess, *memberIt ); item->show(); item->setStatusMessage( i18n( "Ready" ) ); mMemberItems.append( item ); @@ -187,11 +187,14 @@ void GroupItem::conflict( QSync::SyncMapping mapping ) void GroupItem::change( const QSync::SyncChangeUpdate &update ) { switch ( update.type() ) { - case QSync::SyncChangeUpdate::Read: + case QSync::SyncChangeUpdate::Received: mProcessedItems++; mStatus->setText( i18n( "%1 entries read" ).arg( mProcessedItems ) ); break; - case QSync::SyncChangeUpdate::Written: + case QSync::SyncChangeUpdate::ReceivedInfo: + mStatus->setText( i18n( "Receive information" ) ); + break; + case QSync::SyncChangeUpdate::Sent: mProcessedItems--; mStatus->setText( i18n( "%1 entries written" ).arg( mMaxProcessedItems - mProcessedItems ) ); @@ -208,7 +211,11 @@ void GroupItem::change( const QSync::SyncChangeUpdate &update ) mProgressBar->setProgress( 100 - progress ); } break; - case QSync::SyncChangeUpdate::Error: + case QSync::SyncChangeUpdate::WriteError: + mStatus->setText( i18n( "Error" ) ); + KPassivePopup::message( update.result().message(), this ); + break; + case QSync::SyncChangeUpdate::ReceiveError: mStatus->setText( i18n( "Error" ) ); KPassivePopup::message( update.result().message(), this ); break; @@ -225,21 +232,21 @@ void GroupItem::mapping( const QSync::SyncMappingUpdate& ) void GroupItem::engine( const QSync::SyncEngineUpdate &update ) { switch ( update.type() ) { - case QSync::SyncEngineUpdate::Connected: + case QSync::SyncEngineUpdate::EndPhaseConnected: mStatus->setText( i18n( "Connected" ) ); mProgressBar->setProgress( 0 ); mSynchronizing = true; mSyncAction->setText( "Abort Synchronization" ); break; - case QSync::SyncEngineUpdate::Read: + case QSync::SyncEngineUpdate::EndPhaseRead: mStatus->setText( i18n( "Data read" ) ); break; - case QSync::SyncEngineUpdate::Written: + case QSync::SyncEngineUpdate::EndPhaseWrite: mStatus->setText( i18n( "Data written" ) ); mProgressBar->setProgress( 100 ); mProcessedItems = mMaxProcessedItems = 0; break; - case QSync::SyncEngineUpdate::Disconnected: + case QSync::SyncEngineUpdate::EndPhaseDisconnected: mStatus->setText( i18n( "Disconnected" ) ); break; case QSync::SyncEngineUpdate::Error: @@ -250,7 +257,7 @@ void GroupItem::engine( const QSync::SyncEngineUpdate &update ) mSynchronizing = false; mSyncAction->setText( i18n( "Synchronize Now" ) ); break; - case QSync::SyncEngineUpdate::SyncSuccessful: + case QSync::SyncEngineUpdate::SyncSuccessfull: mStatus->setText( i18n( "Successfully synchronized" ) ); mSyncProcess->group().setLastSynchronization( TQDateTime::currentDateTime() ); mSyncProcess->group().save(); @@ -281,22 +288,28 @@ void GroupItem::member( const QSync::SyncMemberUpdate &update ) case QSync::SyncMemberUpdate::Connected: (*it)->setStatusMessage( i18n( "Connected" ) ); break; - case QSync::SyncMemberUpdate::Read: + case QSync::SyncMemberUpdate::SentChanges: (*it)->setStatusMessage( i18n( "Changes read" ) ); break; - case QSync::SyncMemberUpdate::Written: + case QSync::SyncMemberUpdate::CommittedAll: (*it)->setStatusMessage( i18n( "Changes written" ) ); break; case QSync::SyncMemberUpdate::Disconnected: (*it)->setStatusMessage( i18n( "Disconnected" ) ); break; - case QSync::SyncMemberUpdate::SyncDone: - (*it)->setStatusMessage( i18n( "Synchronization done" ) ); + case QSync::SyncMemberUpdate::ConnectError: + (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) ); break; - case QSync::SyncMemberUpdate::Discovered: - (*it)->setStatusMessage( i18n( "Discovered" ) ); + case QSync::SyncMemberUpdate::GetChangesError: + (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) ); break; - case QSync::SyncMemberUpdate::Error: + case QSync::SyncMemberUpdate::CommittedAllError: + (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) ); + break; + case QSync::SyncMemberUpdate::SyncDoneError: + (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) ); + break; + case QSync::SyncMemberUpdate::DisconnectedError: (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) ); break; default: @@ -339,8 +352,11 @@ MemberItem::MemberItem( TQWidget *parent, SyncProcess *process, TQFont boldFont; boldFont.setBold( true ); - const MemberInfo mi( member ); - const TQPixmap icon = mi.smallIcon(); + MemberInfo mi( member ); + + TQPixmap icon = mi.smallIcon(); + + QSync::Plugin plugin = member.plugin(); TQVBoxLayout *layout = new TQVBoxLayout( this ); @@ -362,14 +378,7 @@ MemberItem::MemberItem( TQWidget *parent, SyncProcess *process, mStatus = new TQLabel( box ); mMemberName->setText( member.name() ); - - const QSync::PluginEnv *env = SyncProcessManager::self()->pluginEnv(); - const QSync::Plugin plugin = env->pluginByName( member.pluginName() ); - - if ( plugin.isValid() ) - mDescription->setText( plugin.longName() ); - else - mDescription->setText( i18n("Plugin \"%1\" can't get initialized!").arg( member.pluginName() ) ); + mDescription->setText( plugin.longName() ); } void MemberItem::setStatusMessage( const TQString &msg ) diff --git a/kitchensync/src/mainwidget.cpp b/kitchensync/src/mainwidget.cpp index 02b279b3e..d04542f9d 100644 --- a/kitchensync/src/mainwidget.cpp +++ b/kitchensync/src/mainwidget.cpp @@ -26,7 +26,7 @@ #include "syncprocess.h" #include "syncprocessmanager.h" -#include <libqopensync/result.h> +#include <libqopensync/environment.h> #include <kaboutdata.h> #include <kaction.h> @@ -46,6 +46,13 @@ MainWidget::MainWidget( KXMLGUIClient *guiClient, TQWidget *widget, const char * initGUI(); initActions(); + /** apply object type filter hack **/ + int count = SyncProcessManager::self()->count(); + for ( int i = 0; i < count; ++i ) { + SyncProcessManager::self()->at( i )->applyObjectTypeFilter(); + } + /** apply object type filter hack **/ + mGroupView->updateView(); connect( SyncProcessManager::self(), TQT_SIGNAL( changed() ), @@ -118,19 +125,12 @@ void MainWidget::addGroup() { bool ok; TQString name = KInputDialog::getText( i18n("Create Synchronization Group"), - i18n("Name for new synchronization group."), i18n( "Default" ), &ok, this ); + i18n("Name for new synchronization group."), TQString::null, &ok, this ); if ( ok ) { - SyncProcess *process = SyncProcessManager::self()->byGroupName( name ); - if ( process ) { - KMessageBox::error( this, i18n( "A group with the same name exists already.\nPlease choose another name." ), - i18n( "Duplicated Group Name" ) ); - return; - } - SyncProcessManager::self()->addGroup( name ); enableActions(); - process = SyncProcessManager::self()->byGroupName( name ); + SyncProcess *process = SyncProcessManager::self()->byGroupName( name ); if ( process ) editGroup( process ); } diff --git a/kitchensync/src/memberconfig.cpp b/kitchensync/src/memberconfig.cpp index d3d08a63b..37755a504 100644 --- a/kitchensync/src/memberconfig.cpp +++ b/kitchensync/src/memberconfig.cpp @@ -23,8 +23,6 @@ #include "configgui.h" #include "memberinfo.h" -#include <libqopensync/result.h> - #include <klocale.h> #include <kmessagebox.h> @@ -69,16 +67,13 @@ void MemberConfig::saveData() if ( txt.isEmpty() ) { KMessageBox::sorry( this, i18n("Configuration of %1 is empty.").arg( mMember.pluginName() ) ); } else { - mMember.setConfiguration( txt.utf8() ); + TQByteArray cfg = txt.utf8(); + cfg.truncate(cfg.size() - 1); /* discard NUL terminator */ + mMember.setConfiguration( cfg ); mMember.setName( mGui->instanceName() ); // TODO: Check for save() error. mMember.save(); } } -QSync::Member MemberConfig::member() const -{ - return mMember; -} - #include "memberconfig.moc" diff --git a/kitchensync/src/memberconfig.h b/kitchensync/src/memberconfig.h index b2a3569d4..c6457972d 100644 --- a/kitchensync/src/memberconfig.h +++ b/kitchensync/src/memberconfig.h @@ -38,8 +38,6 @@ class MemberConfig : public QWidget void loadData(); void saveData(); - QSync::Member member() const; - private: QSync::Member mMember; diff --git a/kitchensync/src/multiconflictdialog.cpp b/kitchensync/src/multiconflictdialog.cpp index 88d42d3b3..7d7805c42 100644 --- a/kitchensync/src/multiconflictdialog.cpp +++ b/kitchensync/src/multiconflictdialog.cpp @@ -39,10 +39,8 @@ class ChangeItem : public KWidgetListItem { TQGridLayout *layout = new TQGridLayout( this, 2, 1, KDialog::marginHint(), KDialog::spacingHint() ); - // TODO change doesn't contain member as struct member .. use SyncMapping to determine the correct member. - //MemberInfo mi( change.member() ); - //layout->addWidget( new TQLabel( mi.name(), this ), 0, 0 ); - layout->addWidget( new TQLabel( "PORTING TODO", this ), 0, 0 ); + MemberInfo mi( change.member() ); + layout->addWidget( new TQLabel( mi.name(), this ), 0, 0 ); TQString type; switch ( change.changeType() ) { diff --git a/kitchensync/src/pluginpicker.cpp b/kitchensync/src/pluginpicker.cpp index 5dda30bfe..d981599bd 100644 --- a/kitchensync/src/pluginpicker.cpp +++ b/kitchensync/src/pluginpicker.cpp @@ -24,7 +24,7 @@ #include "memberinfo.h" #include "syncprocessmanager.h" -#include <libqopensync/pluginenv.h> +#include <libqopensync/environment.h> #include <kdialog.h> #include <kglobal.h> @@ -77,14 +77,12 @@ void PluginPicker::updatePluginList() { mPluginList->clear(); - const QSync::PluginEnv *env = SyncProcessManager::self()->pluginEnv(); - - for ( int i = 0; i < env->pluginCount(); ++i ) { - QSync::Plugin plugin = env->pluginAt( i ); - - if ( plugin.isValid() ) - mPluginList->appendItem( new PluginItem( mPluginList, plugin ) ); + QSync::Environment *env = SyncProcessManager::self()->environment(); + QSync::Environment::PluginIterator it( env->pluginBegin() ); + for( ; it != env->pluginEnd(); ++it ) { + QSync::Plugin plugin = *it; + mPluginList->appendItem( new PluginItem( mPluginList, plugin ) ); } } diff --git a/kitchensync/src/singleconflictdialog.cpp b/kitchensync/src/singleconflictdialog.cpp index 121ec50cb..8975b6f98 100644 --- a/kitchensync/src/singleconflictdialog.cpp +++ b/kitchensync/src/singleconflictdialog.cpp @@ -27,7 +27,6 @@ #include "addresseediffalgo.h" #include "genericdiffalgo.h" -#include "xmldiffalgo.h" #include "htmldiffalgodisplay.h" #include "memberinfo.h" @@ -44,22 +43,16 @@ SingleConflictDialog::SingleConflictDialog( QSync::SyncMapping &mapping, TQWidge if ( format == "file" ) { mDiffAlgo = new KSync::GenericDiffAlgo( leftChange.data(), rightChange.data() ); - } else if ( format == "vcard21" || format == "vcard30" ) { - mDiffAlgo = new KSync::AddresseeDiffAlgo( leftChange.data(), rightChange.data() ); + } else if ( format == "vcard" ) { } else if ( format == "calendar" ) { - } else if ( format == "xmlformat-contact" || format == "xmlformat-note" - || format == "xmlformat-event" || format == "xmlformat-todo") { - mDiffAlgo = new KSync::XmlDiffAlgo( leftChange.data(), rightChange.data() ); + } else if ( format == "xml-contact" ) { + mDiffAlgo = new KSync::AddresseeDiffAlgo( leftChange.data(), rightChange.data() ); } -// TODO: SyncChange doesn't have member as struct member anymore ... -// Use SyncMapping to determine the member .. see msynctool for example implementation of conlicthandler -#if 0 MemberInfo miLeft( leftChange.member() ); mDiffAlgoDisplay->setLeftSourceTitle( miLeft.name() ); MemberInfo miRight( rightChange.member() ); mDiffAlgoDisplay->setRightSourceTitle( miRight.name() ); -#endif if ( mDiffAlgo ) { mDiffAlgo->addDisplay( mDiffAlgoDisplay ); @@ -106,7 +99,6 @@ void SingleConflictDialog::initGUI() TQGridLayout *layout = new TQGridLayout( this, 3, 4, KDialog::marginHint(), KDialog::spacingHint() ); layout->addMultiCellWidget( new TQLabel( i18n( "A conflict has appeared, please solve it manually." ), this ), 0, 0, 0, 3 ); - mDiffAlgoDisplay = new KSync::HTMLDiffAlgoDisplay( this ); layout->addMultiCellWidget( mDiffAlgoDisplay, 1, 1, 0, 3 ); diff --git a/kitchensync/src/syncprocess.cpp b/kitchensync/src/syncprocess.cpp index 2ff93bcd4..60310b803 100644 --- a/kitchensync/src/syncprocess.cpp +++ b/kitchensync/src/syncprocess.cpp @@ -19,12 +19,10 @@ */ #include <libqopensync/engine.h> -#include <libqopensync/member.h> -#include <libqopensync/result.h> +#include <libqopensync/environment.h> #include <kdebug.h> #include <klocale.h> -#include <kmessagebox.h> #include "syncprocess.h" #include "syncprocessmanager.h" @@ -62,8 +60,8 @@ TQString SyncProcess::memberStatus( const QSync::Member& ) const QSync::Result SyncProcess::addMember( const QSync::Plugin &plugin ) { - QSync::Member member = mGroup.addMember( plugin ); - QSync::Result result = member.instance(); + QSync::Member member = mGroup.addMember(); + QSync::Result result = member.instance( plugin ); if ( !result.isError() ) mGroup.save(); @@ -71,27 +69,40 @@ QSync::Result SyncProcess::addMember( const QSync::Plugin &plugin ) return result; } -void SyncProcess::removeMember( const QSync::Member &member ) -{ - member.cleanup(); - mGroup.removeMember( member ); - mGroup.save(); -} - void SyncProcess::reinitEngine() { mEngine->finalize(); delete mEngine; mEngine = new QSync::Engine( mGroup ); Result result = mEngine->initialize(); - if ( result.isError() ) { + if ( result.isError() ) kdDebug() << "SyncProcess::reinitEngine: " << result.message() << endl; - KMessageBox::error( 0, i18n("Error initializing Synchronization Engine for group \"%1\":\n %2") - .arg( mGroup.name() ).arg( result.message() ) ); - } + applyObjectTypeFilter(); emit engineChanged( mEngine ); } +void SyncProcess::applyObjectTypeFilter() +{ + const QSync::Conversion conversion = SyncProcessManager::self()->environment()->conversion(); + const TQStringList objectTypes = conversion.objectTypes(); + const TQStringList activeObjectTypes = mGroup.config().activeObjectTypes(); + + for ( uint i = 0; i < objectTypes.count(); ++i ) { + if ( activeObjectTypes.contains( objectTypes[ i ] ) ) { + kdDebug() << "Enabled object type: " << objectTypes[ i ] << endl; + /* + * This is not required. Also this lead to filtering problems when sync with "file-sync". + * Uncomment this line again when OpenSync is fixed! + * + * mGroup.setObjectTypeEnabled( objectTypes[ i ], true ); + */ + } else { + kdDebug() << "Disabled object type: " << objectTypes[ i ] << endl; + mGroup.setObjectTypeEnabled( objectTypes[ i ], false ); + } + } +} + #include "syncprocess.moc" diff --git a/kitchensync/src/syncprocess.h b/kitchensync/src/syncprocess.h index 6cdefc408..ef23f7c52 100644 --- a/kitchensync/src/syncprocess.h +++ b/kitchensync/src/syncprocess.h @@ -44,10 +44,12 @@ class SyncProcess : public QObject TQString memberStatus( const QSync::Member &member ) const; QSync::Result addMember( const QSync::Plugin &plugin ); - void removeMember( const QSync::Member &member ); void reinitEngine(); + /** apply object type filter hack **/ + void applyObjectTypeFilter(); + signals: /** This signal is emitted whenever the engine has changed ( reinitialized ). diff --git a/kitchensync/src/syncprocessmanager.cpp b/kitchensync/src/syncprocessmanager.cpp index 27e09a25e..fda111efd 100644 --- a/kitchensync/src/syncprocessmanager.cpp +++ b/kitchensync/src/syncprocessmanager.cpp @@ -23,10 +23,7 @@ #include "syncprocess.h" -#include <libqopensync/groupenv.h> -#include <libqopensync/member.h> -#include <libqopensync/pluginenv.h> -#include <libqopensync/result.h> +#include <libqopensync/environment.h> #include <kstaticdeleter.h> #include <kmessagebox.h> @@ -46,24 +43,14 @@ SyncProcessManager *SyncProcessManager::self() SyncProcessManager::SyncProcessManager() { - mGroupEnv = new QSync::GroupEnv; - QSync::Result result = mGroupEnv->initialize(); + mEnvironment = new QSync::Environment; + QSync::Result result = mEnvironment->initialize(); if ( result.isError() ) { KMessageBox::error( 0, i18n("Error initializing OpenSync.\n%1") .arg( result.message() ) ); } else { - initGroup( mGroupEnv ); + init( mEnvironment ); } - - mPluginEnv = new QSync::PluginEnv; - result = mPluginEnv->initialize(); - if ( result.isError() ) { - KMessageBox::error( 0, i18n("Error initializing OpenSync.\n%1") - .arg( result.message() ) ); - } else { -// initPlugin( mPluginEnv ); - } - } SyncProcessManager::~SyncProcessManager() @@ -74,8 +61,8 @@ SyncProcessManager::~SyncProcessManager() mProcesses.clear(); - mGroupEnv->finalize(); - delete mGroupEnv; + mEnvironment->finalize(); + delete mEnvironment; } int SyncProcessManager::count() const @@ -115,7 +102,8 @@ void SyncProcessManager::addGroup( const TQString &name ) { SyncProcess* process = byGroupName( name ); if ( !process ) { - QSync::Group group = mGroupEnv->addGroup( name ); + QSync::Group group = mEnvironment->addGroup(); + group.setName( name ); group.save(); mProcesses.append( new SyncProcess( group ) ); @@ -132,21 +120,22 @@ void SyncProcessManager::remove( SyncProcess *syncProcess ) const QSync::Group group = syncProcess->group(); delete syncProcess; - mGroupEnv->removeGroup( group ); + mEnvironment->removeGroup( group ); emit changed(); } } -void SyncProcessManager::initGroup( QSync::GroupEnv *groupEnv ) +void SyncProcessManager::init( QSync::Environment *environment ) { - for ( int i = 0; i < groupEnv->groupCount(); ++i ) { + QSync::Environment::GroupIterator it( environment->groupBegin() ); + for ( ; it != environment->groupEnd(); ++it ) { /** * We check whether the group is valid before we append them * to mProcesses. That avoids crashes if the plugin of one of * the members isn't loaded (e.g. not installed). */ - const QSync::Group group = groupEnv->groupAt( i ); + const QSync::Group group = *it; int count = group.memberCount(); bool isValid = true; @@ -160,7 +149,7 @@ void SyncProcessManager::initGroup( QSync::GroupEnv *groupEnv ) } if ( isValid ) - mProcesses.append( new SyncProcess( group ) ); + mProcesses.append( new SyncProcess( *it ) ); } emit changed(); @@ -180,13 +169,4 @@ QSync::Result SyncProcessManager::addMember( SyncProcess *process, return result; } -void SyncProcessManager::removeMember( SyncProcess *process, const QSync::Member &member ) -{ - Q_ASSERT( process ); - - process->removeMember( member ); - process->group().save(); - emit syncProcessChanged( process ); -} - #include "syncprocessmanager.moc" diff --git a/kitchensync/src/syncprocessmanager.h b/kitchensync/src/syncprocessmanager.h index 38004977d..b95018a84 100644 --- a/kitchensync/src/syncprocessmanager.h +++ b/kitchensync/src/syncprocessmanager.h @@ -26,8 +26,7 @@ #include <libqopensync/group.h> namespace QSync { -class GroupEnv; -class PluginEnv; +class Environment; } class SyncProcess; @@ -44,14 +43,9 @@ class SyncProcessManager : public QObject ~SyncProcessManager(); /** - Return OpenSync GroupEnv. + Return OpenSync Environment. */ - QSync::GroupEnv *groupEnv() const { return mGroupEnv; } - - /** - Return OpenSync PluginEnv. - */ - QSync::PluginEnv *pluginEnv() const { return mPluginEnv; } + QSync::Environment *environment() const { return mEnvironment; } /** Returns the number of SyncProcesses. @@ -88,11 +82,6 @@ class SyncProcessManager : public QObject */ QSync::Result addMember( SyncProcess *process, const QSync::Plugin &plugin ); - /** - Removes the @param member from the group of @param process. - */ - void removeMember( SyncProcess *process, const QSync::Member &member ); - signals: void changed(); void syncProcessChanged( SyncProcess *process ); @@ -100,12 +89,10 @@ class SyncProcessManager : public QObject private: SyncProcessManager(); - void initGroup( QSync::GroupEnv *groupEnv ); -// void initPlugin( QSync::PluginEnv *pluginEnv ); + void init( QSync::Environment *environment ); TQValueList<SyncProcess*> mProcesses; - QSync::GroupEnv *mGroupEnv; - QSync::PluginEnv *mPluginEnv; + QSync::Environment *mEnvironment; static SyncProcessManager *mSelf; }; |